1 |
if (state == 3) |
2 |
{ |
3 |
scr_enemyhurt_tired_after_damage(0); |
4 |
hurttimer -= 1; |
5 |
if (hurttimer < 0) |
6 |
{ |
7 |
state = 0; |
8 |
} |
9 |
else |
10 |
{ |
11 |
hurtshake += 1; |
12 |
if (hurtshake > 1) |
13 |
{ |
14 |
if (shakex > 0) |
15 |
shakex -= 1; |
16 |
if (shakex < 0) |
17 |
shakex += 1; |
18 |
shakex = -shakex; |
19 |
hurtshake = 0; |
20 |
} |
21 |
draw_sprite_ext(hurtsprite, 0, x + shakex + hurtspriteoffx, y + hurtspriteoffy, 2, 2, 0, image_blend, 1); |
22 |
} |
23 |
} |
24 |
fixy = 0; |
25 |
if (global.flag[221 thrash_machine_body] == 2) |
26 |
fixy = 10; |
27 |
if (global.flag[221 thrash_machine_body] == 3) |
28 |
fixy = 26; |
29 |
thrash.xx = x + 34; |
30 |
thrash.yy = y + 108; |
31 |
if (state == 0) |
32 |
{ |
33 |
fsiner += 1; |
34 |
if (saberanim) |
35 |
{ |
36 |
if (thissprite != sabersprite) |
37 |
{ |
38 |
siner = 0; |
39 |
thissprite = sabersprite; |
40 |
} |
41 |
else if (siner < 3) |
42 |
{ |
43 |
siner++; |
44 |
} |
45 |
} |
46 |
else |
47 |
{ |
48 |
siner += 0.16666666666666666; |
49 |
thissprite = idlesprite; |
50 |
if (global.mercymod[myself] >= global.mercymax[myself]) |
51 |
thissprite = sparedsprite; |
52 |
} |
53 |
var xpos = (thrashcon == 0) ? x : remx; |
54 |
if (thrashcon > 2 && thrashcon != 6) |
55 |
draw_monster_body_part(thissprite, siner, xpos, y + floatheight); |
56 |
else |
57 |
draw_monster_body_part(thissprite, siner, xpos, y + (thrash.s * thrash.walkc) + fixy); |
58 |
} |
59 |
if (becomeflash == 0) |
60 |
flash = 0; |
61 |
becomeflash = 0; |
62 |
if (scr_debug()) |
63 |
{ |
64 |
} |
65 |
var turretbody = thrash.part[0] == 2; |
66 |
thrash.s = 3; |
67 |
var puddx = remx + (turretbody ? 18 : 34); |
68 |
var puddy = remy + 173 + ((thrash.s * thrash.walkc) / 4); |
69 |
if (!depthChange && instance_exists(obj_growtangle)) |
70 |
{ |
71 |
depthChange = 1; |
72 |
puddle.depth = thrash.depth + 1; |
73 |
} |
74 |
else if (depthChange && !instance_exists(obj_growtangle)) |
75 |
{ |
76 |
depthChange = 0; |
77 |
puddle.depth = simcity.depth + 1; |
78 |
} |
79 |
puddle.x = puddx; |
80 |
puddle.y = remy + 173 + ((thrash.s * cos((thrash.wsiner + thrash.wsinerrate) / 3)) / 4); |
81 |
if (thrashcon < 2 || thrashcon > 5) |
82 |
draw_sprite_ext(spr_rouxls_puddle, turretbody ? 3 : 1, puddx, puddy, 2, 2, 0, c_white, 1); |
83 |
puddle.image_index = turretbody ? 2 : 0; |
84 |
var _wheels = obj_thrashmachine.part[2] == 1; |
85 |
if (thrashmode == 0) |
86 |
{ |
87 |
} |
88 |
if (thrashmode == 1) |
89 |
{ |
90 |
if (thrashcon == 0) |
91 |
{ |
92 |
thrashtimer = 0; |
93 |
thrashcon = 1; |
94 |
var xoff = 0; |
95 |
if (turretbody) |
96 |
{ |
97 |
xoff = 10; |
98 |
d = instance_create((puddle.x - 60) + xoff, puddle.y + 4, obj_rouxls_splasheffect); |
99 |
d.depth = depth - 1; |
100 |
} |
101 |
d = instance_create((puddle.x - 30) + xoff, puddle.y + 4, obj_rouxls_splasheffect); |
102 |
d.depth = depth - 1; |
103 |
d = instance_create(puddle.x + 30 + xoff, puddle.y + 4, obj_rouxls_splasheffect); |
104 |
d.depth = depth - 1; |
105 |
d = instance_create(puddle.x + xoff, puddle.y + 6, obj_rouxls_splasheffect); |
106 |
d.depth = depth - 2; |
107 |
} |
108 |
if (thrashcon == 1) |
109 |
{ |
110 |
thrash.wsinerrate = 0; |
111 |
if (y < (remy - 10)) |
112 |
thrash.drawfeet = 1; |
113 |
if (y >= (cameray() + (!headattack ? 45 : 10))) |
114 |
{ |
115 |
thrash.wsiner += 1.6; |
116 |
y -= 4; |
117 |
} |
118 |
else |
119 |
{ |
120 |
if (headattack) |
121 |
thrashtimer = arcsin(0.75) * 10; |
122 |
aimtime = irandom(15) + 15; |
123 |
if (!headattack) |
124 |
{ |
125 |
aimtime = 10; |
126 |
switch (obj_thrashmachine.part[2]) |
127 |
{ |
128 |
case 0: |
129 |
height_multiplier = aimtime / 4.71238898038469; |
130 |
break; |
131 |
case 1: |
132 |
height_multiplier = aimtime / 4.71238898038469; |
133 |
thrashtimer = aimtime - 10; |
134 |
break; |
135 |
case 2: |
136 |
height_multiplier = aimtime / 4.71238898038469; |
137 |
break; |
138 |
case 3: |
139 |
height_multiplier = 5; |
140 |
break; |
141 |
height_multiplier = -sin(thrashtimer); |
142 |
} |
143 |
} |
144 |
else |
145 |
{ |
146 |
height_multiplier = 5; |
147 |
} |
148 |
thrashcon = 2; |
149 |
thrash.wsinerrate = 0; |
150 |
} |
151 |
} |
152 |
if (thrashcon == 2) |
153 |
{ |
154 |
thrashtimer++; |
155 |
if ((thrashtimer % 8) == 0) |
156 |
{ |
157 |
var ripple = instance_create(puddle.x, puddle.y, obj_rouxls_ripple); |
158 |
ripple.maxsize = clamp(1 - ((y - 90) / 45), 0.1, 2); |
159 |
ripple.image_speed = 0; |
160 |
ripple.image_index = turretbody ? 1 : 0; |
161 |
ripple.depth = puddle.depth - 1; |
162 |
submerged = 0; |
163 |
} |
164 |
if (headattack) |
165 |
y = (cameray() + (headattack ? 40 : 10)) - (sin(thrashtimer / (headattack ? 10 : height_multiplier)) * 40); |
166 |
else if (thrashtimer <= aimtime) |
167 |
y = (cameray() + 45) - (sin((thrashtimer / aimtime) * pi) * 10); |
168 |
if (headattack && y <= (cameray() + 10) && global.turntimer <= 40) |
169 |
{ |
170 |
headattack = 0; |
171 |
thrashtimer = 0; |
172 |
thrashcon = 5; |
173 |
} |
174 |
else if (!headattack && thrashtimer >= (aimtime + 10)) |
175 |
{ |
176 |
thrashtimer = 0; |
177 |
thrashcon = 3; |
178 |
thrash.moving = 1; |
179 |
floatheight = (thrash.s * thrash.walkc) + fixy; |
180 |
d = instance_create(puddle.x, puddle.y + 10, obj_rouxls_splasheffect); |
181 |
d.depth = depth - 1; |
182 |
d.speed = advancespeed; |
183 |
d.yscale = 4; |
184 |
d.xscale = 3; |
185 |
} |
186 |
else if (!headattack) |
187 |
{ |
188 |
thrash.wsiner += 1.6 * (advancespeed / 4); |
189 |
if (!headattack && ((thrashtimer - aimtime) % 3) == 0) |
190 |
{ |
191 |
d = instance_create(puddle.x, puddle.y + 10, obj_rouxls_splasheffect); |
192 |
d.depth = depth - 1; |
193 |
d.speed = advancespeed; |
194 |
d.yscale = 3; |
195 |
d.xscale = 2; |
196 |
} |
197 |
} |
198 |
} |
199 |
if (thrashcon == 3) |
200 |
{ |
201 |
if (x >= (camerax() + 200)) |
202 |
{ |
203 |
thrash.wsiner += 1.6 * (advancespeed / 8); |
204 |
x -= advancespeed; |
205 |
} |
206 |
else |
207 |
{ |
208 |
thrashcon = 4; |
209 |
} |
210 |
} |
211 |
if (thrashcon == 4) |
212 |
{ |
213 |
thrashtimer++; |
214 |
if (_wheels) |
215 |
{ |
216 |
if (thrashtimer <= 90) |
217 |
thrash.wsiner += 1.6 * (advancespeed / 8); |
218 |
else |
219 |
thrash.wsiner -= 0.5; |
220 |
} |
221 |
if (thrashtimer >= (_wheels ? 105 : 15)) |
222 |
{ |
223 |
thrashcon = 5; |
224 |
thrashtimer = 0; |
225 |
} |
226 |
} |
227 |
if (thrashcon == 5) |
228 |
{ |
229 |
if (x < (remx - 6)) |
230 |
{ |
231 |
x += returnspeed; |
232 |
thrash.wsiner -= 1.6 * (returnspeed / 6); |
233 |
} |
234 |
else |
235 |
{ |
236 |
x = remx; |
237 |
thrashcon = 6; |
238 |
thrash.moving = 0; |
239 |
} |
240 |
} |
241 |
if (thrashcon == 6) |
242 |
{ |
243 |
if (!submerged && y > (remy - 18)) |
244 |
{ |
245 |
var xoff = 0; |
246 |
if (turretbody) |
247 |
{ |
248 |
xoff = 10; |
249 |
d = instance_create((puddle.x - 60) + xoff, puddle.y + 4, obj_rouxls_splasheffect); |
250 |
d.depth = depth - 1; |
251 |
d.speed = -2; |
252 |
} |
253 |
d = instance_create((puddle.x - 30) + xoff, puddle.y + 4, obj_rouxls_splasheffect); |
254 |
d.depth = depth - 1; |
255 |
d.speed = turretbody ? -1.33 : -1; |
256 |
d = instance_create(puddle.x + xoff, puddle.y + 6, obj_rouxls_splasheffect); |
257 |
d.depth = depth - 2; |
258 |
d.speed = turretbody ? 1.33 : 0; |
259 |
d = instance_create(puddle.x + 30 + xoff, puddle.y + 4, obj_rouxls_splasheffect); |
260 |
d.depth = depth - 1; |
261 |
d.speed = 2; |
262 |
submerged = 1; |
263 |
} |
264 |
if (y > (remy - 10)) |
265 |
thrash.drawfeet = 0; |
266 |
if (y <= (remy - 4)) |
267 |
{ |
268 |
y += 4; |
269 |
thrash.wsiner -= 0.8; |
270 |
} |
271 |
else |
272 |
{ |
273 |
y = remy; |
274 |
x = remx; |
275 |
thrashcon = 0; |
276 |
thrashmode = 0; |
277 |
thrash.wsinerrate = 0.8; |
278 |
advancespeed = 8; |
279 |
returnspeed = 6; |
280 |
} |
281 |
} |
282 |
if (thrashcon == 7) |
283 |
{ |
284 |
if (thrashtimer == 50) |
285 |
{ |
286 |
snd_play(snd_pombark); |
287 |
thrash.a = 1; |
288 |
} |
289 |
if (thrashtimer < 75) |
290 |
{ |
291 |
thrashtimer++; |
292 |
thrash.wsiner -= 0.8; |
293 |
} |
294 |
else |
295 |
{ |
296 |
x = remx; |
297 |
thrashcon = 6; |
298 |
thrash.moving = 0; |
299 |
returnease = 0; |
300 |
thrashtimer = 0; |
301 |
} |
302 |
} |
303 |
} |
304 |
if (scr_debug()) |
305 |
{ |
306 |
draw_set_color(c_white); |
307 |
if (instance_exists(obj_battletester)) |
308 |
{ |
309 |
var debugstring = "[B] turn thrash debug on/off"; |
310 |
if (thrash.dbselect == 1) |
311 |
debugstring += "#up/down/shift: change thrash parts#1-3/Numpad7-9 for specific attacks#4/Numpad 5 for random attack#0/Numpad 0 for random machine"; |
312 |
scr_debug_print_persistentscr_debug_print_persistentfunction scr_debug_print_persistent(arg0)
{
draw_set_halign(fa_right);
var dcolor = draw_get_color();
draw_set_color(c_black);
draw_text_transformed(621, 11, string_hash_to_newline(arg0), 0.5, 0.5, 0);
draw_set_color(dcolor);
draw_text_transformed(620, 10, string_hash_to_newline(arg0), 0.5, 0.5, 0);
draw_set_halign(fa_left);
} (debugstring); |
313 |
} |
314 |
if (keyboard_check_pressed(ord("N"))) |
315 |
thrashmode++; |
316 |
if (thrashmode >= 2) |
317 |
thrashmode = 0; |
318 |
if (thrashmode == 0) |
319 |
thrash.drawfeet = thrash.dbselect; |
320 |
} |