1 |
var enemy_low_hp = global.enemy_low_hp; |
2 |
var enemy_dead = global.enemy_dead; |
3 |
var enemy_spared = global.enemy_spared; |
4 |
var enemy_mode = global.enemy_mode; |
5 |
if (enemy_dead == false && enemy_spared == false) |
6 |
image_alpha = global.image_alpha_enemy_attacking; |
7 |
if (enemy_dead == true) |
8 |
{ |
9 |
x = starting_point_x; |
10 |
y = starting_point_y; |
11 |
image_xscale = starting_point_xscale; |
12 |
image_yscale = starting_point_yscale; |
13 |
instance_create(starting_point_x, starting_point_y, obj_frostermit_dead); |
14 |
instance_destroy(); |
15 |
exit; |
16 |
image_alpha = 0.5; |
17 |
} |
18 |
else if (enemy_spared == true) |
19 |
{ |
20 |
sprite_index = spr_frostermit_spared; |
21 |
x = starting_point_x; |
22 |
y = starting_point_y; |
23 |
image_alpha = 0.5; |
24 |
if (no_loop_create_clouds == false) |
25 |
{ |
26 |
for (i = 0; i <= 11; i += 1) |
27 |
instance_create(x + 6, y, obj_spare_cloud); |
28 |
} |
29 |
no_loop_create_clouds = true; |
30 |
} |
31 |
if (damage_disjoint_count > 0) |
32 |
{ |
33 |
damage_disjoint_count -= 1; |
34 |
} |
35 |
else if (enemy_dead == false && enemy_spared == false) |
36 |
{ |
37 |
if (getting_out == false) |
38 |
{ |
39 |
if (enemy_low_hp == true && global.current_hp_enemy < global.max_hp_enemy) |
40 |
{ |
41 |
if (enemy_mode == 0) |
42 |
sprite_index = spr_frostermit_body_critical; |
43 |
else if (enemy_mode == 1) |
44 |
sprite_index = spr_frostermit_body_critical_crab; |
45 |
} |
46 |
else if (enemy_mode == 0) |
47 |
{ |
48 |
sprite_index = spr_frostermit_body; |
49 |
} |
50 |
else if (enemy_mode == 1) |
51 |
{ |
52 |
sprite_index = spr_frostermit_body_crab; |
53 |
} |
54 |
} |
55 |
} |
56 |
if (instance_exists(obj_text_damage_count) && global.fight_number == 1 && no_loop_damage_disjoint_count == false) |
57 |
{ |
58 |
time_elapsed_head = 0; |
59 |
sign_modifier_head = 1; |
60 |
claw_right_angle = claw_right_angle_default; |
61 |
claw_left_angle = claw_left_angle_default; |
62 |
time_elapsed = 0; |
63 |
sign_modifier = -1; |
64 |
damage_disjoint_count = 12; |
65 |
no_loop_damage_disjoint_count = true; |
66 |
audio_play_sound(enemy_hurt_noise, 1, 0, 1, 0, enemy_hurt_pitch); |
67 |
} |
68 |
else if (!instance_exists(obj_text_damage_count)) |
69 |
{ |
70 |
no_loop_damage_disjoint_count = false; |
71 |
} |
72 |
if (damage_disjoint_count == 12) |
73 |
damage_disjoint_x = -50; |
74 |
else if (damage_disjoint_count == 10) |
75 |
damage_disjoint_x = 50; |
76 |
else if (damage_disjoint_count == 8) |
77 |
damage_disjoint_x = -20; |
78 |
else if (damage_disjoint_count == 6) |
79 |
damage_disjoint_x = 20; |
80 |
else if (damage_disjoint_count == 4) |
81 |
damage_disjoint_x = -10; |
82 |
else if (damage_disjoint_count == 2) |
83 |
damage_disjoint_x = 10; |
84 |
else if (damage_disjoint_count == 0) |
85 |
damage_disjoint_x = 0; |
86 |
if (damage_disjoint_count > 0 || global.current_hp_enemy <= 0) |
87 |
{ |
88 |
if (getting_out == false) |
89 |
{ |
90 |
if (enemy_mode == 0) |
91 |
{ |
92 |
if (enemy_low_hp == true && global.current_hp_enemy < global.max_hp_enemy) |
93 |
sprite_index = spr_frostermit_body_critical; |
94 |
else |
95 |
sprite_index = spr_frostermit_body; |
96 |
} |
97 |
else if (enemy_mode == 1) |
98 |
{ |
99 |
sprite_index = spr_frostermit_dead; |
100 |
} |
101 |
} |
102 |
} |
103 |
x = draw_position_x + damage_disjoint_x; |
104 |
y = draw_position_y + damage_disjoint_y; |
105 |
image_xscale = starting_point_xscale; |
106 |
image_yscale = starting_point_yscale; |
107 |
if (!(instance_exists(obj_text_damage_count) && global.fight_number == 1) && enemy_dead == false && enemy_spared == false) |
108 |
{ |
109 |
if (enemy_mode == 1 && getting_out == false) |
110 |
{ |
111 |
game_maker_cannot_do_math = power((time_elapsed_head / ((time_max_head / 2) * (1 / sqrt(max_rise_head)))) - sqrt(max_rise_head), 2); |
112 |
animation_disjoint_y = sign_modifier_head * (max_rise_head - round(game_maker_cannot_do_math)); |
113 |
time_elapsed_head += time_increase_head; |
114 |
if (time_elapsed_head >= time_max_head) |
115 |
{ |
116 |
time_elapsed_head = 0; |
117 |
sign_modifier_head = -sign_modifier_head; |
118 |
} |
119 |
head_displacement_y = y + animation_disjoint_y; |
120 |
claw_angle_increase = 0; |
121 |
claw_radius = 3; |
122 |
claw_speed = 24; |
123 |
if (enemy_low_hp == false) |
124 |
claw_right_x = obj_frostermit_body_a.x + (claw_radius * cos((claw_right_angle + claw_angle_increase) * claw_right_angle_direction * 0.008726646259971648)); |
125 |
else |
126 |
claw_right_x = obj_frostermit_body_a.x; |
127 |
claw_right_y = obj_frostermit_body_a.y - (claw_radius * sin((claw_right_angle + claw_angle_increase) * claw_right_angle_direction * 0.008726646259971648)); |
128 |
if (enemy_low_hp == false) |
129 |
claw_left_x = obj_frostermit_body_a.x + (claw_radius * cos((claw_left_angle + claw_angle_increase) * claw_left_angle_direction * 0.008726646259971648)); |
130 |
else |
131 |
claw_left_x = obj_frostermit_body_a.x; |
132 |
claw_left_y = obj_frostermit_body_a.y - (claw_radius * sin((claw_left_angle + claw_angle_increase) * claw_left_angle_direction * 0.008726646259971648)); |
133 |
claw_angle_increase += claw_speed; |
134 |
claw_right_angle += claw_speed; |
135 |
claw_left_angle += claw_speed; |
136 |
game_maker_cannot_do_math = power((time_elapsed / ((time_max / 2) * (1 / sqrt(max_rise)))) - sqrt(max_rise), 2); |
137 |
animation_disjoint_y = sign_modifier * (max_rise - round(game_maker_cannot_do_math)); |
138 |
time_elapsed += time_increase; |
139 |
if (time_elapsed >= time_max) |
140 |
time_elapsed = 0; |
141 |
var y_val = draw_position_y + animation_disjoint_y; |
142 |
var y_store = y_val; |
143 |
var time_elapsed_1 = time_elapsed - 4; |
144 |
if (time_elapsed_1 < 0) |
145 |
time_elapsed_1 += time_max; |
146 |
game_maker_cannot_do_math = power((time_elapsed_1 / ((time_max / 2) * (1 / sqrt(max_rise)))) - sqrt(max_rise), 2); |
147 |
animation_disjoint_y = sign_modifier * (max_rise - game_maker_cannot_do_math); |
148 |
y_val = draw_position_y + animation_disjoint_y; |
149 |
leg_1_displacement_y = y_val; |
150 |
y_val = y_store; |
151 |
var time_elapsed_2 = time_elapsed - 8; |
152 |
if (time_elapsed_2 < 0) |
153 |
time_elapsed_2 += time_max; |
154 |
game_maker_cannot_do_math = power((time_elapsed_2 / ((time_max / 2) * (1 / sqrt(max_rise)))) - sqrt(max_rise), 2); |
155 |
animation_disjoint_y = sign_modifier * (max_rise - game_maker_cannot_do_math); |
156 |
y_val = draw_position_y + animation_disjoint_y; |
157 |
leg_2_displacement_y = y_val; |
158 |
y_val = y_store; |
159 |
var time_elapsed_3 = time_elapsed - 12; |
160 |
if (time_elapsed_3 < 0) |
161 |
time_elapsed_3 += time_max; |
162 |
game_maker_cannot_do_math = power((time_elapsed_3 / ((time_max / 2) * (1 / sqrt(max_rise)))) - sqrt(max_rise), 2); |
163 |
animation_disjoint_y = sign_modifier * (max_rise - game_maker_cannot_do_math); |
164 |
y_val = draw_position_y + animation_disjoint_y; |
165 |
leg_3_displacement_y = y_val; |
166 |
var position_var = draw_position_y + damage_disjoint_y; |
167 |
y = head_displacement_y - ((head_displacement_y - position_var) / 3); |
168 |
var time_elapsed_head_new = time_elapsed_head - 4; |
169 |
if (time_elapsed_head_new < 0) |
170 |
{ |
171 |
time_elapsed_head_new += time_max_head; |
172 |
sign_modifier_head_new = -sign_modifier_head; |
173 |
} |
174 |
else |
175 |
{ |
176 |
sign_modifier_head_new = sign_modifier_head; |
177 |
} |
178 |
game_maker_cannot_do_math = power((time_elapsed_head_new / ((time_max_head / 2) * (1 / sqrt(max_rise_head)))) - sqrt(max_rise_head), 2); |
179 |
animation_disjoint_y = sign_modifier_head_new * (max_rise_head - game_maker_cannot_do_math); |
180 |
head_new_displacement_y = draw_position_y + animation_disjoint_y; |
181 |
} |
182 |
animating = true; |
183 |
} |
184 |
else |
185 |
{ |
186 |
animating = false; |
187 |
} |