Skip to content

Commit

Permalink
die on enemy touch.
Browse files Browse the repository at this point in the history
  • Loading branch information
ripsawridge committed Nov 18, 2014
1 parent ff38972 commit 8bbe6fc
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion melonjs-tutorial/boilerplate-master/js/entities/entities.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@ game.PlayerEntity = me.Entity.extend({
},

update: function(dt) {
if (this.alive === false) {
return false;
}

if (me.input.isKeyPressed("left")) {
// flip the sprite.
this.flipX(true);
Expand Down Expand Up @@ -67,7 +71,9 @@ game.PlayerEntity = me.Entity.extend({
game.data.score += 30;
} else {
// Let's flicker in case we touched an enemy
this.renderable.flicker(true);
// this.renderable.flicker(true);
// Naw, let's just die.
this.die();
}
} else if (response.b.body.collisionType == me.collision.types.ACTION_OBJECT) {
// b is a LevelEntity. Indicate our new respawn point.
Expand Down

0 comments on commit 8bbe6fc

Please sign in to comment.