added Level loader

This commit is contained in:
Jeena Paradies 2012-07-10 00:50:47 +02:00
parent 27115c7723
commit ae02a9e449
4 changed files with 277 additions and 2 deletions

View file

@ -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();