fixes enemy stat update

This commit is contained in:
Jeena 2015-04-19 18:13:53 +02:00
parent a66a327386
commit ed35071fff
2 changed files with 11 additions and 4 deletions

View file

@ -70,7 +70,7 @@ function (Parent, Nc) {
this.kill(enemy, byItem); this.kill(enemy, byItem);
} }
this.broadcastStats(); this.broadcastStats(enemy);
}; };
Player.prototype.spawn = function(x, y) { Player.prototype.spawn = function(x, y) {
@ -102,11 +102,18 @@ function (Parent, Nc) {
this.stats.score++; this.stats.score++;
}; };
Player.prototype.broadcastStats = function() { Player.prototype.broadcastStats = function(enemy) {
Nc.trigger(Nc.ns.channel.to.client.gameCommand.broadcast, "updateStats", { Nc.trigger(Nc.ns.channel.to.client.gameCommand.broadcast, "updateStats", {
playerId: this.id, playerId: this.id,
stats: this.stats stats: this.stats
}); });
if(enemy && enemy != this) {
Nc.trigger(Nc.ns.channel.to.client.gameCommand.broadcast, "updateStats", {
playerId: enemy.id,
stats: enemy.stats
});
}
}; };

View file

@ -1,4 +1,4 @@
define([ define([
], ],
function () { function () {
@ -86,7 +86,7 @@ function () {
// CHANNEL // CHANNEL
CHANNEL_MAX_USERS: 20, CHANNEL_MAX_USERS: 20,
CHANNEL_DESTRUCTION_TIME: 0.5 * 60, CHANNEL_DESTRUCTION_TIME: 0.5 * 60,
CHANNEL_END_ROUND_TIME: 4, //10, CHANNEL_END_ROUND_TIME: 20, //10,
CHANNEL_DEFAULT_MAX_USERS: 40, CHANNEL_DEFAULT_MAX_USERS: 40,
CHANNEL_DEFAULT_SCORE_LIMIT: 10, CHANNEL_DEFAULT_SCORE_LIMIT: 10,
CHANNEL_DEFAULT_LEVELS: ["debug"], CHANNEL_DEFAULT_LEVELS: ["debug"],