BlueGit

blue-star cellular-evolution

Files

cellular-evolution / src / main.js

main.js

52679633 History
main.js 1.1 KiB Download Raw
1/**
2 * Main script
3 */
4
5window.onload = init;
6
7function DoInheritance()
8{
9 //resultclass = GameObject.inherit(baseclass, childclass);
10}
11
12function init()
13{
14 DoInheritance();
15 //Game.initialize(xpos, ypos, width, height, fps, callback)
16 // -2 to account for borders
17 var width = window.innerWidth - 2;
18 var height = window.innerHeight - 2;
19
20 Game.initialize(0, 0, width, height, gameStart);
21}
22
23function gameStart()
24{
25 GameWindow.backgroundColor = {r:100, g:149, b:237};
26
27 Game.setUpdateFunction(update); // Let the game engine know we want to link our 'update()' to the game's update step.
28
29 GameAudio.init(sounds, soundsFolder);
30
31 p1 = GameObject.create(gemSpawner, GameWindow.width / 2, GameWindow.height / 2, null, 500);
32 tester = GameObject.create(creature, GameWindow.width / 3, GameWindow.height / 2, null, 500);
33
34 tester.dna = GenerateNewDNA();
35 tester.initCells();
36
37 tester2 = GameObject.create(creature, (GameWindow.width / 3) * 2, GameWindow.height / 2, null, 500);
38
39 tester2.dna = GenerateNewDNA();
40 tester2.initCells();
41}
42
43function update(deltaTime)
44{
45
46}
47