mirror of
https://github.com/logsol/chuck.js.git
synced 2026-05-11 10:37:34 +00:00
added gangsta level and tried to fix on new level
This commit is contained in:
parent
3283f97f07
commit
0592e2524d
11 changed files with 1434 additions and 15 deletions
|
|
@ -108,8 +108,8 @@ function (Parent, Box2D, PhysicsEngine, ViewManager, PlayerController, Nc, reque
|
|||
}
|
||||
}
|
||||
|
||||
this.audioPlayer = new AudioPlayer(Settings.AUDIO_PATH + "city.mp3");
|
||||
this.audioPlayer.play();
|
||||
//this.audioPlayer = new AudioPlayer(Settings.AUDIO_PATH + "city.mp3");
|
||||
//this.audioPlayer.play();
|
||||
};
|
||||
|
||||
GameController.prototype.onWorldUpdateGameObject = function(body, gameObject, update) {
|
||||
|
|
@ -269,7 +269,7 @@ function (Parent, Box2D, PhysicsEngine, ViewManager, PlayerController, Nc, reque
|
|||
|
||||
Parent.prototype.destroy.call(this);
|
||||
|
||||
this.audioPlayer.destroy();
|
||||
//this.audioPlayer.destroy();
|
||||
|
||||
this.view.destroy();
|
||||
};
|
||||
|
|
|
|||
|
|
@ -86,13 +86,14 @@ function (ProtocolHelper, GameController, User, Nc, Settings, DomController) {
|
|||
};
|
||||
|
||||
Networker.prototype.onLevelLoaded = function() {
|
||||
/*
|
||||
this.gameController.createMe(this.users[this.meUserId]);
|
||||
|
||||
for (var userId in this.users) {
|
||||
if(this.meUserId != userId) {
|
||||
this.gameController.createPlayer(this.users[userId]);
|
||||
}
|
||||
}
|
||||
}*/
|
||||
|
||||
this.gameController.onLevelLoaded();
|
||||
|
||||
|
|
@ -166,7 +167,11 @@ function (ProtocolHelper, GameController, User, Nc, Settings, DomController) {
|
|||
}
|
||||
|
||||
Networker.prototype.onGameCommand = function(message) {
|
||||
this.gameController.onGameCommand(message);
|
||||
if (this.gameController) {
|
||||
this.gameController.onGameCommand(message);
|
||||
} else {
|
||||
console.warn("Networker.onGameCommand: this.gameController is undefined", message);
|
||||
}
|
||||
}
|
||||
|
||||
Networker.prototype.onPong = function(timestamp) {
|
||||
|
|
@ -183,6 +188,14 @@ function (ProtocolHelper, GameController, User, Nc, Settings, DomController) {
|
|||
}
|
||||
|
||||
this.gameController = new GameController(options);
|
||||
|
||||
this.gameController.createMe(this.users[this.meUserId]);
|
||||
|
||||
for (var userId in this.users) {
|
||||
if(this.meUserId != userId) {
|
||||
this.gameController.createPlayer(this.users[userId]);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
Networker.prototype.onEndRound = function() {
|
||||
|
|
|
|||
|
|
@ -25,7 +25,7 @@ function (Abstract) {
|
|||
value: {
|
||||
TILE: 'tile',
|
||||
ITEM: 'item',
|
||||
SPAWN: 'spawn'
|
||||
SPAWN: 'spawnpoints'
|
||||
}
|
||||
});
|
||||
|
||||
|
|
|
|||
|
|
@ -22,6 +22,8 @@ function (Parent, DomController, PIXI, Settings, Nc, Exception, GameStats, Layer
|
|||
|
||||
Parent.call(this);
|
||||
|
||||
this.xyz = Math.random()
|
||||
|
||||
this.layerManager = null;
|
||||
this.stage = null;
|
||||
this.container = null;
|
||||
|
|
@ -52,6 +54,7 @@ function (Parent, DomController, PIXI, Settings, Nc, Exception, GameStats, Layer
|
|||
|
||||
if(Settings.USE_WEBGL) {
|
||||
|
||||
PIXI.WebGLRenderer.glContextId = 0;
|
||||
this.renderer = new PIXI.WebGLRenderer(Settings.STAGE_WIDTH, Settings.STAGE_HEIGHT, rendererOptions);
|
||||
console.log('WebGLRenderer');
|
||||
|
||||
|
|
@ -62,6 +65,7 @@ function (Parent, DomController, PIXI, Settings, Nc, Exception, GameStats, Layer
|
|||
|
||||
}
|
||||
|
||||
|
||||
this.stage = new PIXI.Stage(0x333333);
|
||||
|
||||
this.container = new PIXI.DisplayObjectContainer();
|
||||
|
|
@ -95,6 +99,7 @@ function (Parent, DomController, PIXI, Settings, Nc, Exception, GameStats, Layer
|
|||
}
|
||||
|
||||
PixiView.prototype.render = function () {
|
||||
|
||||
if (this.me) {
|
||||
this.layerManager.render(this.calculateCenterPosition(), this.currentZoom);
|
||||
}
|
||||
|
|
@ -245,6 +250,9 @@ function (Parent, DomController, PIXI, Settings, Nc, Exception, GameStats, Layer
|
|||
|
||||
this.renderer.render(this.stage);
|
||||
|
||||
this.renderer.destroy();
|
||||
delete this.renderer;
|
||||
|
||||
Parent.prototype.destroy.call(this);
|
||||
};
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue