1 |
var enemy_dead_2 = global.enemy_dead_2 |
2 |
var enemy_spared_2 = global.enemy_spared_2 |
3 |
if (enemy_dead_2 == false && enemy_spared_2 == false) |
4 |
image_alpha = global.image_alpha_enemy_attacking |
5 |
if (enemy_dead_2 == true) |
6 |
{ |
7 |
x = starting_point_x |
8 |
y = starting_point_y |
9 |
image_xscale = starting_point_xscale |
10 |
image_yscale = starting_point_yscale |
11 |
instance_create(starting_point_x, starting_point_y, obj_insomnitot_dead) |
12 |
instance_destroy() |
13 |
return; |
14 |
} |
15 |
else if (enemy_spared_2 == true) |
16 |
{ |
17 |
sprite_index = spr_insomnitot_spared |
18 |
x = starting_point_x |
19 |
y = starting_point_y |
20 |
image_xscale = starting_point_xscale |
21 |
image_yscale = starting_point_yscale |
22 |
image_alpha = 0.5 |
23 |
if (no_loop_create_clouds == false) |
24 |
{ |
25 |
for (i = 0; i <= 11; i += 1) |
26 |
instance_create(x, (y - 22), obj_spare_cloud) |
27 |
} |
28 |
no_loop_create_clouds = true |
29 |
} |
30 |
if (damage_disjoint_count > 0) |
31 |
damage_disjoint_count -= 1 |
32 |
else if (enemy_dead_2 == false && enemy_spared_2 == false) |
33 |
{ |
34 |
if (global.enemy_low_hp_2 == true && global.current_hp_enemy_2 < global.max_hp_enemy_2) |
35 |
sprite_index = spr_insomnitot_body_critical |
36 |
else |
37 |
sprite_index = spr_insomnitot_body |
38 |
} |
39 |
if (instance_exists(obj_text_damage_count) && global.fight_number == 2 && no_loop_damage_disjoint_count == false) |
40 |
{ |
41 |
state = "asleep" |
42 |
asleep_counter = 0 |
43 |
awake_counter = 0 |
44 |
no_loop_awake = false |
45 |
time_elapsed = 0 |
46 |
sign_modifier = 1 |
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_2 <= 0) |
68 |
{ |
69 |
sprite_index = spr_insomnitot_dead |
70 |
image_xscale = starting_point_xscale |
71 |
image_yscale = starting_point_yscale |
72 |
} |
73 |
x = draw_position_x + damage_disjoint_x |
74 |
y = draw_position_y + damage_disjoint_y |
75 |
image_xscale = starting_point_xscale |
76 |
image_yscale = starting_point_yscale |
77 |
if ((!((instance_exists(obj_text_damage_count) && global.fight_number == 2))) && enemy_dead_2 == false && enemy_spared_2 == false) |
78 |
{ |
79 |
if (sleep == false) |
80 |
{ |
81 |
event_user(0) |
82 |
if (time_elapsed >= time_max) |
83 |
{ |
84 |
time_elapsed = 0 |
85 |
sign_modifier = (-sign_modifier) |
86 |
} |
87 |
event_user(1) |
88 |
} |
89 |
else if (state == "asleep") |
90 |
{ |
91 |
event_user(0) |
92 |
if (time_elapsed >= time_max) |
93 |
{ |
94 |
if (sign_modifier < 0) |
95 |
{ |
96 |
asleep_counter += 1 |
97 |
if (asleep_counter >= asleep_max) |
98 |
{ |
99 |
state = "waking" |
100 |
asleep_counter = 0 |
101 |
} |
102 |
} |
103 |
else |
104 |
instance_create((x - 74), (y - 72), obj_insomnitot_bubble_b) |
105 |
time_elapsed = 0 |
106 |
sign_modifier = (-sign_modifier) |
107 |
} |
108 |
event_user(1) |
109 |
} |
110 |
else if (state == "waking") |
111 |
{ |
112 |
sign_modifier = 1 |
113 |
event_user(0) |
114 |
event_user(1) |
115 |
if (time_elapsed >= (time_max / 2)) |
116 |
{ |
117 |
state = "awake" |
118 |
no_loop_awake = false |
119 |
} |
120 |
} |
121 |
else if (state == "awake") |
122 |
{ |
123 |
if (awake_counter >= awake_max && no_loop_awake == false) |
124 |
{ |
125 |
alarm[0] = 30alarm[0]state = "sleep"
awake_counter = 0 |
126 |
no_loop_awake = true |
127 |
} |
128 |
event_user(1) |
129 |
} |
130 |
else if (state == "sleep") |
131 |
{ |
132 |
sign_modifier = 1 |
133 |
event_user(0) |
134 |
if (time_elapsed >= time_max) |
135 |
{ |
136 |
instance_create((x - 74), (y - 72), obj_insomnitot_bubble_b) |
137 |
state = "asleep" |
138 |
time_elapsed = 0 |
139 |
sign_modifier = (-sign_modifier) |
140 |
} |
141 |
event_user(1) |
142 |
} |
143 |
ears_displacement_y = bbox_top + 32 |
144 |
face_displacement_y = bbox_top + 62 |
145 |
animating = true |
146 |
} |
147 |
else |
148 |
animating = false |