1 |
if (init == 0) |
2 |
{ |
3 |
if (crushedObj > 0) |
4 |
maxspeed = (crushedObj == 2) ? 2 : 3; |
5 |
init = 1; |
6 |
if (new_movement == 0) |
7 |
{ |
8 |
if (difficulty != 2) |
9 |
friction = (crushedObj == 2) ? -2.5 : -0.35; |
10 |
if (difficulty == 2) |
11 |
friction = (crushedObj == 2) ? -2.5 : -0.1; |
12 |
if (difficulty == 5) |
13 |
friction = (crushedObj == 2) ? -2.5 : -0.1; |
14 |
} |
15 |
if (crushedObj != 1) |
16 |
offsetCap = (crushedObj == 2) ? 15 : 0; |
17 |
if (crushedObj == 2) |
18 |
hp = 1; |
19 |
if (difficulty == 4) |
20 |
{ |
21 |
gun1 = instance_create(x - 15, y - obj_spamton_neo_enemy.crusher_turret_distance, obj_crusher_gun); |
22 |
gun1.depth = depth - 1; |
23 |
gun2 = instance_create(x - 15, y + obj_spamton_neo_enemy.crusher_turret_distance, obj_crusher_gun); |
24 |
gun2.depth = depth - 1; |
25 |
createdguns = 1; |
26 |
} |
27 |
} |
28 |
if (crushedObj == 1) |
29 |
offsetCap = max(0, (hp - 1) * 15); |
30 |
if (new_movement == 1) |
31 |
{ |
32 |
hspeed -= haccel; |
33 |
if (vbounce == 1) |
34 |
{ |
35 |
if (y > bottomy) |
36 |
{ |
37 |
y = bottomy - 1; |
38 |
vspeed = -abs(vspeed); |
39 |
} |
40 |
if (y < topy) |
41 |
{ |
42 |
y = topy + 1; |
43 |
vspeed = abs(vspeed); |
44 |
} |
45 |
} |
46 |
} |
47 |
if (x >= (room_width + 100) || x <= -100 || y >= (room_height + 100) || y <= -100) |
48 |
{ |
49 |
instance_destroy(); |
50 |
if (creatednewalls == 1) |
51 |
creatednewalls = 0; |
52 |
} |
53 |
if (new_movement == 0) |
54 |
{ |
55 |
x += pushback; |
56 |
if (pushback > 0) |
57 |
pushback--; |
58 |
if (pushback == 8) |
59 |
{ |
60 |
depth = startdepth; |
61 |
image_blend = c_white; |
62 |
} |
63 |
if (speed > maxspeed) |
64 |
{ |
65 |
speed = maxspeed; |
66 |
friction = 0; |
67 |
} |
68 |
} |
69 |
if (destroying) |
70 |
{ |
71 |
if (difficulty != 3 && difficulty != 5) |
72 |
{ |
73 |
destroying += 15; |
74 |
speed = 0; |
75 |
} |
76 |
if (difficulty == 3 && destroying < 45) |
77 |
destroying += 15; |
78 |
if (difficulty == 5 && destroying < 45) |
79 |
destroying += 15; |
80 |
if (destroying >= 200) |
81 |
{ |
82 |
if (creatednewalls == 1) |
83 |
creatednewalls = 0; |
84 |
instance_destroy(); |
85 |
} |
86 |
exit; |
87 |
} |
88 |
if (crushedObj == 2 && offset <= offsetCap) |
89 |
{ |
90 |
crushtimer++; |
91 |
if (crushtimer == 20) |
92 |
offsetCap -= 7; |
93 |
if (crushtimer > 20) |
94 |
{ |
95 |
active = 0; |
96 |
destroying = 15; |
97 |
event_user(1); |
98 |
} |
99 |
} |
100 |
if (offset <= offsetCap && new_movement == 0) |
101 |
{ |
102 |
if (speed == 0) |
103 |
speed = 0.1; |
104 |
if (difficulty != 2 && difficulty != 5 && difficulty != 6) |
105 |
{ |
106 |
if (updown) |
107 |
{ |
108 |
var ynext = y + slidedir; |
109 |
if (ynext > (obj_growtangle.y + 60) || ynext < (obj_growtangle.y - 60)) |
110 |
slidedir *= -1; |
111 |
y += slidedir; |
112 |
} |
113 |
} |
114 |
if (difficulty == 2 || difficulty == 5) |
115 |
{ |
116 |
siner += 0.5; |
117 |
y = obj_growtangle.y + (sin(siner / 6) * 50); |
118 |
} |
119 |
} |
120 |
if (instance_exists(obj_heart) && (x - 30) < obj_heart.x) |
121 |
exit; |
122 |
if (destroying < 1) |
123 |
{ |
124 |
for (var i = 0; i < instance_number(obj_yheart_shot); i += 1) |
125 |
{ |
126 |
enemy[i] = instance_find(obj_yheart_shot, i); |
127 |
if (enemy[i].x > (x - 22)) |
128 |
{ |
129 |
with (enemy[i]) |
130 |
event_user(0); |
131 |
} |
132 |
} |
133 |
} |