1 |
var battle_box = obj_dialogue_box_battle_transformation_any |
2 |
var soul = obj_heart_battle_fighting_parent |
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 = obj_heart_battle_fighting_parent |
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 = obj_heart_battle_fighting_parent |
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 = obj_heart_battle_fighting_parent |
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 |
attack_state += 1 |
81 |
} |
82 |
break |
83 |
case 5: |
84 |
if ((!instance_exists(obj_attack_ed_grab_hand_hurtbox_return)) || obj_attack_ed_grab_hand_hurtbox_return.spawner != id) |
85 |
{ |
86 |
var new_hitbox = instance_create(x, y, obj_attack_ed_grab_hand_hurtbox_return) |
87 |
new_hitbox.spawner = id |
88 |
} |
89 |
if (image_speed == 0) |
90 |
image_speed = 0.5 |
91 |
if (image_index >= (image_number - 1) && sprite_index != spr_attack_ed_hand) |
92 |
{ |
93 |
sprite_index = spr_attack_ed_hand |
94 |
image_speed = (1/3) |
95 |
} |
96 |
if (hspeed < 8) |
97 |
hspeed += 2 |
98 |
if (x >= (battle_box.bbox_right + 60)) |
99 |
{ |
100 |
_attack_timer = room_speed * 2 |
101 |
_y_sin_current = arcsin((y - ystart) / 90) |
102 |
attack_state = 2 |
103 |
attack_number += 1 |
104 |
hspeed = 0 |
105 |
} |
106 |
break |
107 |
case 6: |
108 |
if (hspeed < 12) |
109 |
hspeed += 3 |
110 |
_anim_ready = false |
111 |
if (x >= (battle_box.x + 30)) |
112 |
{ |
113 |
hspeed = 0 |
114 |
attack_state += 1 |
115 |
} |
116 |
break |
117 |
case 7: |
118 |
if (vspeed > -8) |
119 |
vspeed -= 2 |
120 |
if (y <= (battle_box.y - 20)) |
121 |
attack_state += 1 |
122 |
break |
123 |
case 8: |
124 |
if (vspeed < 24) |
125 |
vspeed += 6 |
126 |
if (y >= (battle_box.bbox_bottom - 20)) |
127 |
{ |
128 |
y = battle_box.bbox_bottom - 20 |
129 |
attack_state += 1 |
130 |
vspeed = 0 |
131 |
} |
132 |
break |
133 |
case 9: |
134 |
if (image_speed == 0) |
135 |
{ |
136 |
audio_play_sound(snd_rock_break, 1, 0) |
137 |
scr_screenshake_battlescr_screenshake_battlefunction scr_screenshake_battle() //gml_Script_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) |
138 |
image_speed = 0.75 |
139 |
soul.vulnerable = true |
140 |
instance_create(x, y, obj_attack_ed_grab_hand_hurtbox) |
141 |
} |
142 |
soul = obj_heart_battle_fighting_parent |
143 |
with (soul) |
144 |
{ |
145 |
image_alpha = 1 |
146 |
x = other.x - 15 |
147 |
y = other.y + 5 |
148 |
if (moveable == false) |
149 |
{ |
150 |
moveable = true |
151 |
vulnerable = true |
152 |
} |
153 |
} |
154 |
if (image_index >= (image_number - 1)) |
155 |
{ |
156 |
sprite_index = spr_attack_ed_hand |
157 |
image_speed = (1/3) |
158 |
attack_state += 1 |
159 |
} |
160 |
break |
161 |
case 10: |
162 |
if (hspeed < 8) |
163 |
hspeed += 2 |
164 |
if (x >= (battle_box.bbox_right + 30)) |
165 |
{ |
166 |
_y_sin_current = arcsin((y - ystart) / 90) |
167 |
_attack_timer = room_speed * 2 |
168 |
attack_state = 2 |
169 |
hspeed = 0 |
170 |
attack_number += 1 |
171 |
} |
172 |
break |
173 |
} |
174 |
|
175 |
if (attack_number >= attack_number_max) |
176 |
{ |
177 |
with (obj_attack_ed_grab_moray_sword_controller) |
178 |
instance_destroy() |
179 |
} |