1 |
function scr_normal_statescr_normal_statefunction scr_normal_state() //gml_Script_scr_normal_state
{
if live_call()
return global.live_result;
scr_get_input()
if (DEBUG_DANCE == false)
{
}
else if DEBUG_DANCE
{
if (sprite_index != spr_pl_dance)
{
sprite_index = spr_pl_dance
image_speed = 1
}
if (global.right_key + global.left_key + global.up_key + global.down_key)
DEBUG_DANCE = false
else
return;
}
if (global.cutscene == true)
return;
var hsp = 0
var vsp = 0
var pl_spd = plspd
if ((global.option_autorun ^ keyboard_multicheck(1)) && global.player_can_run == true)
{
is_sprinting = true
pl_spd = plspd + 2
}
else if (is_sprinting == true)
is_sprinting = false
hsp = (sign(global.right_key - global.left_key * 2)) * pl_spd
vsp = (sign(global.down_key - global.up_key * 2)) * pl_spd
if (place_meeting((x + 1), y, obj_dr) || place_meeting(x, (y + 1), obj_dr))
{
x = xprevious
y = yprevious
if (hsp > 0 && vsp > 0)
{
hsp = 0
vsp = 0
}
else if (hsp > 0)
vsp = (-pl_spd) - 1
else if (vsp > 0)
hsp = (-pl_spd) - 1
}
if (place_meeting((x - 1), y, obj_dl) || place_meeting(x, (y + 1), obj_dl))
{
x = xprevious
y = yprevious
if (hsp < 0 && vsp > 0)
{
hsp = 0
vsp = 0
}
else if (hsp < 0)
vsp = (-pl_spd) - 1
else if (vsp > 0)
hsp = pl_spd + 1
}
if (place_meeting((x + 1), y, obj_ur) || place_meeting(x, (y - 1), obj_ur))
{
x = xprevious
y = yprevious
if (hsp > 0 && vsp < 0)
{
hsp = 0
vsp = 0
}
else if (hsp > 0)
vsp = pl_spd + 1
else if (vsp < 0)
hsp = (-pl_spd) - 1
}
if (place_meeting((x + 1), y, obj_ul) || place_meeting(x, (y - 1), obj_ul))
{
x = xprevious
y = yprevious
if (hsp < 0 && vsp < 0)
{
hsp = 0
vsp = 0
}
else if (hsp < 0)
vsp = pl_spd + 1
else if (vsp < 0)
hsp = pl_spd + 1
}
if place_meeting(x, y, obj_stairs)
{
x = xprevious
y = yprevious
if global.right_key
{
if place_free((x + pl_spd), y)
hsp = pl_spd
if place_free(x, (y - 2))
vsp = -2
}
... () //gml_Script_scr_normal_state |
2 |
{ |
3 |
if live_call() |
4 |
return global.live_result; |
5 |
scr_get_inputscr_get_inputfunction scr_get_input() //gml_Script_scr_get_input
{
if live_call()
return global.live_result;
scr_stick_press()
global.down_key = (keyboard_check(vk_down) || gamepad_button_check(0, gp_padd) || gamepad_axis_value(0, gp_axislv))
global.left_key = (keyboard_check(vk_left) || gamepad_button_check(0, gp_padl) || (-(gamepad_axis_value(0, gp_axislh))))
global.right_key = (keyboard_check(vk_right) || gamepad_button_check(0, gp_padr) || gamepad_axis_value(0, gp_axislh))
global.up_key = (keyboard_check(vk_up) || gamepad_button_check(0, gp_padu) || (-(gamepad_axis_value(0, gp_axislv))))
global.down_keyp = (keyboard_check_pressed(vk_down) || gamepad_button_check_pressed(0, gp_padd) || down_stick)
global.left_keyp = (keyboard_check_pressed(vk_left) || gamepad_button_check_pressed(0, gp_padl) || left_stick)
global.right_keyp = (keyboard_check_pressed(vk_right) || gamepad_button_check_pressed(0, gp_padr) || right_stick)
global.up_keyp = (keyboard_check_pressed(vk_up) || gamepad_button_check_pressed(0, gp_padu) || up_stick)
if ((gamepad_button_check_pressed(0, gp_padd)) + (gamepad_button_check_pressed(0, gp_padu)) + (gamepad_button_check_pressed(0, gp_padl)) + (gamepad_button_check_pressed(0, gp_padr)) + down_stick + left_stick + right_stick + up_stick + (gamepad_button_check_pressed(0, global.button1)) + (gamepad_button_check_pressed(0, global.button2)) + (gamepad_button_check_pressed(0, global.button3)) + instance_exists(obj_phone_controls))
global.using_gamepad = true
else if keyboard_check(vk_anykey)
global.using_gamepad = false
if global.using_gamepad
{
if (global.button1 == gp_face1)
global.action_key = "A"
else if (global.button1 == gp_face2)
global.action_key = "B"
else if (global.button1 == gp_face3)
global.action_key = "X"
else if (global.button1 == gp_face4)
global.action_key = "Y"
if (global.button2 == gp_face1)
global.cancel_key = "A"
else if (global.button2 == gp_face2)
global.cancel_key = "B"
else if (global.button2 == gp_face3)
global.cancel_key = "X"
else if (global.button2 == gp_face4)
global.cancel_key = "Y"
if (global.button3 == 32769)
global.pause_key = "A"
else if (global.button3 == 32770)
global.pause_key = "B"
else if (global.button3 == 32771)
global.pause_key = "X"
else if (global.button3 == 32772)
global.pause_key = "Y"
}
else
{
global.pause_key = "C"
global.action_key = "Z"
global.cancel_key = "X"
}
if instance_exists(obj_phone_controls)
{
global.down_key += obj_phone_controls.phn_down
global.left_key += obj_phone_controls.phn_left
global.right_key += obj_phone_controls.phn_right
global.up_key += obj_phone_controls.phn_up
global.down_keyp = sign(global.down_keyp + obj_phone_controls.phn_downp)
global.left_keyp = sign(global.left_keyp + obj_phone_controls.phn_leftp)
global.right_keyp = sign(global.right_keyp + obj_phone_controls.phn_rightp)
global.up_keyp = sign(global.up_keyp + obj_phone_controls.phn_upp)
}
} () |
6 |
if (DEBUG_DANCE == false) |
7 |
{ |
8 |
} |
9 |
else if DEBUG_DANCE |
10 |
{ |
11 |
if (sprite_index != spr_pl_dance) |
12 |
{ |
13 |
sprite_index = spr_pl_dance |
14 |
image_speed = 1 |
15 |
} |
16 |
if (global.right_key + global.left_key + global.up_key + global.down_key) |
17 |
DEBUG_DANCE = false |
18 |
else |
19 |
return; |
20 |
} |
21 |
if (global.cutscene == true) |
22 |
return; |
23 |
var hsp = 0 |
24 |
var vsp = 0 |
25 |
var pl_spd = plspd |
26 |
if ((global.option_autorun ^ keyboard_multicheck(1)) && global.player_can_run == true) |
27 |
{ |
28 |
is_sprinting = true |
29 |
pl_spd = plspd + 2 |
30 |
} |
31 |
else if (is_sprinting == true) |
32 |
is_sprinting = false |
33 |
hsp = (sign(global.right_key - global.left_key * 2)) * pl_spd |
34 |
vsp = (sign(global.down_key - global.up_key * 2)) * pl_spd |
35 |
if (place_meeting((x + 1), y, obj_dr) || place_meeting(x, (y + 1), obj_dr)) |
36 |
{ |
37 |
x = xprevious |
38 |
y = yprevious |
39 |
if (hsp > 0 && vsp > 0) |
40 |
{ |
41 |
hsp = 0 |
42 |
vsp = 0 |
43 |
} |
44 |
else if (hsp > 0) |
45 |
vsp = (-pl_spd) - 1 |
46 |
else if (vsp > 0) |
47 |
hsp = (-pl_spd) - 1 |
48 |
} |
49 |
if (place_meeting((x - 1), y, obj_dl) || place_meeting(x, (y + 1), obj_dl)) |
50 |
{ |
51 |
x = xprevious |
52 |
y = yprevious |
53 |
if (hsp < 0 && vsp > 0) |
54 |
{ |
55 |
hsp = 0 |
56 |
vsp = 0 |
57 |
} |
58 |
else if (hsp < 0) |
59 |
vsp = (-pl_spd) - 1 |
60 |
else if (vsp > 0) |
61 |
hsp = pl_spd + 1 |
62 |
} |
63 |
if (place_meeting((x + 1), y, obj_ur) || place_meeting(x, (y - 1), obj_ur)) |
64 |
{ |
65 |
x = xprevious |
66 |
y = yprevious |
67 |
if (hsp > 0 && vsp < 0) |
68 |
{ |
69 |
hsp = 0 |
70 |
vsp = 0 |
71 |
} |
72 |
else if (hsp > 0) |
73 |
vsp = pl_spd + 1 |
74 |
else if (vsp < 0) |
75 |
hsp = (-pl_spd) - 1 |
76 |
} |
77 |
if (place_meeting((x + 1), y, obj_ul) || place_meeting(x, (y - 1), obj_ul)) |
78 |
{ |
79 |
x = xprevious |
80 |
y = yprevious |
81 |
if (hsp < 0 && vsp < 0) |
82 |
{ |
83 |
hsp = 0 |
84 |
vsp = 0 |
85 |
} |
86 |
else if (hsp < 0) |
87 |
vsp = pl_spd + 1 |
88 |
else if (vsp < 0) |
89 |
hsp = pl_spd + 1 |
90 |
} |
91 |
if place_meeting(x, y, obj_stairs) |
92 |
{ |
93 |
x = xprevious |
94 |
y = yprevious |
95 |
if global.right_key |
96 |
{ |
97 |
if place_free((x + pl_spd), y) |
98 |
hsp = pl_spd |
99 |
if place_free(x, (y - 2)) |
100 |
vsp = -2 |
101 |
} |
102 |
if global.left_key |
103 |
{ |
104 |
if place_free((x - pl_spd), y) |
105 |
hsp = (-pl_spd) |
106 |
if place_free(x, (y + 2)) |
107 |
vsp = 2 |
108 |
} |
109 |
if (global.up_key && (!global.right_key) && (!global.down_key)) |
110 |
{ |
111 |
if place_free(x, (y - 3)) |
112 |
vsp = (-pl_spd) |
113 |
} |
114 |
if (global.down_key && (!global.left_key) && (!global.up_key)) |
115 |
{ |
116 |
if place_free(x, (y + 3)) |
117 |
vsp = pl_spd |
118 |
} |
119 |
} |
120 |
if (!global.debugmove) |
121 |
{ |
122 |
if (!(place_free((x + hsp), y))) |
123 |
{ |
124 |
while place_free((x + sign(hsp)), y) |
125 |
x += sign(hsp) |
126 |
hsp = 0 |
127 |
} |
128 |
if (!(place_free(x, (y + vsp)))) |
129 |
{ |
130 |
while place_free(x, (y + sign(vsp))) |
131 |
y += sign(vsp) |
132 |
vsp = 0 |
133 |
} |
134 |
if (!(place_free((x + hsp), (y + vsp)))) |
135 |
{ |
136 |
while place_free((x + sign(hsp)), (y + sign(vsp))) |
137 |
{ |
138 |
x += sign(hsp) |
139 |
y += sign(vsp) |
140 |
} |
141 |
hsp = 0 |
142 |
vsp = 0 |
143 |
} |
144 |
} |
145 |
if (vsp == 0 && hsp == 0) |
146 |
{ |
147 |
image_speed = 0 |
148 |
image_index = 0 |
149 |
is_sprinting = false |
150 |
global.walking = false |
151 |
} |
152 |
else if (global.walking == false) |
153 |
{ |
154 |
image_index = 1 |
155 |
global.walking = true |
156 |
image_speed = 0.2 |
157 |
} |
158 |
if is_sprinting |
159 |
{ |
160 |
if (image_speed != 0) |
161 |
image_speed = (1/3) |
162 |
} |
163 |
else if global.walking |
164 |
image_speed = 0.2 |
165 |
var can_pause = true |
166 |
if (instance_exists(obj_flowey_world_controller) || instance_exists(obj_flowey_1_controller_base) || room == rm_battle_flashback_final_2 || room == rm_battle_flashback_07 || (room == rm_steamworks_21 && instance_exists(obj_steamworks_21_controller) && obj_steamworks_21_controller.axis_is_running)) |
167 |
can_pause = false |
168 |
if (keyboard_multicheck_pressed(2) && (!instance_exists(obj_transition)) && can_pause) |
169 |
{ |
170 |
instance_create(0, 0, obj_pause_menu) |
171 |
state = gml_Script_scr_frozen_state |
172 |
} |
173 |
if (sliding == false) |
174 |
{ |
175 |
if (dirStore == false) |
176 |
{ |
177 |
if global.right_key |
178 |
{ |
179 |
direction = 0 |
180 |
dirStore = true |
181 |
} |
182 |
if global.left_key |
183 |
{ |
184 |
direction = 180 |
185 |
dirStore = true |
186 |
} |
187 |
if global.down_key |
188 |
{ |
189 |
direction = 270 |
190 |
dirStore = true |
191 |
} |
192 |
if global.up_key |
193 |
{ |
194 |
direction = 90 |
195 |
dirStore = true |
196 |
} |
197 |
} |
198 |
else |
199 |
{ |
200 |
if (direction == 0) |
201 |
{ |
202 |
if (!global.right_key) |
203 |
dirStore = false |
204 |
if global.left_key |
205 |
direction = 180 |
206 |
if (hsp == 0 && vsp != 0) |
207 |
{ |
208 |
if (global.up_key == 1) |
209 |
direction = 90 |
210 |
if (global.down_key == 1) |
211 |
direction = 270 |
212 |
} |
213 |
} |
214 |
if (direction == 90) |
215 |
{ |
216 |
if (!global.up_key) |
217 |
dirStore = false |
218 |
if (vsp == 0 && hsp != 0) |
219 |
{ |
220 |
if (global.left_key == 1) |
221 |
direction = 180 |
222 |
if (global.right_key == 1) |
223 |
direction = 0 |
224 |
} |
225 |
} |
226 |
if (direction == 180) |
227 |
{ |
228 |
if (!global.left_key) |
229 |
dirStore = false |
230 |
if (hsp == 0 && vsp != 0) |
231 |
{ |
232 |
if (global.up_key == 1) |
233 |
direction = 90 |
234 |
if (global.down_key == 1) |
235 |
direction = 270 |
236 |
} |
237 |
} |
238 |
if (direction == 270) |
239 |
{ |
240 |
if (!global.down_key) |
241 |
dirStore = false |
242 |
if global.up_key |
243 |
direction = 90 |
244 |
if (vsp == 0 && hsp != 0) |
245 |
{ |
246 |
if (global.left_key == 1) |
247 |
direction = 180 |
248 |
if (global.right_key == 1) |
249 |
direction = 0 |
250 |
} |
251 |
} |
252 |
} |
253 |
} |
254 |
if (place_meeting(x, y, obj_slippery_ice) && sliding == false) |
255 |
{ |
256 |
if (hsp_slide == 0 && vsp_slide == 0) |
257 |
{ |
258 |
hsp_slide = hsp + sign(hsp) |
259 |
vsp_slide = vsp + sign(vsp) |
260 |
} |
261 |
sliding = true |
262 |
} |
263 |
if (sliding == true) |
264 |
{ |
265 |
hsp = hsp_slide |
266 |
vsp = vsp_slide |
267 |
if ((!(place_meeting(x, y, obj_slippery_ice))) || (place_meeting(x, y, obj_slippery_ice) && hsp == 0 && vsp == 0) || (!(place_free((x + hsp), (y + vsp))))) |
268 |
{ |
269 |
hsp_slide = 0 |
270 |
vsp_slide = 0 |
271 |
hsp = 0 |
272 |
vsp = 0 |
273 |
sliding = false |
274 |
} |
275 |
x += hsp |
276 |
y += vsp |
277 |
return; |
278 |
} |
279 |
if (vsp > pl_spd) |
280 |
vsp = pl_spd |
281 |
if (hsp > pl_spd) |
282 |
hsp = pl_spd |
283 |
if (vsp < (-pl_spd)) |
284 |
vsp = (-pl_spd) |
285 |
if (hsp < (-pl_spd)) |
286 |
hsp = (-pl_spd) |
287 |
x += hsp |
288 |
y += vsp |
289 |
} |