1 |
var enemy_dead = global.enemy_dead; |
2 |
var enemy_spared = global.enemy_spared; |
3 |
var enemy_sparing = global.enemy_sparing; |
4 |
if (enemy_dead == false && enemy_spared == false) |
5 |
image_alpha = global.image_alpha_enemy_attacking; |
6 |
if (enemy_dead == true) |
7 |
{ |
8 |
x = starting_point_x; |
9 |
y = starting_point_y; |
10 |
instance_create(starting_point_x, starting_point_y, obj_bowll_dead); |
11 |
instance_destroy(); |
12 |
exit; |
13 |
image_alpha = 0.5; |
14 |
} |
15 |
else if (enemy_spared == true) |
16 |
{ |
17 |
sprite_index = spr_bowll_spared; |
18 |
x = starting_point_x; |
19 |
y = starting_point_y; |
20 |
image_alpha = 0.5; |
21 |
if (no_loop_create_clouds == false) |
22 |
{ |
23 |
for (i = 0; i <= 11; i += 1) |
24 |
instance_create(x, y - 22, obj_spare_cloud); |
25 |
} |
26 |
no_loop_create_clouds = true; |
27 |
} |
28 |
if (damage_disjoint_count > 0) |
29 |
{ |
30 |
damage_disjoint_count -= 1; |
31 |
} |
32 |
else if (enemy_dead == false && enemy_spared == false && damage_disjoint_count <= 0) |
33 |
{ |
34 |
if (global.enemy_low_hp == true && global.current_hp_enemy < global.max_hp_enemy) |
35 |
{ |
36 |
sprite_index = spr_bowll_body_critical; |
37 |
image_speed = 0; |
38 |
image_index = 0; |
39 |
} |
40 |
else |
41 |
{ |
42 |
sprite_index = spr_bowll_body_normal; |
43 |
image_speed = 0; |
44 |
image_index = 0; |
45 |
} |
46 |
} |
47 |
if (instance_exists(obj_text_damage_count) && global.fight_number == 1 && no_loop_damage_disjoint_count == false) |
48 |
{ |
49 |
time_elapsed_sparkles = 0; |
50 |
damage_disjoint_count = 12; |
51 |
no_loop_damage_disjoint_count = true; |
52 |
audio_play_sound(enemy_hurt_noise, 1, 0, 1, 0, enemy_hurt_pitch); |
53 |
} |
54 |
else if (!instance_exists(obj_text_damage_count)) |
55 |
{ |
56 |
no_loop_damage_disjoint_count = false; |
57 |
} |
58 |
if (damage_disjoint_count == 12) |
59 |
damage_disjoint_x = -50; |
60 |
else if (damage_disjoint_count == 10) |
61 |
damage_disjoint_x = 50; |
62 |
else if (damage_disjoint_count == 8) |
63 |
damage_disjoint_x = -20; |
64 |
else if (damage_disjoint_count == 6) |
65 |
damage_disjoint_x = 20; |
66 |
else if (damage_disjoint_count == 4) |
67 |
damage_disjoint_x = -10; |
68 |
else if (damage_disjoint_count == 2) |
69 |
damage_disjoint_x = 10; |
70 |
else if (damage_disjoint_count == 0) |
71 |
damage_disjoint_x = 0; |
72 |
if (damage_disjoint_count > 0 || global.current_hp_enemy <= 0) |
73 |
{ |
74 |
sprite_index = spr_bowll_dead; |
75 |
image_speed = 0; |
76 |
if (global.enemy_low_hp == true && global.current_hp_enemy < global.max_hp_enemy) |
77 |
image_index = 1; |
78 |
else |
79 |
image_index = 0; |
80 |
} |
81 |
x = draw_position_x + damage_disjoint_x; |
82 |
y = draw_position_y + damage_disjoint_y; |
83 |
if (!(instance_exists(obj_text_damage_count) && global.fight_number == 1) && enemy_dead == false && enemy_spared == false) |
84 |
{ |
85 |
if (sprite_index != spr_bowll_body_critical) |
86 |
{ |
87 |
if (!instance_exists(obj_bowll_doggo_a)) |
88 |
{ |
89 |
var random_doggo = irandom_range(1, doggo_chance); |
90 |
if (random_doggo == 1) |
91 |
instance_create(doggo_x, doggo_y, obj_bowll_doggo_a); |
92 |
} |
93 |
} |
94 |
if (enemy_sparing == true && sprite_index != spr_bowll_body_critical) |
95 |
{ |
96 |
time_elapsed_sparkles += 1; |
97 |
if (time_elapsed_sparkles >= time_max_sparkles) |
98 |
{ |
99 |
var random_x = 2 * round(irandom_range(bbox_left + 12, bbox_right - 12) / 2); |
100 |
var random_y = 2 * round(irandom_range(bbox_top + 26, bbox_bottom - 8) / 2); |
101 |
instance_create(random_x, random_y, obj_bowll_sparkles); |
102 |
time_elapsed_sparkles = 0; |
103 |
} |
104 |
} |
105 |
animating = true; |
106 |
} |
107 |
else |
108 |
{ |
109 |
animating = false; |
110 |
} |
111 |
with (obj_bowll_body_shadow_a) |
112 |
event_user(0); |