-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathBoxFeild.js
33 lines (29 loc) · 877 Bytes
/
BoxFeild.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
function BoxFeild(currLevel) {
powerupjs.GameObjectList.call(this, ID.layer_overlays, ID.boxes);
this.levelIndex = currLevel;
this.loadBoxes();
}
BoxFeild.prototype = Object.create(powerupjs.GameObjectList.prototype)
BoxFeild.prototype.loadBoxes = function() {
if (localStorage.boxInfo === undefined) {
var string = "";
for (var i = 0; i < 2; i++) {
string += i + ":" + "none" + ":";
}
localStorage.boxInfo = string;
}
var lvlSplit = localStorage.boxInfo.split(":");
var info = lvlSplit[(this.levelIndex * 2) + 1].split(",");
for (var l = 0; l < info.length - 1; l++) {
var infoAttributes = info[l].split("/");
this.add(
new Box(
infoAttributes[0],
new powerupjs.Vector2(
parseInt(infoAttributes[1]),
parseInt(infoAttributes[2])
)
)
);
}
}