mirror of
https://github.com/logsol/chuck.js.git
synced 2026-05-11 10:37:34 +00:00
Added spawning gameCommand logic
This commit is contained in:
parent
371592f167
commit
fb5de522e5
8 changed files with 84 additions and 59 deletions
|
|
@ -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;
|
||||
});
|
||||
|
|
|
|||
|
|
@ -5,31 +5,23 @@ define([
|
|||
|
||||
function (Doll, Settings) {
|
||||
|
||||
function Player (id, physicsEngine, repository) {
|
||||
function Player (id, physicsEngine) {
|
||||
this.physicsEngine = physicsEngine;
|
||||
this.id = id;
|
||||
this.repository = repository;
|
||||
this.standing = false;
|
||||
this.doll;
|
||||
this.mc;
|
||||
this.currentAnimationState = 'stand';
|
||||
this.lookDirection = 1;
|
||||
this.moveDirection = 0;
|
||||
this.isSpawned = false;
|
||||
|
||||
this.init(id);
|
||||
}
|
||||
|
||||
Player.prototype.init = function (id) {
|
||||
this.doll = new Doll(this.physicsEngine, id);
|
||||
//this.mc = EmbedHandler.load(EmbedHandler.CHUCK);
|
||||
//this.mc.stop();
|
||||
//var mclp = new MovieClipLabelParser();
|
||||
//mclp.parse(this.mc);
|
||||
}
|
||||
|
||||
Player.prototype.spawn = function (x, y) {
|
||||
//this.repository.createModel(this.mc, this.doll.getBody());
|
||||
this.doll = new Doll(this.physicsEngine, this.id);
|
||||
this.doll.spawn(x, y);
|
||||
this.isSpawned = true;
|
||||
}
|
||||
|
||||
Player.prototype.getDoll = function () {
|
||||
|
|
@ -113,8 +105,6 @@ function (Doll, Settings) {
|
|||
return;
|
||||
}
|
||||
|
||||
//this.mc.gotoAndPlay(type);
|
||||
|
||||
this.currentAnimationState = type;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue