implemented level load, more to do see #1

This commit is contained in:
Jeena 2014-01-29 03:24:08 +01:00
parent b02036a019
commit 953159e6bd
12 changed files with 333 additions and 409 deletions

View file

@ -1,9 +1,31 @@
define([
"Game/Core/Loader/Level"
"Game/Core/Loader/Level",
"Game/Config/Settings"
],
function(Parent) {
return Parent;
function (Parent, Settings) {
function Level (uid, engine, gameObjects) {
Parent.call(this, uid, engine, gameObjects);
}
Level.prototype = Object.create(Parent.prototype);
Level.prototype.loadLevelDataFromPath = function (path, callback) {
var xhr = new XMLHttpRequest();
xhr.onreadystatechange = function() {
if(xhr.readyState == 4) {
if(xhr.status == 200) {
callback(JSON.parse(xhr.responseText))
} else {
console.error("Ajax error: " + xhr.status + " " + xhr.statusText)
}
}
}
xhr.open("GET", path, true);
xhr.send(null);
}
return Level;
});