1 |
if (!instance_exists(obj_heart_battle_fighting_parent)) |
2 |
{ |
3 |
instance_destroy(); |
4 |
exit; |
5 |
} |
6 |
if (state < 3) |
7 |
{ |
8 |
attack_target_x = obj_heart_battle_fighting_parent.x; |
9 |
attack_target_y = obj_heart_battle_fighting_parent.y; |
10 |
} |
11 |
x = attack_target_x + lengthdir_x(attack_distance, attack_dir); |
12 |
y = attack_target_y + lengthdir_y(attack_distance, attack_dir); |
13 |
if (state == 0) |
14 |
{ |
15 |
if (image_alpha < 1 && can_move == false) |
16 |
{ |
17 |
image_alpha += 0.2; |
18 |
if (image_alpha > 1) |
19 |
image_alpha = 1; |
20 |
} |
21 |
if (attack_dir < 360) |
22 |
attack_dir += bullet_speed; |
23 |
else |
24 |
attack_dir = bullet_speed; |
25 |
} |
26 |
if (state == 1) |
27 |
{ |
28 |
if (attack_dir < 360) |
29 |
attack_dir += bullet_speed; |
30 |
else |
31 |
attack_dir = bullet_speed; |
32 |
bullet_speed = lerp(bullet_speed, 0, 0.75); |
33 |
if (round(bullet_speed) == 0) |
34 |
state = 2; |
35 |
} |
36 |
if (state == 2) |
37 |
{ |
38 |
attack_distance = lerp(attack_distance, attack_distance_max, 0.5); |
39 |
if (round(attack_distance) == attack_distance_max) |
40 |
{ |
41 |
state = 3; |
42 |
audio_play_sound(snd_ceroba_swoosh, 1, 0); |
43 |
} |
44 |
} |
45 |
if (state == 3) |
46 |
{ |
47 |
if (attack_distance > 0) |
48 |
{ |
49 |
attack_distance -= homing_speed; |
50 |
} |
51 |
else |
52 |
{ |
53 |
var count = 0; |
54 |
with (object_index) |
55 |
{ |
56 |
if (bullet_spawner == other.bullet_spawner) |
57 |
count += 1; |
58 |
} |
59 |
if (count == 1) |
60 |
instance_create(attack_target_x, attack_target_y, obj_battle_enemy_attack_ceroba_fire_circle_explosion); |
61 |
instance_destroy(); |
62 |
instance_destroy(bullet_spawner); |
63 |
} |
64 |
homing_speed += 1; |
65 |
} |