mirror of
https://github.com/logsol/chuck.js.git
synced 2026-05-11 18:47:35 +00:00
added Level loader
This commit is contained in:
parent
27115c7723
commit
ae02a9e449
4 changed files with 277 additions and 2 deletions
|
|
@ -3,10 +3,11 @@ var requires = [
|
|||
"Chuck/Player",
|
||||
"Chuck/Control/InputControlUnit",
|
||||
"Chuck/Settings",
|
||||
"Box2D/Box2D"
|
||||
"Box2D/Box2D",
|
||||
"Chuck/Loader/Level"
|
||||
];
|
||||
|
||||
define(requires, function(PhysicsEngine, Player, InputControlUnit, Settings, Box2D){
|
||||
define(requires, function(PhysicsEngine, Player, InputControlUnit, Settings, Box2D, Level){
|
||||
|
||||
function Processor () {
|
||||
this._me;
|
||||
|
|
@ -18,6 +19,8 @@ define(requires, function(PhysicsEngine, Player, InputControlUnit, Settings, Box
|
|||
|
||||
this._bodyDef;
|
||||
|
||||
this.level;
|
||||
|
||||
this.init();
|
||||
};
|
||||
|
||||
|
|
@ -44,6 +47,14 @@ define(requires, function(PhysicsEngine, Player, InputControlUnit, Settings, Box
|
|||
setInterval(this._update, 1000/60, this);
|
||||
}
|
||||
|
||||
Processor.prototype.loadLevel = function(path) {
|
||||
if (this.level) {
|
||||
this.level.unload();
|
||||
}
|
||||
|
||||
this.level = new Level(path, this._physicsEngine);
|
||||
this.level.loadLevelInToEngine();
|
||||
}
|
||||
|
||||
Processor.prototype._makeBox = function() {
|
||||
var world = this._physicsEngine.getWorld();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue