1 |
if live_call() |
2 |
return global.live_result; |
3 |
script_execute(gml_Script_scr_controls_battle_heart_red) |
4 |
charge_percentage = charge_time / charge_time_max |
5 |
x_previous = x |
6 |
y_previous = y |
7 |
move_x = key_left + key_right |
8 |
move_y = key_down + key_up |
9 |
hsp = move_x * walk_speed |
10 |
vsp = move_y * walk_speed |
11 |
if is_dashing |
12 |
{ |
13 |
var ghost = instance_create_depth(x, y, depth, obj_dash_ghost) |
14 |
ghost.sprite_index = base_sprite |
15 |
hsp = move_x_dash * dash_speed |
16 |
vsp = move_y_dash * dash_speed |
17 |
dash_timer-- |
18 |
if (dash_timer <= 0) |
19 |
is_dashing = false |
20 |
} |
21 |
else |
22 |
dash_timer = dash_distance |
23 |
hsp += hsp_factor |
24 |
vsp += vsp_factor |
25 |
if (room == rm_battle_flowey_phase_2) |
26 |
{ |
27 |
var right_boundary = room_width |
28 |
var left_boundary = 0 |
29 |
var top_boundary = 260 |
30 |
var bottom_boundary = room_height |
31 |
} |
32 |
else |
33 |
{ |
34 |
right_boundary = obj_dialogue_box_battle_transformation_any.bbox_right - 4 |
35 |
left_boundary = obj_dialogue_box_battle_transformation_any.bbox_left + 4 |
36 |
top_boundary = obj_dialogue_box_battle_transformation_any.bbox_top + 4 |
37 |
bottom_boundary = obj_dialogue_box_battle_transformation_any.bbox_bottom - 4 |
38 |
} |
39 |
if (sign(hsp) == -1 && (bbox_left + hsp) <= left_boundary) |
40 |
{ |
41 |
while ((bbox_left + sign(hsp)) > left_boundary) |
42 |
x += sign(hsp) |
43 |
is_dashing = false |
44 |
hsp = 0 |
45 |
} |
46 |
else if (sign(hsp) == 1 && (bbox_right + hsp) >= right_boundary) |
47 |
{ |
48 |
while ((bbox_right + sign(hsp)) < right_boundary) |
49 |
x += sign(hsp) |
50 |
is_dashing = false |
51 |
hsp = 0 |
52 |
} |
53 |
x += hsp |
54 |
if (sign(vsp) == -1 && (bbox_top + vsp) <= top_boundary) |
55 |
{ |
56 |
while ((bbox_top + sign(vsp)) > top_boundary) |
57 |
y += sign(vsp) |
58 |
is_dashing = false |
59 |
vsp = 0 |
60 |
} |
61 |
else if (sign(vsp) == 1 && (bbox_bottom + vsp) >= bottom_boundary) |
62 |
{ |
63 |
while ((bbox_bottom + sign(vsp)) < bottom_boundary) |
64 |
y += sign(vsp) |
65 |
is_dashing = false |
66 |
vsp = 0 |
67 |
} |
68 |
y += vsp |
69 |
var collider_id = instance_place(x, (y + vsp), obj_martlet_attack_glass) |
70 |
if (collider_id != -4) |
71 |
{ |
72 |
if (vsp != 0) |
73 |
{ |
74 |
} |
75 |
} |
76 |
obj_heart_red_hitbox.x = x |
77 |
obj_heart_red_hitbox.y = y |
78 |
if instance_exists(obj_heart_battle_effect_glow) |
79 |
{ |
80 |
obj_heart_battle_effect_glow.x = x |
81 |
obj_heart_battle_effect_glow.y = y |
82 |
} |
83 |
if (moveable == true && global.current_sp_self > 0) |
84 |
{ |
85 |
var can_trail = false |
86 |
trail_cc_current += 1 |
87 |
if (trail_cc_current >= trail_cc_max) |
88 |
{ |
89 |
can_trail = true |
90 |
trail_cc_current = 0 |
91 |
} |
92 |
if (can_trail == true) |
93 |
{ |
94 |
ds_list_add(x_list, x) |
95 |
ds_list_add(y_list, y) |
96 |
while (ds_list_size(x_list) > max_points_trail) |
97 |
{ |
98 |
ds_list_delete(x_list, 0) |
99 |
ds_list_delete(y_list, 0) |
100 |
} |
101 |
} |
102 |
} |
103 |
else if (ds_list_size(x_list) > 0) |
104 |
ds_list_clear(x_list) |
105 |
if (room == rm_battle_flowey_phase_2) |
106 |
{ |
107 |
if (sprite_index == spr_heart_yellow_down) |
108 |
{ |
109 |
base_sprite = 1661 |
110 |
var dash_disable = true |
111 |
if instance_exists(obj_flowey_battle_final) |
112 |
{ |
113 |
for (var i = 0; i < array_length(obj_flowey_battle_final.petal_alive); i++) |
114 |
{ |
115 |
if (obj_flowey_battle_final.petal_alive[i] == false) |
116 |
dash_disable = false |
117 |
} |
118 |
} |
119 |
if (dash_disable == true) |
120 |
{ |
121 |
is_dashing = false |
122 |
can_dash = false |
123 |
} |
124 |
} |
125 |
else |
126 |
base_sprite = 1662 |
127 |
} |
128 |
if ((abs(move_x) + abs(move_y)) == 0) |
129 |
{ |
130 |
if keyboard_multicheck_pressed(1) |
131 |
dash_buffered = true |
132 |
if (keyboard_multicheck_released(1) && dash_buffered == true) |
133 |
dash_buffered = false |
134 |
} |
135 |
if ((keyboard_multicheck_pressed(1) || dash_buffered) && moveable == true && can_dash == true && (abs(move_x) + abs(move_y)) != 0) |
136 |
{ |
137 |
audio_play_sound(snd_yellow_soul_dash, 1, 0) |
138 |
dash_overlay = 1.1 |
139 |
move_x_dash = move_x |
140 |
move_y_dash = move_y |
141 |
dash_grace = dash_grace_max |
142 |
is_dashing = true |
143 |
dash_buffered = false |
144 |
can_dash = false |
145 |
} |
146 |
if ((!can_dash) && (!is_dashing)) |
147 |
{ |
148 |
if (dash_grace > 0) |
149 |
dash_grace-- |
150 |
if (dash_delay > 0) |
151 |
dash_delay-- |
152 |
else |
153 |
{ |
154 |
dash_grace = 0 |
155 |
dash_delay = dash_delay_max |
156 |
can_dash = true |
157 |
} |
158 |
} |
159 |
if (keyboard_multicheck_released(1) && is_dashing && can_cancel_dash) |
160 |
is_dashing = false |
161 |
if (dash_overlay > 0) |
162 |
dash_overlay -= 0.1 |
163 |
shoot_delay = 10 |
164 |
if (shoot_buffer <= 0) |
165 |
{ |
166 |
if keyboard_multicheck_pressed(0) |
167 |
shoot_buffer = 10 |
168 |
} |
169 |
else |
170 |
shoot_buffer-- |
171 |
var turn_angle_target_final = turn_angle_target - 90 |
172 |
switch turn_state |
173 |
{ |
174 |
case 0: |
175 |
if (image_angle != turn_angle_target_final) |
176 |
turn_state += 1 |
177 |
break |
178 |
case 1: |
179 |
image_xscale += 0.25 |
180 |
image_yscale += 0.25 |
181 |
if (image_xscale > 1.5) |
182 |
turn_state += 1 |
183 |
break |
184 |
case 2: |
185 |
image_angle += ((angle_difference(turn_angle_target_final, image_angle)) * 0.2) |
186 |
if (image_xscale > 1) |
187 |
image_xscale -= 0.2 |
188 |
else |
189 |
image_xscale = 1 |
190 |
if (angle_difference(image_angle, turn_angle_target_final) < 1) |
191 |
{ |
192 |
image_angle = turn_angle_target_final |
193 |
image_xscale = 1 |
194 |
turn_state = 0 |
195 |
show_debug_message("LOCKED " + string(turn_angle_target_final)) |
196 |
} |
197 |
image_yscale = image_xscale |
198 |
break |
199 |
} |
200 |
|
201 |
if (turn_state > 0) |
202 |
{ |
203 |
if instance_exists(obj_heart_yellow_shot_blast) |
204 |
{ |
205 |
} |
206 |
} |
207 |
if instance_exists(obj_heart_yellow_shot_blast) |
208 |
{ |
209 |
can_shoot = false |
210 |
alarm[1] = shoot_delay |
211 |
} |
212 |
if (keyboard_multicheck_pressed(2) && global.option_autoshoot) |
213 |
{ |
214 |
if global.autofire_on |
215 |
global.autofire_on = false |
216 |
else |
217 |
global.autofire_on = true |
218 |
} |
219 |
if (global.option_autoshoot == false) |
220 |
global.autofire_on = false |
221 |
function fireCheck_gml_Object_obj_heart_battle_fighting_yellow_final_Step_0() //gml_Script_fireCheck_gml_Object_obj_heart_battle_fighting_yellow_final_Step_0 |
222 |
{ |
223 |
if (global.autofire_on == true || (global.autofire_on == false && keyboard_multicheck_pressed(0))) |
224 |
return true; |
225 |
return false; |
226 |
} |
227 |
|
228 |
if ((fireCheck() || shoot_buffer > 0) && sprite_index != spr_heart_yellow_down && moveable == true && can_shoot == true && (!blast_is_firing) && (!is_charging)) |
229 |
{ |
230 |
shoot_buffer = 0 |
231 |
sprite_index = spr_heart_yellow_shoot |
232 |
image_index = 0 |
233 |
image_speed = 1 |
234 |
var yy = y - 6 |
235 |
var xx = x + 0.5 |
236 |
if (image_angle == 90 || image_angle == 270) |
237 |
{ |
238 |
yy = y |
239 |
xx = x |
240 |
} |
241 |
if (image_angle == 180) |
242 |
yy = y + 6 |
243 |
var shot = instance_create_depth(xx, yy, -10000, obj_heart_yellow_shot) |
244 |
shot.direction = image_angle + 90 |
245 |
shot.image_angle = image_angle |
246 |
can_shoot = false |
247 |
alarm[1] = shoot_delay |
248 |
} |
249 |
if (keyboard_multicheck(0) && (!is_charging) && sprite_index != spr_heart_yellow_down && moveable == true && (!blast_is_firing) && can_charge == true) |
250 |
{ |
251 |
if (!alarm[2]) |
252 |
alarm[2] = 7 |
253 |
} |
254 |
if (keyboard_multicheck_released(0) || keyboard_multicheck_pressed(2)) |
255 |
{ |
256 |
alarm[2] = -1 |
257 |
if (is_charging == true) |
258 |
{ |
259 |
is_charging = false |
260 |
charge_time = charge_time_max |
261 |
sprite_index = spr_heart_yellow_up |
262 |
image_index = 0 |
263 |
image_speed = 0 |
264 |
if (is_charged == true) |
265 |
{ |
266 |
if (charged_shot_type == 1) |
267 |
{ |
268 |
yy = y - 6 |
269 |
xx = x + 0.5 |
270 |
if (image_angle == 90 || image_angle == 270) |
271 |
{ |
272 |
yy = y |
273 |
xx = x |
274 |
} |
275 |
var shot_big = instance_create_depth(xx, yy, -10000, obj_heart_yellow_shot_big) |
276 |
shot_big.direction = image_angle + 90 |
277 |
shot_big.image_angle = image_angle |
278 |
is_charged = false |
279 |
can_shoot = false |
280 |
alarm[1] = shoot_delay |
281 |
sprite_index = spr_heart_yellow_shoot |
282 |
image_index = 0 |
283 |
image_speed = 1 |
284 |
} |
285 |
else if (charged_shot_type == 2) |
286 |
{ |
287 |
shot_big = instance_create_depth(x, y, -10000, obj_heart_yellow_shot_blast) |
288 |
var image_angle_final = turn_angle_target_final |
289 |
shot_big.direction = image_angle_final + 90 |
290 |
shot_big.image_angle = image_angle_final |
291 |
is_charged = false |
292 |
blast_is_firing = true |
293 |
sprite_index = spr_heart_yellow_shoot |
294 |
image_index = 0 |
295 |
image_speed = 0 |
296 |
} |
297 |
} |
298 |
} |
299 |
} |
300 |
if is_charging |
301 |
{ |
302 |
if (!audio_is_playing(snd_chargeshot_charge)) |
303 |
{ |
304 |
charge_sound = audio_play_sound(snd_chargeshot_charge, 1, 1) |
305 |
audio_sound_gain(charge_sound, 0.8, 0) |
306 |
audio_sound_pitch(charge_sound, 0.5) |
307 |
} |
308 |
if (charge_time > 0) |
309 |
charge_time -= 1 |
310 |
else if (!is_charged) |
311 |
{ |
312 |
var ready_sound = audio_play_sound(snd_undertale_flash, 1, 0) |
313 |
audio_sound_gain(ready_sound, 0.5, 0) |
314 |
audio_sound_gain(charge_sound, 0, 1000) |
315 |
is_charged = true |
316 |
sprite_index = spr_heart_yellow_ready |
317 |
image_index = 0 |
318 |
image_speed = 1 |
319 |
} |
320 |
} |
321 |
else |
322 |
{ |
323 |
audio_stop_sound(charge_sound) |
324 |
is_charged = false |
325 |
if (sprite_index == spr_heart_yellow_ready) |
326 |
{ |
327 |
sprite_index = spr_heart_yellow_up |
328 |
image_index = 0 |
329 |
image_speed = 0 |
330 |
} |
331 |
} |
332 |
if audio_is_playing(charge_sound) |
333 |
{ |
334 |
var pitch_original = audio_sound_get_pitch(charge_sound) |
335 |
if (pitch_original < 0.99) |
336 |
audio_sound_pitch(charge_sound, (1 - 0.5 * charge_percentage)) |
337 |
else |
338 |
audio_sound_pitch(charge_sound, 1) |
339 |
} |
340 |
if (blast_is_firing && (!instance_exists(obj_heart_yellow_shot_blast))) |
341 |
{ |
342 |
blast_is_firing = false |
343 |
sprite_index = spr_heart_yellow_up |
344 |
image_index = 0 |
345 |
image_speed = 0 |
346 |
} |
347 |
event_user(15) |