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
|
stars = [];
blackHoles = [];
levels = [];
Level = function(name, description, cameraCoords) {
this.name = name;
this.description = description;
this.cameraCoords = cameraCoords;
this.stars = [];
this.blackHoles = [];
levels.push(this);
}
Level.prototype.addStar = function(center, size) {
this.stars.push(new Star(center, size));
}
Level.prototype.addBlackHole = function(center, size) {
this.blackHoles.push(new BlackHole(center, size));
}
Level.prototype.load = function() {
stars = this.stars;
blackHoles = this.blackHoles;
pos = this.cameraCoords;
}
function createLevels() {
var l1 = new Level(
"Star passing behind black hole",
"You can see how the black hole (correctly) warps the light of the star behind it when it passes",
[1000,0,650]);
l1.addStar([1100,0,1000], 10);
l1.addBlackHole([1000,0,900], 30);
}
|