added player health action view

This commit is contained in:
logsol 2014-02-17 16:30:59 +01:00
parent c3aee14f23
commit aa6fdaa2df
8 changed files with 214 additions and 44 deletions

View file

@ -45,6 +45,10 @@ function (Parent, Box2D, PhysicsEngine, ViewManager, PlayerController, Notificat
this.me.update();
}
for (var key in this.players) {
this.players[key].render();
}
for (var i = 0; i < this.gameObjects.animated.length; i++) {
this.gameObjects.animated[i].render();
}
@ -130,7 +134,7 @@ function (Parent, Box2D, PhysicsEngine, ViewManager, PlayerController, Notificat
GameController.prototype.onUpdateStats = function(options) {
var player = this.players[options.playerId];
player.stats = options.stats;
player.setStats(options.stats);
// FIXME: move to canvas later
if(player == this.me) {
@ -138,9 +142,10 @@ function (Parent, Box2D, PhysicsEngine, ViewManager, PlayerController, Notificat
}
};
GameController.prototype.onPlayerKill = function(playerId) {
GameController.prototype.onPlayerKill = function(options) {
var player = this.players[options.playerId];
player.kill();
var killedByPlayer = this.players[options.killedByPlayerId];
player.kill(killedByPlayer);
};
GameController.prototype.loadLevel = function (path) {