mirror of
https://github.com/logsol/chuck.js.git
synced 2026-05-12 11:07:34 +00:00
letting player spawn. hiding three.js canvas
This commit is contained in:
parent
4767632f3d
commit
6219a82fbd
5 changed files with 24 additions and 15 deletions
|
|
@ -37,12 +37,11 @@ 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;
|
||||
var player = this.players[id];
|
||||
player.spawn(50, 50);
|
||||
this.inputControllers[id] = new InputController(player);
|
||||
}
|
||||
|
||||
|
|
@ -67,6 +66,9 @@ function (Parent, PhysicsEngine, Settings, InputController, requestAnimFrame, No
|
|||
do {
|
||||
var userData = body.GetUserData();
|
||||
|
||||
|
||||
|
||||
|
||||
if(userData && body.IsAwake()) {
|
||||
update[userData] = {
|
||||
p: body.GetPosition(),
|
||||
|
|
@ -79,7 +81,7 @@ function (Parent, PhysicsEngine, Settings, InputController, requestAnimFrame, No
|
|||
} while (body = body.GetNext());
|
||||
|
||||
if(isUpdateNeeded) {
|
||||
NotificationCenter.trigger("sendControlCommandToAllUsers", ['gameCommand', {worldUpdate:update}]);
|
||||
NotificationCenter.trigger("sendControlCommandToAllUsers", 'gameCommand', {worldUpdate:update});
|
||||
}
|
||||
|
||||
setTimeout(this.updateWorld.bind(this), Settings.WORLD_UPDATE_BROADCAST_INTERVAL);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue