Skip to content

Commit

Permalink
Merge branch 'j' into master
Browse files Browse the repository at this point in the history
  • Loading branch information
cjmeeks authored Dec 16, 2016
2 parents 11a9493 + 586937b commit 31100a2
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 26 deletions.
2 changes: 1 addition & 1 deletion TestLevel/src/enemies/archers/arrow.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ function Arrow(position, velocity) {

var actualFrame = {x: (velocity.x < 0)? ARROW_LEFT : ARROW_RIGHT, y: 0};

Particle.call(this, position, velocity, image, actualFrame, FRAME);
Particle.call(this, position, velocity, image, actualFrame, FRAME, "arrow");
}

/**
Expand Down
12 changes: 6 additions & 6 deletions TestLevel/src/enemies/mages/spell.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,11 @@ module.exports = exports = Spell;
*/
function Spell(position, velocity, type) {
var image = new Image();

var actualFrame = {x: (velocity.x < 0)? SPELL_LEFT : SPELL_RIGHT, y: 0};
switch(type)
{
case "basic":
case "basic":
var frame = {source_frame_width: 18,
source_frame_height: 17,
dest_frame_width: 18,
Expand All @@ -48,9 +48,9 @@ function Spell(position, velocity, type) {
break;

}
Particle.call(this, position, velocity, image, actualFrame, frame);


Particle.call(this, position, velocity, image, actualFrame, frame, "spell");
}

/**
Expand Down Expand Up @@ -80,4 +80,4 @@ Spell.prototype.render = function(elapsedTime, ctx) {
*/
function getRandomInt(min, max) {
return Math.floor(Math.random() * (max - min + 1)) + min;
}
}
23 changes: 5 additions & 18 deletions TestLevel/src/entity-manager.js
Original file line number Diff line number Diff line change
Expand Up @@ -189,14 +189,11 @@ function poopCollisions(me, player){
if (player.position.x + 32 > pool.pool[4*i] &&
player.position.y < pool.pool[i*4+1] + pool.bulletRadius &&
player.position.x < pool.pool[4*i] + pool.bulletRadius &&
player.position.y + 32 > pool.pool[i*4+1]){
<<<<<<< HEAD
resetPlayer.call(me, pool.pool[i*4+1]);
player.position.y + 32 > pool.pool[i*4+1]);

player.health -= 50;
console.log(player.health);
=======
resetPlayer.call(me, {x: pool.pool[4*i], y: pool.pool[4*i+1]});
>>>>>>> c
break;
}
}
Expand All @@ -222,10 +219,6 @@ function collisions() {
player.position.y < enemy.position.y + enemy.height &&
player.position.x < enemy.position.x + enemy.width - enemy.hitboxDiff.x &&
player.position.y + 32 > enemy.position.y + enemy.hitboxDiff.y) {
<<<<<<< HEAD
=======

>>>>>>> c
// player is above enemy
if (player.position.y + 32 <= enemy.position.y + enemy.hitboxDiff.y + 14) {
player.velocity.y = -15; player.state = "jump"; player.time = 0;
Expand All @@ -236,11 +229,7 @@ function collisions() {
killEnemy.call(self, i, enemy); }
}
//player takes hit
<<<<<<< HEAD
else { resetPlayer.call(self, enemy);player.health -= 20;console.log(player.health); }
=======
else { resetPlayer.call(self, enemy.position); player.health -= 20; }
>>>>>>> c
}
})
}
Expand All @@ -260,6 +249,7 @@ function killEnemy(index, enemy) {
//remove enemy
e_array.splice(index, 1);

this.player.score += 100;
}

// creates an explosion at a given position with a given color
Expand Down Expand Up @@ -303,19 +293,16 @@ function detectPlayerParticleCollisions() {
self.player.position.y > particle.position.y + particle.frame.dest_frame_height ||
self.player.position.y + self.player.frame.dest_frame_height < particle.position.y
)) {
<<<<<<< HEAD
resetPlayer.call(self, particle);

self.player.health -= 30;
console.log(self.player.health);
=======

// player is above enemy
if (self.player.position.y + 32 <= particle.position.y + 10) {
self.player.velocity.y = -15; self.player.state = "jump"; self.player.time = 0;
removeParticle.call(self, i, particle);
}
//player takes hit
else { resetPlayer.call(self, particle.position); self.player.health -= 20; }
>>>>>>> c
}

});
Expand Down
3 changes: 2 additions & 1 deletion TestLevel/src/particle.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,14 @@ module.exports = exports = Particle;
* @param {int} frameHeight, y-position of the frame in the source image
* @param {int} frameSize, size (width & height) of the destionation frame
*/
function Particle(startingPosition, velocity, image, actualFrame, frame) {
function Particle(startingPosition, velocity, image, actualFrame, frame, type) {
this.position = startingPosition;
this.velocity = velocity;
// TODO
this.image = image;
this.frame = frame;
this.actualFrame = actualFrame;
this.type = type;
}

/**
Expand Down
1 change: 1 addition & 0 deletions TestLevel/src/player.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ function Player(x,y) {
this.previousState = "moving";
this.isdead = false;
this.health = 100;
this.score = 0;
}

/**
Expand Down

0 comments on commit 31100a2

Please sign in to comment.