1 |
var damage = global.enemy_attack_stat - global.player_armor_defense - global.player_armor_modifier_defense - global.player_defense + 10 |
2 |
if (damage < 1) |
3 |
damage = 1 |
4 |
script_execute(gml_Script_scr_controls_battle_heart_blue_left) |
5 |
move_y = key_up + key_down |
6 |
vsp = move_y * walk_speed |
7 |
if key_revert |
8 |
vsp = round(vsp / 2) |
9 |
if (hsp > -20 && floating == false) |
10 |
hsp -= grav |
11 |
if (key_right_release && hsp > 0) |
12 |
{ |
13 |
hsp = 0 |
14 |
floating = true |
15 |
alarm[1] = 3 |
16 |
} |
17 |
if ((bbox_left - 1) <= (obj_dialogue_box_battle_transformation_any.bbox_left + 4)) |
18 |
{ |
19 |
floating = false |
20 |
alarm[1] = 0 |
21 |
hsp = key_right * (-jumpspeed) |
22 |
} |
23 |
else if (place_meeting((x - 1), y, obj_battle_enemy_attack_platform_parent) && (!(box_collision(x, y, obj_battle_enemy_attack_platform_parent)))) |
24 |
{ |
25 |
floating = false |
26 |
alarm[1] = 0 |
27 |
hsp = key_right * (-jumpspeed) |
28 |
} |
29 |
if ((!(place_meeting((x - 1), y, obj_battle_enemy_attack_platform_parent))) || box_collision(x, y, obj_battle_enemy_attack_platform_parent)) |
30 |
vsp_carry = 0 |
31 |
if (sign(vsp) == -1 && (bbox_top + vsp) <= (obj_dialogue_box_battle_transformation_any.bbox_top + 4)) |
32 |
{ |
33 |
while ((bbox_top + sign(vsp)) > (obj_dialogue_box_battle_transformation_any.bbox_top + 4)) |
34 |
y += sign(vsp) |
35 |
vsp = 0 |
36 |
} |
37 |
else if (sign(vsp) == 1 && (bbox_bottom + vsp) >= (obj_dialogue_box_battle_transformation_any.bbox_bottom - 4)) |
38 |
{ |
39 |
while ((bbox_bottom + sign(vsp)) < (obj_dialogue_box_battle_transformation_any.bbox_bottom - 4)) |
40 |
y += sign(vsp) |
41 |
vsp = 0 |
42 |
} |
43 |
y += (vsp + vsp_carry) |
44 |
if (sign(hsp) == -1 && (bbox_left + hsp) <= (obj_dialogue_box_battle_transformation_any.bbox_left + 4)) |
45 |
{ |
46 |
while ((bbox_left + sign(hsp)) > (obj_dialogue_box_battle_transformation_any.bbox_left + 4)) |
47 |
x += sign(hsp) |
48 |
hsp = 0 |
49 |
} |
50 |
else if (sign(hsp) == 1 && (bbox_right + hsp) >= (obj_dialogue_box_battle_transformation_any.bbox_right - 4)) |
51 |
{ |
52 |
while ((bbox_right + sign(hsp)) < (obj_dialogue_box_battle_transformation_any.bbox_right - 4)) |
53 |
x += sign(hsp) |
54 |
hsp = 0 |
55 |
} |
56 |
else if instance_exists(obj_battle_enemy_attack_platform_parent) |
57 |
{ |
58 |
if (!(box_collision(x, y, obj_battle_enemy_attack_platform_parent))) |
59 |
{ |
60 |
if (place_meeting((x_position + hsp), y, obj_battle_enemy_attack_platform_parent) && hsp <= 0) |
61 |
{ |
62 |
while (!(place_meeting((x_position + sign(hsp)), y, obj_battle_enemy_attack_platform_parent))) |
63 |
{ |
64 |
x_position += (sign(hsp) / 2) |
65 |
x = ceil(x_position - 0.5) |
66 |
} |
67 |
hsp = 0 |
68 |
} |
69 |
} |
70 |
} |
71 |
x_position += hsp |
72 |
x = ceil(x_position - 0.5) |
73 |
if (vulnerable == true) |
74 |
{ |
75 |
if place_meeting(x, y, obj_battle_enemy_attack_parent) |
76 |
{ |
77 |
vulnerable = false |
78 |
global.hit_self = true |
79 |
global.current_hp_self -= damage |
80 |
audio_play_sound(snd_hurt, 20, false) |
81 |
alarm[0] = global.invulnerability_self |
82 |
} |
83 |
if (place_meeting(x, y, obj_battle_enemy_attack_orange_parent) && hsp == 0 && vsp == 0) |
84 |
{ |
85 |
vulnerable = false |
86 |
global.hit_self = true |
87 |
global.current_hp_self -= damage |
88 |
audio_play_sound(snd_hurt, 20, false) |
89 |
alarm[0] = global.invulnerability_self |
90 |
} |
91 |
if (place_meeting(x, y, obj_battle_enemy_attack_blue_parent) && (hsp != 0 || vsp != 0)) |
92 |
{ |
93 |
vulnerable = false |
94 |
global.hit_self = true |
95 |
global.current_hp_self -= damage |
96 |
audio_play_sound(snd_hurt, 20, false) |
97 |
alarm[0] = global.invulnerability_self |
98 |
} |
99 |
} |
100 |
if (vulnerable == false) |
101 |
image_speed = 1 |
102 |
else |
103 |
{ |
104 |
image_speed = 0 |
105 |
image_index = 0 |
106 |
} |
107 |
if (global.current_hp_self < 0) |
108 |
global.current_hp_self = 0 |
109 |
if (global.current_hp_self == 0) |
110 |
{ |
111 |
global.heart_battle_fighting_color = "red" |
112 |
global.heart_battle_fighting_x = x |
113 |
global.heart_battle_fighting_y = y |
114 |
with (obj_battle_generator) |
115 |
audio_extend = false |
116 |
audio_stop_all() |
117 |
room_goto(rm_death_screen Death screen) |
118 |
} |