This commit is contained in:
Jeena 2014-03-01 23:11:36 +01:00
parent d83376d5c7
commit 810a74a28b
13 changed files with 445 additions and 281 deletions

View file

@ -79,14 +79,18 @@ function (PhysicsEngine, TiledLevel, Player, Nc) {
}
*/
GameController.prototype.onUserLeft = function (user) {
var player = this.players[user.id];
GameController.prototype.onUserLeft = function (userId) {
var player = this.players[userId];
if(!player) {
console.warn("User (", userId ,") left who has not joined");
return;
}
var i = this.gameObjects.animated.indexOf(player);
if(i>=0) this.gameObjects.animated.splice(i, 1);
player.destroy();
delete this.players[user.id];
delete this.players[userId];
}
GameController.prototype.createPlayer = function(user) {