mirror of
https://github.com/logsol/chuck.js.git
synced 2026-05-11 10:37:34 +00:00
replaced killed doll with ragdoll - fixes #50
This commit is contained in:
parent
aa6fdaa2df
commit
413254bfa4
19 changed files with 330 additions and 88 deletions
|
|
@ -34,6 +34,8 @@ function (Parent, PhysicsEngine, Settings, PlayerController, requestAnimFrame, N
|
|||
|
||||
GameController.prototype.update = function () {
|
||||
|
||||
Parent.prototype.update.call(this);
|
||||
|
||||
requestAnimFrame(this.update.bind(this));
|
||||
|
||||
this.physicsEngine.update();
|
||||
|
|
@ -51,16 +53,21 @@ function (Parent, PhysicsEngine, Settings, PlayerController, requestAnimFrame, N
|
|||
Parent.prototype.userJoined.call(this, user);
|
||||
var player = this.players[user.id];
|
||||
user.setPlayer(player);
|
||||
this.spawnPlayer(player);
|
||||
this.spawnPlayer(player, 0);
|
||||
}
|
||||
|
||||
GameController.prototype.spawnPlayer = function(player) {
|
||||
GameController.prototype.spawnPlayer = function(player, respawnTime) {
|
||||
var self = this;
|
||||
var spawnPoint = this.level.getRandomSpawnPoint();
|
||||
|
||||
respawnTime = typeof respawnTime == 'undefined'
|
||||
? Settings.RESPAWN_TIME
|
||||
: respawnTime;
|
||||
|
||||
setTimeout(function() {
|
||||
player.spawn(spawnPoint.x, spawnPoint.y);
|
||||
self.gameObjects.animated.push(player.getDoll());
|
||||
// put it into
|
||||
self.gameObjects.animated.push(player);
|
||||
|
||||
var message = {
|
||||
spawnPlayer: {
|
||||
|
|
@ -71,7 +78,7 @@ function (Parent, PhysicsEngine, Settings, PlayerController, requestAnimFrame, N
|
|||
};
|
||||
|
||||
NotificationCenter.trigger("broadcastControlCommand", "gameCommand", message);
|
||||
}, Settings.RESPAWN_TIME * 1000);
|
||||
}, respawnTime * 1000);
|
||||
};
|
||||
|
||||
GameController.prototype.createPlayer = function(user) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue