fixes the sending and rendering of game stats

This commit is contained in:
Jeena 2015-04-19 17:31:41 +02:00
parent cad112419d
commit a66a327386
8 changed files with 81 additions and 62 deletions

View file

@ -202,6 +202,7 @@ function (Parent, PhysicsEngine, Settings, PlayerController, requestAnimFrame, N
this.spawnPlayer(player, 0);
};
// FIXME: remove this method
GameController.prototype.onResetLevel = function(userId) {
console.log('OH NO!!! ON RESET LEVEL IS CALLED AND RESPAWNES PLAYERS');
@ -214,7 +215,6 @@ function (Parent, PhysicsEngine, Settings, PlayerController, requestAnimFrame, N
};
GameController.prototype.destroy = function() {
console.log("clearTimeout")
clearTimeout(this.animationTimeout);
clearTimeout(this.worldUpdateTimeout);

View file

@ -65,12 +65,12 @@ function (Parent, Nc) {
if(this.stats.health < 0) this.stats.health = 0;
this.broadcastStats();
if(this.stats.health <= 0) {
if(enemy != this) enemy.score();
this.kill(enemy, byItem);
}
this.broadcastStats();
};
Player.prototype.spawn = function(x, y) {