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