projects
/
ld40.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Fix healthbar not showing 0 when killed
[ld40.git]
/
ld40.js
diff --git
a/ld40.js
b/ld40.js
index 6a1eb77ea15a4a09b5d5c371c93c5941f4eb4ced..e981a9ef0768c78a6868a9e8c0ffdbae3f066660 100644
(file)
--- a/
ld40.js
+++ b/
ld40.js
@@
-44,7
+44,7
@@
this.lasttime_shoot = 0;
this.lasttime_mode = 0;
this.lasttime_damage = 0;
this.lasttime_shoot = 0;
this.lasttime_mode = 0;
this.lasttime_damage = 0;
- this.speed =
150
;
+ this.speed =
SPEED_PLAYER
;
this.switchmode(MODE_DETERMINATION);
this.weapon = new JusticeBlaster(game, this);
this.weapon.bulletSpeed = SPEED_PPROJECTILE;
this.switchmode(MODE_DETERMINATION);
this.weapon = new JusticeBlaster(game, this);
this.weapon.bulletSpeed = SPEED_PPROJECTILE;
@@
-73,6
+73,12
@@
}
}
}
}
+ kill() {
+ this.health = 0;
+ this.healthBar.update(this.love, this.maxHealth, this.health);
+ super.kill();
+ }
+
loveUp() {
this.love++
this.maxHealth += this.love;
loveUp() {
this.love++
this.maxHealth += this.love;
@@
-263,9
+269,7
@@
nexttime_determination = Math.random() * WAIT_DETERMINATION;
monsters = game.add.group();
nexttime_determination = Math.random() * WAIT_DETERMINATION;
monsters = game.add.group();
- monsters.add(new Monster(400, 500));
- monsters.children.forEach(function(monster) { monster.enablePhysics(); });
- nexttime_monsterspawn = WAIT_MONSTERSPAWN;
+ nexttime_monsterspawn = WAIT_MONSTERSPAWN / 4;
player = new Player(game.world.width / 2, game.world.height / 2);
player.enablePhysics();
player = new Player(game.world.width / 2, game.world.height / 2);
player.enablePhysics();
@@
-273,8
+277,6
@@
game.camera.follow(player);
cursors = game.input.keyboard.createCursorKeys();
game.camera.follow(player);
cursors = game.input.keyboard.createCursorKeys();
- keyboard_handler = keyPress_default;
-
}
function update () {
}
function update () {
@@
-296,16
+298,11
@@
var monster = new Monster(Math.random() * game.world.width, Math.random() * game.world.height);
monster.enablePhysics();
monsters.add(monster);
var monster = new Monster(Math.random() * game.world.width, Math.random() * game.world.height);
monster.enablePhysics();
monsters.add(monster);
- nexttime_monsterspawn = game.time.now + (WAIT_MONSTERSPAWN / player.love) + (Math.random() * WAIT_MONSTERSPAWN);
+ var waittime = WAIT_MONSTERSPAWN - ((Math.random() * 2000) * player.love);
+ nexttime_monsterspawn = game.time.now + waittime;
+ console.log('Next monster in ' + waittime);
}
if ((game.time.now - player.lastmovetime) > WAIT_KEY) player.body.velocity.x = player.body.velocity.y = 0;
}
if ((game.time.now - player.lastmovetime) > WAIT_KEY) player.body.velocity.x = player.body.velocity.y = 0;
- if (keyboard_handler) keyboard_handler();
-
- }
-
- function keyPress_default() {
-
- // Maybe needed later.
}
}