mirror of
https://github.com/logsol/chuck.js.git
synced 2026-05-11 10:37:34 +00:00
fixed #57
This commit is contained in:
parent
810a74a28b
commit
39bdac0d7b
12 changed files with 118 additions and 100 deletions
|
|
@ -94,7 +94,7 @@ function (PhysicsEngine, TiledLevel, Player, Nc) {
|
|||
}
|
||||
|
||||
GameController.prototype.createPlayer = function(user) {
|
||||
var player = new Player(user.id, this.physicsEngine);
|
||||
var player = new Player(user.id, this.physicsEngine, user);
|
||||
this.players[user.id] = player;
|
||||
return player;
|
||||
};
|
||||
|
|
|
|||
|
|
@ -10,13 +10,14 @@ define([
|
|||
|
||||
function (Doll, Settings, Nc, Exception, SpectatorDoll, RagDoll) {
|
||||
|
||||
function Player (id, physicsEngine) {
|
||||
function Player (id, physicsEngine, user) {
|
||||
this.stats = {
|
||||
health: 100,
|
||||
deaths: 0,
|
||||
score: 0
|
||||
}
|
||||
|
||||
this.user = user;
|
||||
this.physicsEngine = physicsEngine;
|
||||
this.playerController = null;
|
||||
this.doll;
|
||||
|
|
|
|||
|
|
@ -1,7 +1,13 @@
|
|||
define(function () {
|
||||
|
||||
function User (id) {
|
||||
function User (id, options) {
|
||||
this.id = id;
|
||||
this.options = options;
|
||||
|
||||
this.options.id = this.id;
|
||||
if(!this.options.nickname) {
|
||||
this.options.nickname = this.id;
|
||||
}
|
||||
}
|
||||
|
||||
return User;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue