mirror of
https://github.com/logsol/chuck.js.git
synced 2026-05-11 10:37:34 +00:00
fixed #58
This commit is contained in:
parent
d83376d5c7
commit
810a74a28b
13 changed files with 445 additions and 281 deletions
|
|
@ -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) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue