mirror of
https://github.com/logsol/chuck.js.git
synced 2026-05-11 10:37:34 +00:00
fixed #38
This commit is contained in:
parent
7a59e175e0
commit
89c5e4a5d8
6 changed files with 64 additions and 25 deletions
|
|
@ -1,10 +1,11 @@
|
|||
define([
|
||||
"Game/" + GLOBALS.context + "/Physics/Engine",
|
||||
"Game/" + GLOBALS.context + "/Loader/TiledLevel",
|
||||
"Game/" + GLOBALS.context + "/Player"
|
||||
"Game/" + GLOBALS.context + "/Player",
|
||||
"Lib/Utilities/NotificationCenter"
|
||||
],
|
||||
|
||||
function (PhysicsEngine, TiledLevel, Player) {
|
||||
function (PhysicsEngine, TiledLevel, Player, NotificationCenter) {
|
||||
|
||||
function GameController () {
|
||||
this.players = {};
|
||||
|
|
@ -17,7 +18,7 @@ function (PhysicsEngine, TiledLevel, Player) {
|
|||
this.physicsEngine = new PhysicsEngine();
|
||||
this.physicsEngine.setCollisionDetector();
|
||||
|
||||
this.update();
|
||||
NotificationCenter.on("game/level/loaded", this.onLevelLoaded, this);
|
||||
}
|
||||
|
||||
GameController.prototype.update = function() {
|
||||
|
|
@ -45,6 +46,10 @@ function (PhysicsEngine, TiledLevel, Player) {
|
|||
this.loadLevel(this.level.uid);
|
||||
};
|
||||
|
||||
GameController.prototype.onLevelLoaded = function() {
|
||||
this.update();
|
||||
};
|
||||
|
||||
|
||||
GameController.prototype.destroy = function () {
|
||||
for(var player in this.players) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue