Commit a2d86c0b authored by Pablo R. Mier's avatar Pablo R. Mier

Bullet speed updated according to the number of invaders

parent c2b94b30
......@@ -47,8 +47,6 @@ invadersApp.Game = function (game) {
this.gameState = invadersApp.GameState.PAUSED;
this.lastShootAt = 0;
this.readyToFire = true;
this.animationDelay = Phaser.Timer.SECOND;
};
......@@ -287,8 +285,8 @@ invadersApp.Game.prototype = {
},
updateCounter: function () {
var living = this.objects.invaders.countLiving();
this.invadersHud.font.text = invadersApp.utils.pad(living, 3);
this.living = this.objects.invaders.countLiving();
this.invadersHud.font.text = invadersApp.utils.pad(this.living, 3);
}
};
......@@ -62,7 +62,7 @@ invadersApp.Player.prototype.update = function () {
var aliveBullets = this.bullets.countLiving();
// Get the number of alive invaders
var aliveInvaders = this.ctx.objects.invaders.countLiving();
var aliveInvaders = this.ctx.living;
if (aliveInvaders > MIN_INVADERS && aliveBullets <= aliveInvaders/10) {
this.lastShootAt = this.game.time.now;
......@@ -77,7 +77,7 @@ invadersApp.Player.prototype.update = function () {
xpos = this.x + 21;
}
bullet.reset(xpos, this.y - 20);
bullet.body.velocity.y = -2000;
bullet.body.velocity.y = -(1000 + aliveInvaders * 15);
}
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment