diff options
[WGL/P] Added a proper level management system, added more options to the menu
1 files changed, 32 insertions, 0 deletions
| -rw-r--r-- | Year 2/Computer Graphics with WebGL/Project/level.js | 32 |
diff --git a/Year 2/Computer Graphics with WebGL/Project/level.js b/Year 2/Computer Graphics with WebGL/Project/level.js new file mode 100644 index 0000000..65c3cc6 --- /dev/null +++ b/Year 2/Computer Graphics with WebGL/Project/level.js @@ -0,0 +1,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); +} |
