removed worm

This commit is contained in:
Logsol 2013-01-03 23:44:25 +01:00
parent 69fd43a900
commit 0adbc2a10a
4 changed files with 16 additions and 26 deletions

View file

@ -15,25 +15,18 @@
this.users = {};
this.pipeToLobby = pipeToLobby;
this.gameController = new GameController(this);
this.gameController.loadLevel("default.json");
//this.pipeToLobby.receive = function (message) { self.onMessage(message) };
// !!! This should be done differently - use NotificationCenter.on('channel/dungeon/message') instead
/*
var self = this;
NotificationCenter.on("processGameCommandFromUser", function (topic, args) {
self.processGameCommandFromUser.apply(self, args);
});
*/
*/
// Messages look like:
// {channel: {setName: 'foo'}}
// {user: {jupm: null}, id: 12}
NotificationCenter.on('channel/message', function (message) {
switch(message.recipient) {
@ -60,7 +53,7 @@
}
});
NotificationCenter.on('channel/users/all', this.sendControlCommandToAllUsers, this);
NotificationCenter.on('sendControlCommandToAllUsers', this.sendControlCommandToAllUsers, this);
NotificationCenter.on('channel/users/all/except', this.sendControlCommandToAllUsersExcept, this);
console.checkpoint('channel ' + name + ' created');

View file

@ -15,17 +15,17 @@ function (Parent, PhysicsEngine, Settings, InputController, requestAnimFrame, No
this.inputControllers = {};
this.channel = channel;
//this.update();
//this.updateWorld();
this.update();
this.updateWorld();
//NotificationCenter.on('user/joined', this.userJoined, this);
//NotificationCenter.on('user/left', this.userLeft, this);
NotificationCenter.on('user/joined', this.userJoined, this);
NotificationCenter.on('user/left', this.userLeft, this);
console.checkpoint('starting game controller for channel ' + channel.name);
}
GameController.prototype = Object.create(Parent.prototype);
/*
GameController.prototype.update = function () {
requestAnimFrame(this.update.bind(this));
@ -37,6 +37,8 @@ function (Parent, PhysicsEngine, Settings, InputController, requestAnimFrame, No
}
GameController.prototype.userJoined = function (user) {
console.log(Parent.prototype);
Parent.prototype.userJoined.call(this, user);
var id = user.id;
@ -77,11 +79,11 @@ function (Parent, PhysicsEngine, Settings, InputController, requestAnimFrame, No
} while (body = body.GetNext());
if(isUpdateNeeded) {
//NotificationCenter.trigger("sendCommandToAllUsers", ['gameCommand', {worldUpdate:update}]);
NotificationCenter.trigger("sendControlCommandToAllUsers", ['gameCommand', {worldUpdate:update}]);
}
setTimeout(this.updateWorld.bind(this), Settings.WORLD_UPDATE_BROADCAST_INTERVAL);
}
*/
return GameController;
});