-
Notifications
You must be signed in to change notification settings - Fork 5
/
LavaWall.js
152 lines (143 loc) · 4.65 KB
/
LavaWall.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
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
/**
*
* @licstart The following is the entire license notice for the
* JavaScript code in this page.
*
* Copyright (C) 2012 David "aniwey" L.
*
*
* The JavaScript code in this page is free software: you can
* redistribute it and/or modify it under the terms of the GNU
* General Public License (GNU GPL) as published by the Free Software
* Foundation, either version 3 of the License, or (at your option)
* any later version. The code is distributed WITHOUT ANY WARRANTY;
* without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU GPL for more details.
*
* As additional permission under GNU GPL version 3 section 7, you
* may distribute non-source (e.g., minimized or compacted) forms of
* that code without the copy of the GNU GPL normally required by
* section 4, provided you include this license notice and a URL
* through which recipients can access the Corresponding Source.
*
* @licend The above is the entire license notice
* for the JavaScript code in this page.
*
*/
function LavaWall(x, y){
// Call the Instakiller constructor
Instakiller.call(this, x, y, 500, main.gameHeight - main.topBarHeight, "#CF0000", false, false, false, false);
// Is it the end of the wall journey?
this.end = false;
}
LavaWall.prototype = Object.create(Instakiller.prototype);
// Loop method, inherited from Instakiller
LavaWall.prototype.loop = function(){
// Move to the right
this.moveToTheRight();
// Call Instakiller loop method
Instakiller.prototype.loop.call(this);
};
// Hit method, inherited from Entity
LavaWall.prototype.hit = function(entity){
// If it's not the end
if(!this.end){
// Call Instakiller hit method
Instakiller.prototype.hit.call(this, entity);
}
};
// Moving to the right method
LavaWall.prototype.moveToTheRight = function(){
// Go slow
if(Game.frameNumber < 80)
this.xMovement += 1;
// Accelerate!
else if(Game.frameNumber < 100)
this.xMovement += 2;
else if(Game.frameNumber < 102)
this.xMovement += 3;
else if(Game.frameNumber < 104)
this.xMovement += 4;
else if(Game.frameNumber < 106)
this.xMovement += 5;
else if(Game.frameNumber < 108)
this.xMovement += 6;
else if(Game.frameNumber < 110)
this.xMovement += 7;
else if(Game.frameNumber < 112)
this.xMovement += 8;
else if(Game.frameNumber < 114)
this.xMovement += 9;
else if(Game.frameNumber < 116)
this.xMovement += 10;
else if(Game.frameNumber < 118)
this.xMovement += 11;
// Go fast
else if(Game.frameNumber < 190)
this.xMovement += 12;
// Decelerate
else if(Game.frameNumber < 186)
this.xMovement += 11;
else if(Game.frameNumber < 188)
this.xMovement += 10;
else if(Game.frameNumber < 190)
this.xMovement += 9;
else if(Game.frameNumber < 192)
this.xMovement += 8;
else if(Game.frameNumber < 194)
this.xMovement += 7;
else if(Game.frameNumber < 196)
this.xMovement += 6;
else if(Game.frameNumber < 198)
this.xMovement += 5;
else if(Game.frameNumber < 200)
this.xMovement += 4;
// Go slow
else if(Game.frameNumber < 350)
this.xMovement += 4;
// Accelerate!
else if(Game.frameNumber < 380)
this.xMovement += 5;
else if(Game.frameNumber < 385)
this.xMovement += 6;
else if(Game.frameNumber < 390)
this.xMovement += 7;
else if(Game.frameNumber < 395)
this.xMovement += 8;
else if(Game.frameNumber < 400)
this.xMovement += 9;
else if(Game.frameNumber < 405)
this.xMovement += 10;
else if(Game.frameNumber < 410)
this.xMovement += 11;
else if(Game.frameNumber < 415)
this.xMovement += 12;
else if(Game.frameNumber < 420)
this.xMovement += 13;
else if(Game.frameNumber < 425)
this.xMovement += 14;
else if(Game.frameNumber < 430)
this.xMovement += 15;
else if(Game.frameNumber < 435)
this.xMovement += 16;
else if(Game.frameNumber < 440)
this.xMovement += 17;
else if(Game.frameNumber < 445)
this.xMovement += 18;
else if(Game.frameNumber < 450)
this.xMovement += 19;
else if(Game.frameNumber < 455)
this.xMovement += 20;
else if(Game.frameNumber < 460)
this.xMovement += 21;
else if(Game.frameNumber < 465)
this.xMovement += 22;
else if(Game.frameNumber < 470)
this.xMovement += 23;
else if(Game.frameNumber < 475)
this.xMovement += 24;
else{
this.end = true;
Game.easyPartText.show();
}
};