1 |
var battle_box = 3154; |
2 |
var soul = 2979; |
3 |
switch (attack_state) |
4 |
{ |
5 |
case 1: |
6 |
var x_target = battle_box.bbox_right + 30; |
7 |
x = lerp(x, x_target, 0.3); |
8 |
if (abs(x - x_target) <= 1) |
9 |
{ |
10 |
x = x_target; |
11 |
attack_state += 1; |
12 |
_y_sin_current = 0; |
13 |
_attack_timer = room_speed * 1; |
14 |
} |
15 |
break; |
16 |
case 2: |
17 |
soul = 2979; |
18 |
_y_sin_current += 0.1; |
19 |
if (_y_sin_current > (2 * pi)) |
20 |
_y_sin_current -= (2 * pi); |
21 |
y = ystart + (sin(_y_sin_current) * 90); |
22 |
_attack_timer -= 1; |
23 |
if (_attack_timer <= 0 && abs(y - soul.y) < 10) |
24 |
{ |
25 |
attack_state += 1; |
26 |
instance_create(soul.x, soul.y, obj_attack_ed_grab_warning); |
27 |
} |
28 |
break; |
29 |
case 3: |
30 |
soul = 2979; |
31 |
y = lerp(y, soul.y, 0.25); |
32 |
if (sprite_index != spr_attack_ed_hand_grab) |
33 |
{ |
34 |
sprite_index = spr_attack_ed_hand_grab; |
35 |
image_index = 1; |
36 |
image_speed = 0.5; |
37 |
} |
38 |
if (image_index >= (image_number - 1)) |
39 |
{ |
40 |
attack_state += 1; |
41 |
_attack_caught_player = false; |
42 |
sprite_index = spr_attack_ed_hand_grab_2; |
43 |
image_index = 0; |
44 |
image_speed = 0; |
45 |
} |
46 |
break; |
47 |
case 4: |
48 |
if (hspeed > -15) |
49 |
hspeed -= 3; |
50 |
soul = 2979; |
51 |
if (place_meeting(x, y, soul) && soul.moveable == true) |
52 |
{ |
53 |
soul.image_alpha = 0; |
54 |
soul.moveable = false; |
55 |
soul.vulnerable = false; |
56 |
_attack_caught_player = true; |
57 |
if (sprite_index != spr_attack_ed_hand_grab_3) |
58 |
{ |
59 |
sprite_index = spr_attack_ed_hand_grab_3; |
60 |
image_speed = 1/3; |
61 |
image_index = 0; |
62 |
} |
63 |
} |
64 |
var _anim_ready = false; |
65 |
if (sprite_index == spr_attack_ed_hand_grab_3 && image_index >= 6) |
66 |
{ |
67 |
_anim_ready = true; |
68 |
image_speed = 0; |
69 |
image_index = 6; |
70 |
} |
71 |
if (x <= (battle_box.bbox_left - 30)) |
72 |
{ |
73 |
hspeed = 0; |
74 |
if (_attack_caught_player == true) |
75 |
{ |
76 |
if (_anim_ready == true) |
77 |
attack_state += 2; |
78 |
} |
79 |
else |
80 |
{ |
81 |
attack_state += 1; |
82 |
} |
83 |
} |
84 |
break; |
85 |
case 5: |
86 |
if (!instance_exists(obj_attack_ed_grab_hand_hurtbox_return) || obj_attack_ed_grab_hand_hurtbox_return.spawner != id) |
87 |
{ |
88 |
var new_hitbox = instance_create(x, y, obj_attack_ed_grab_hand_hurtbox_return); |
89 |
new_hitbox.spawner = id; |
90 |
} |
91 |
if (image_speed == 0) |
92 |
image_speed = 0.5; |
93 |
if (image_index >= (image_number - 1) && sprite_index != spr_attack_ed_hand) |
94 |
{ |
95 |
sprite_index = spr_attack_ed_hand; |
96 |
image_speed = 1/3; |
97 |
} |
98 |
if (hspeed < 8) |
99 |
hspeed += 2; |
100 |
if (x >= (battle_box.bbox_right + 60)) |
101 |
{ |
102 |
_attack_timer = room_speed * 2; |
103 |
_y_sin_current = arcsin((y - ystart) / 90); |
104 |
attack_state = 2; |
105 |
attack_number += 1; |
106 |
hspeed = 0; |
107 |
} |
108 |
break; |
109 |
case 6: |
110 |
if (hspeed < 12) |
111 |
hspeed += 3; |
112 |
var _anim_ready = false; |
113 |
if (x >= (battle_box.x + 30)) |
114 |
{ |
115 |
hspeed = 0; |
116 |
attack_state += 1; |
117 |
} |
118 |
break; |
119 |
case 7: |
120 |
if (vspeed > -8) |
121 |
vspeed -= 2; |
122 |
if (y <= (battle_box.y - 20)) |
123 |
attack_state += 1; |
124 |
break; |
125 |
case 8: |
126 |
if (vspeed < 24) |
127 |
vspeed += 6; |
128 |
if (y >= (battle_box.bbox_bottom - 20)) |
129 |
{ |
130 |
y = battle_box.bbox_bottom - 20; |
131 |
attack_state += 1; |
132 |
vspeed = 0; |
133 |
} |
134 |
break; |
135 |
case 9: |
136 |
if (image_speed == 0) |
137 |
{ |
138 |
audio_play_sound(snd_rock_break, 1, 0); |
139 |
scr_screenshake_battlescr_screenshake_battlefunction scr_screenshake_battle()
{
instance_destroy(obj_screenshake_battle);
var screenshake = instance_create(0, 0, obj_screenshake_battle);
battle_screenshake_duration = argument[0];
battle_screenshake_intensity = argument[1];
battle_screenshake_dec = battle_screenshake_intensity / battle_screenshake_duration;
} (15, 3); |
140 |
image_speed = 0.75; |
141 |
soul.vulnerable = true; |
142 |
instance_create(x, y, obj_attack_ed_grab_hand_hurtbox); |
143 |
} |
144 |
soul = 2979; |
145 |
with (soul) |
146 |
{ |
147 |
image_alpha = 1; |
148 |
x = other.x - 15; |
149 |
y = other.y + 5; |
150 |
if (moveable == false) |
151 |
{ |
152 |
moveable = true; |
153 |
vulnerable = true; |
154 |
} |
155 |
} |
156 |
if (image_index >= (image_number - 1)) |
157 |
{ |
158 |
sprite_index = spr_attack_ed_hand; |
159 |
image_speed = 1/3; |
160 |
attack_state += 1; |
161 |
} |
162 |
break; |
163 |
case 10: |
164 |
if (hspeed < 8) |
165 |
hspeed += 2; |
166 |
if (x >= (battle_box.bbox_right + 30)) |
167 |
{ |
168 |
_y_sin_current = arcsin((y - ystart) / 90); |
169 |
_attack_timer = room_speed * 2; |
170 |
attack_state = 2; |
171 |
hspeed = 0; |
172 |
attack_number += 1; |
173 |
} |
174 |
break; |
175 |
} |
176 |
if (attack_number >= attack_number_max) |
177 |
{ |
178 |
with (obj_attack_ed_grab_moray_sword_controller) |
179 |
instance_destroy(); |
180 |
} |