-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathlevel01.js
120 lines (101 loc) · 6.25 KB
/
level01.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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
// Create new Level prototypes like this to add a level with gameobjects. level01 is the first level.
Level.prototype.level01 = function(){
// Window Options
Display.bgColor = "#083366";
// Spawn Player
GameObject.spawn("Mario", Display.width / 2, Display.height / 2, -3);
// Spawn UI
GameObject.spawn("Text", Display.width - 40, 50, -4, "coinsUI");
gameObjectArray[GameObject.getID("coinsUI")].textAlign = "right";
gameObjectArray[GameObject.getID("coinsUI")].text = "0 COINS";
// Game Over Text
GameObject.spawn("Text", Display.width / 2, Display.height / 2, -4, "gameover");
gameObjectArray[GameObject.getID("gameover")].textAlign = "center";
gameObjectArray[GameObject.getID("gameover")].text = "GAME OVER";
gameObjectArray[GameObject.getID("gameover")].visible = false;
// New High Score Text
GameObject.spawn("Text", Display.width / 2, Display.height / 2 - 180, -4, "textnewhighscore");
gameObjectArray[GameObject.getID("textnewhighscore")].textAlign = "center";
gameObjectArray[GameObject.getID("textnewhighscore")].text = "NEW HIGH SCORE!";
gameObjectArray[GameObject.getID("textnewhighscore")].visible = false;
gameObjectArray[GameObject.getID("textnewhighscore")].color = "#00CCFF";
// Player Username Text
GameObject.spawn("Text", Display.width / 2, Display.height / 2 - 140, -4, "textplayer");
gameObjectArray[GameObject.getID("textplayer")].textAlign = "center";
gameObjectArray[GameObject.getID("textplayer")].text = "PLAYER";
gameObjectArray[GameObject.getID("textplayer")].visible = false;
// High Score Text
GameObject.spawn("Text", Display.width / 2, Display.height / 2 - 100, -4, "texthighscore");
gameObjectArray[GameObject.getID("texthighscore")].textAlign = "center";
gameObjectArray[GameObject.getID("texthighscore")].text = "0 COINS";
gameObjectArray[GameObject.getID("texthighscore")].visible = false;
// Leaderboards
GameObject.spawn("Text", Display.width / 2, Display.height / 2 + 100, -4, "textLeaderboard");
gameObjectArray[GameObject.getID("textLeaderboard")].textAlign = "center";
gameObjectArray[GameObject.getID("textLeaderboard")].text = "LEADERBOARD";
gameObjectArray[GameObject.getID("textLeaderboard")].visible = false;
GameObject.spawn("Text", Display.width / 2 - 250, Display.height / 2 + 140, -4, "textLeaderboard01");
gameObjectArray[GameObject.getID("textLeaderboard01")].textAlign = "left";
gameObjectArray[GameObject.getID("textLeaderboard01")].text = "PLAYER";
gameObjectArray[GameObject.getID("textLeaderboard01")].visible = false;
gameObjectArray[GameObject.getID("textLeaderboard01")].color = "#ffb458";
GameObject.spawn("Text", Display.width / 2 + 250, Display.height / 2 + 140, -4, "textLeaderboard01score");
gameObjectArray[GameObject.getID("textLeaderboard01score")].textAlign = "right";
gameObjectArray[GameObject.getID("textLeaderboard01score")].text = "000000";
gameObjectArray[GameObject.getID("textLeaderboard01score")].visible = false;
gameObjectArray[GameObject.getID("textLeaderboard01score")].color = "#ffb458";
GameObject.spawn("Text", Display.width / 2 - 250, Display.height / 2 + 180, -4, "textLeaderboard02");
gameObjectArray[GameObject.getID("textLeaderboard02")].textAlign = "left";
gameObjectArray[GameObject.getID("textLeaderboard02")].text = "PLAYER";
gameObjectArray[GameObject.getID("textLeaderboard02")].visible = false;
GameObject.spawn("Text", Display.width / 2 + 250, Display.height / 2 + 180, -4, "textLeaderboard02score");
gameObjectArray[GameObject.getID("textLeaderboard02score")].textAlign = "right";
gameObjectArray[GameObject.getID("textLeaderboard02score")].text = "000000";
gameObjectArray[GameObject.getID("textLeaderboard02score")].visible = false;
GameObject.spawn("Text", Display.width / 2 - 250, Display.height / 2 + 220, -4, "textLeaderboard03");
gameObjectArray[GameObject.getID("textLeaderboard03")].textAlign = "left";
gameObjectArray[GameObject.getID("textLeaderboard03")].text = "PLAYER";
gameObjectArray[GameObject.getID("textLeaderboard03")].visible = false;
GameObject.spawn("Text", Display.width / 2 + 250, Display.height / 2 + 220, -4, "textLeaderboard03score");
gameObjectArray[GameObject.getID("textLeaderboard03score")].textAlign = "right";
gameObjectArray[GameObject.getID("textLeaderboard03score")].text = "000000";
gameObjectArray[GameObject.getID("textLeaderboard03score")].visible = false;
GameObject.spawn("Text", Display.width / 2 - 250, Display.height / 2 + 260, -4, "textLeaderboard04");
gameObjectArray[GameObject.getID("textLeaderboard04")].textAlign = "left";
gameObjectArray[GameObject.getID("textLeaderboard04")].text = "PLAYER";
gameObjectArray[GameObject.getID("textLeaderboard04")].visible = false;
GameObject.spawn("Text", Display.width / 2 + 250, Display.height / 2 + 260, -4, "textLeaderboard04score");
gameObjectArray[GameObject.getID("textLeaderboard04score")].textAlign = "right";
gameObjectArray[GameObject.getID("textLeaderboard04score")].text = "000000";
gameObjectArray[GameObject.getID("textLeaderboard04score")].visible = false;
GameObject.spawn("Text", Display.width / 2 - 250, Display.height / 2 + 300, -4, "textLeaderboard05");
gameObjectArray[GameObject.getID("textLeaderboard05")].textAlign = "left";
gameObjectArray[GameObject.getID("textLeaderboard05")].text = "PLAYER";
gameObjectArray[GameObject.getID("textLeaderboard05")].visible = false;
GameObject.spawn("Text", Display.width / 2 + 250, Display.height / 2 + 300, -4, "textLeaderboard05score");
gameObjectArray[GameObject.getID("textLeaderboard05score")].textAlign = "right";
gameObjectArray[GameObject.getID("textLeaderboard05score")].text = "000000";
gameObjectArray[GameObject.getID("textLeaderboard05score")].visible = false;
// Spawn Objects
randomStarSpawner();
GameObject.spawn("AngrySun",0,0,0);
GameObject.spawn("Coin",0,0,1);
GameObject.spawn("Coin",0,0,1);
GameObject.spawn("Coin",0,0,1);
GameObject.spawn("Coin",0,0,1);
GameObject.spawn("Coin",0,0,1);
GameObject.spawn("Coin",0,0,1);
GameObject.spawn("Coin",0,0,1);
GameObject.spawn("Coin",0,0,1);
GameObject.spawn("Coin",0,0,1);
GameObject.spawn("Coin",0,0,1);
GameObject.spawn("Coin",0,0,1);
GameObject.spawn("Coin",0,0,1);
GameObject.spawn("Coin",0,0,1);
// Play BG Music
Level.backgroundMusic.src = ("sounds/mario_athletic.mp3");
Level.backgroundMusic.loop = true;
Level.backgroundMusic.play();
this.gameOver = function(){
}
}