mirror of
https://github.com/logsol/chuck.js.git
synced 2026-05-11 10:37:34 +00:00
fixes enemy stat update
This commit is contained in:
parent
a66a327386
commit
ed35071fff
2 changed files with 11 additions and 4 deletions
|
|
@ -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
|
||||||
|
});
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -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"],
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue