S
Sub Aqua
Guest
Hi i'm making a platformer/metroidvania and I'm new to Game Maker Studio 2. I'm having difficulty getting a ladder state machine script to work due to an error. Here's my code:
scr_getinputs();
hsp= 0;
vsp= 4* (key_down -key_up)
x = (instance_nearest(x,y,oLadder).x)
if (key_jump) || (!place_meeting(x,y,oLadder))
{
hsp=0;
vsp=0;
state=states.normal
}
scr_collideandmove();
Here is the error:
___________________________________________
############################################################################################
ERROR in
action number 1
of Create Event
for object <undefined>:
Variable <unknown_object>.y(1, -2147483648) not set before reading it.
at gml_GlobalScript_scr_player_ladder (line 18) - x = (instance_nearest(x,y,oLadder).x)
############################################################################################
gml_GlobalScript_scr_player_ladder (line 18)
Any help you could give me would be appreciated. My guess is that the script doesn't know what object to use when detecting the closest ladder but I'm not sure.
scr_getinputs();
hsp= 0;
vsp= 4* (key_down -key_up)
x = (instance_nearest(x,y,oLadder).x)
if (key_jump) || (!place_meeting(x,y,oLadder))
{
hsp=0;
vsp=0;
state=states.normal
}
scr_collideandmove();
Here is the error:
___________________________________________
############################################################################################
ERROR in
action number 1
of Create Event
for object <undefined>:
Variable <unknown_object>.y(1, -2147483648) not set before reading it.
at gml_GlobalScript_scr_player_ladder (line 18) - x = (instance_nearest(x,y,oLadder).x)
############################################################################################
gml_GlobalScript_scr_player_ladder (line 18)
Any help you could give me would be appreciated. My guess is that the script doesn't know what object to use when detecting the closest ladder but I'm not sure.