1 |
if ((instance_exists(obj_berdlyb_enemy) && global.mercymod[obj_berdlyb_enemy.myself] > 50) || (instance_exists(obj_berdlyb_enemy) && global.monsterhp[obj_berdlyb_enemy.myself] < (global.monstermaxhp[obj_berdlyb_enemy.myself] * 0.5))) |
2 |
{ |
3 |
if (smokestart == 0) |
4 |
{ |
5 |
smokestart = 1 |
6 |
snd_play(snd_bomb) |
7 |
for (var _i = 0; _i < 8; _i++) |
8 |
{ |
9 |
smoke = instance_create((x + 90), y, obj_berdly_smoke) |
10 |
smoke.direction = 45 * _i |
11 |
smoke.depth = depth - 1 |
12 |
} |
13 |
var _explosion = instance_create((x + 90), y, obj_animation) |
14 |
_explosion.depth = depth - 1 |
15 |
_explosion.sprite_index = spr_coaster_explosion |
16 |
} |
17 |
smoketimer++ |
18 |
if (smoketimer > 15) |
19 |
{ |
20 |
smoketimer = 0 |
21 |
smoke = instance_create((x + 90), y, obj_berdly_smoke) |
22 |
smoke.depth = depth + 1 |
23 |
} |
24 |
} |
25 |
if (init == 0) |
26 |
{ |
27 |
if (mode == 0) |
28 |
{ |
29 |
movethreshold = 60 |
30 |
moveframes = 6 |
31 |
} |
32 |
if (mode == 1) |
33 |
{ |
34 |
movethreshold = 36 |
35 |
moveframes = 12 |
36 |
} |
37 |
if (mode >= 2) |
38 |
{ |
39 |
queenmode = 1 |
40 |
sprite_index = spr_coaster_queen |
41 |
} |
42 |
if (mode == 2) |
43 |
{ |
44 |
movetype = 1 |
45 |
moveframes = 24 |
46 |
} |
47 |
if (mode == 3) |
48 |
{ |
49 |
movethreshold = 40 |
50 |
moveframes = 16 |
51 |
} |
52 |
if (mode == 4) |
53 |
{ |
54 |
movethreshold = 40 |
55 |
moveframes = 16 |
56 |
} |
57 |
if (mode == 5) |
58 |
{ |
59 |
movetype = 1 |
60 |
moveframes = 8 |
61 |
} |
62 |
if (mode == 6) |
63 |
{ |
64 |
movetype = 1 |
65 |
moveframes = 4 |
66 |
} |
67 |
init = 1 |
68 |
} |
69 |
if (obj_berdlyb_enemy.premonition > 0 && o_coaster_controller.actcon == 1) |
70 |
{ |
71 |
premonition = 1 |
72 |
drawpremonition = 1 |
73 |
} |
74 |
else |
75 |
drawpremonition = 0 |
76 |
if (y > 178) |
77 |
depth = 78 |
78 |
if (y > 230) |
79 |
depth = 73 |
80 |
siner += 0.4 |
81 |
if (xshake != 0) |
82 |
{ |
83 |
shaketimer++ |
84 |
if (shaketimer >= 2) |
85 |
{ |
86 |
shaketimer = 0 |
87 |
xshake *= -0.8 |
88 |
if (abs(xshake) <= 1) |
89 |
xshake = 0 |
90 |
} |
91 |
} |
92 |
if (endscene == 1 && instance_exists(obj_ch2_scene11a)) |
93 |
{ |
94 |
var xx = obj_ch2_scene11a.coaster_berdly.x + 22 + obj_ch2_scene11a.coaster_berdly.sinerx + obj_ch2_scene11a.coaster_berdly.coaster_offset_x |
95 |
var yy = obj_ch2_scene11a.coaster_berdly.y + 47 + obj_ch2_scene11a.coaster_berdly.sinery + obj_ch2_scene11a.coaster_berdly.coaster_offset_y |
96 |
if (endscenetimer < 10) |
97 |
endscenetimer++ |
98 |
x = lerp(x, xx, (endscenetimer / 10)) |
99 |
y = lerp(y, yy, (endscenetimer / 10)) |
100 |
} |
101 |
if (damagecon == 0) |
102 |
{ |
103 |
siner += 0.4 |
104 |
if (endscene == 0) |
105 |
x = xstart + (sin(siner / 6)) * 3 |
106 |
damagetimer = 0 |
107 |
} |
108 |
if (damagecon == 1) |
109 |
{ |
110 |
damagetimer += 1 |
111 |
image_index = 1 |
112 |
if (kiss == 1) |
113 |
image_index = 2 |
114 |
x = xstart + 60 - damagetimer * 5 |
115 |
if (damagetimer >= 10) |
116 |
{ |
117 |
xshake = 0 |
118 |
yshake = 0 |
119 |
x = xstart |
120 |
damagetimer = 0 |
121 |
damagecon = 0 |
122 |
image_index = 0 |
123 |
if (sprite_index == spr_berdlyb_shocked_battle) |
124 |
sprite_index = spr_berdlyb_idle |
125 |
} |
126 |
} |
127 |
if (o_coaster_controller.actcon == 1 && movecon == -1) |
128 |
movecon = 0 |
129 |
if (o_coaster_controller.actcon == 0) |
130 |
{ |
131 |
movecon = -1 |
132 |
movetimer = 59 |
133 |
if (y < ystart) |
134 |
y += ((ystart - y) / moveframes) |
135 |
if (y > ystart) |
136 |
y += ((ystart - y) / moveframes) |
137 |
} |
138 |
if (movecon == 0) |
139 |
{ |
140 |
movebuffer = 0 |
141 |
movetimer += 1 |
142 |
if (movetype == 1) |
143 |
y = yspot[1] + (sin(movetimer / moveframes)) * (yspot[2] - yspot[0]) / 2 |
144 |
if (movetimer >= movethreshold && movetype == 0) |
145 |
{ |
146 |
oldidealy = idealy |
147 |
if (obj_berdlyb_enemy.ralseigo == 1) |
148 |
{ |
149 |
forceypos = 2 |
150 |
obj_berdlyb_enemy.ralseigo = 0 |
151 |
with (o_coaster_hero) |
152 |
{ |
153 |
if (HeroID == 2) |
154 |
bump = 1 |
155 |
} |
156 |
} |
157 |
else if (obj_berdlyb_enemy.susiego == 1) |
158 |
{ |
159 |
forceypos = 1 |
160 |
obj_berdlyb_enemy.susiego = 0 |
161 |
with (o_coaster_hero) |
162 |
{ |
163 |
if (HeroID == 1) |
164 |
bump = 1 |
165 |
} |
166 |
} |
167 |
else if (obj_berdlyb_enemy.krisgo == 1) |
168 |
{ |
169 |
forceypos = 0 |
170 |
obj_berdlyb_enemy.krisgo = 0 |
171 |
with (o_coaster_hero) |
172 |
{ |
173 |
if (HeroID == 0) |
174 |
bump = 1 |
175 |
} |
176 |
} |
177 |
if (forceypos == 0) |
178 |
idealy = yspot[0] |
179 |
if (forceypos == 1) |
180 |
idealy = yspot[1] |
181 |
if (forceypos == 2) |
182 |
idealy = yspot[2] |
183 |
if (forceypos == -1) |
184 |
idealy = yspot[nexty[ycount]] |
185 |
yspeed = (idealy - y) / moveframes |
186 |
movecon = 1 |
187 |
movetimer = 0 |
188 |
ycount++ |
189 |
if (ycount >= 6) |
190 |
{ |
191 |
for (i = 0; i < 6; i++) |
192 |
{ |
193 |
nexty[i] = nexty[(i + 6)] |
194 |
nexty[(i + 6)] = -1 |
195 |
} |
196 |
ycount = 0 |
197 |
pick = floor(random(6) + 6) |
198 |
for (i = 0; i < 2; i++) |
199 |
{ |
200 |
while (nexty[pick] != -1) |
201 |
pick = floor(random(6) + 6) |
202 |
nexty[pick] = i |
203 |
} |
204 |
for (j = 6; j < 12; j++) |
205 |
{ |
206 |
if (nexty[j] == -1) |
207 |
nexty[j] = choose(0, 1, 2) |
208 |
} |
209 |
} |
210 |
} |
211 |
} |
212 |
if (movecon == 1) |
213 |
{ |
214 |
y += yspeed |
215 |
movetimer += 1 |
216 |
if (movetimer >= moveframes) |
217 |
{ |
218 |
if (movebuffer == 0) |
219 |
{ |
220 |
movetimer = 0 |
221 |
y = idealy |
222 |
} |
223 |
movecon = 0 |
224 |
} |
225 |
} |
226 |
if (mode == 1) |
227 |
{ |
228 |
modetimer++ |
229 |
if (modetimer >= 60) |
230 |
{ |
231 |
modetimer = -60 |
232 |
jama = instance_create((o_coaster_berdly.x - 40 - 20 * queenmode), yspot[choose(0, 1, 2)], o_coaster_jama) |
233 |
} |
234 |
} |
235 |
if (mode == 3) |
236 |
{ |
237 |
modetimer++ |
238 |
if (modetimer >= 60) |
239 |
{ |
240 |
modetimer = -60 |
241 |
instance_create((view_xview[0] + 330), yspot[choose(0, 1, 2)], o_coaster_lightning) |
242 |
} |
243 |
} |
244 |
if (mode == 4) |
245 |
{ |
246 |
modetimer++ |
247 |
if (modetimer >= 60) |
248 |
{ |
249 |
modetimer = -30 |
250 |
jama = instance_create((o_coaster_berdly.x - 60), yspot[choose(0, 1, 2)], o_coaster_jama) |
251 |
jama.bigcar = 1 |
252 |
jama.sprite_index = spr_coaster_car |
253 |
} |
254 |
} |
255 |
if (mode == 5) |
256 |
{ |
257 |
modetimer++ |
258 |
if (modetimer == 40) |
259 |
{ |
260 |
nozoki = choose(0, 1, 2) |
261 |
lit = instance_create((view_xview[0] + 330), yspot[choose(0, 1, 2)], o_coaster_lightning) |
262 |
lit.waittime = 20 |
263 |
lit.litwaittime = 20 |
264 |
} |
265 |
if (modetimer == 80) |
266 |
{ |
267 |
jama = instance_create((o_coaster_berdly.x - 60), yspot[choose(0, 1, 2)], o_coaster_jama) |
268 |
modetimer = 0 |
269 |
} |
270 |
} |
271 |
with (obj_berdlyb_enemy) |
272 |
{ |
273 |
if (global.monstermaxhp[myself] != global.monsterhp[myself]) |
274 |
o_coaster_berdly.kiss = 0 |
275 |
} |