Added spawning gameCommand logic

This commit is contained in:
Logsol 2013-01-05 08:19:49 +01:00
parent 371592f167
commit fb5de522e5
8 changed files with 84 additions and 59 deletions

View file

@ -36,9 +36,7 @@ function (Engine, Level, Player) {
}
GameController.prototype.userJoined = function (user) {
var player = new Player(user.id, this.physicsEngine);
this.players[user.id] = player;
return player;
this.players[user.id] = this.createPlayer(user);
}
GameController.prototype.userLeft = function (user) {
@ -47,6 +45,10 @@ function (Engine, Level, Player) {
delete this.players[user.id];
}
GameController.prototype.createPlayer = function(user) {
return new Player(user.id, this.physicsEngine);
};
return GameController;
});