G
giannis196
Guest
So, i follow a tutorial and i made the script as i saw from the tutorial but i got this message
___________________________________________
############################################################################################
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_move_state (line 13) - if (place_meeting(x+hspd, y, obj_wall))
############################################################################################
gml_GlobalScript_move_state (line 13)
My code is:
it says it starts at 13 line which it writes "if (place_meeting(x+hspd, y, obj_wall))"
I don't know what's wrong with it...any ideas on what's wrong?
Thanks!
___________________________________________
############################################################################################
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_move_state (line 13) - if (place_meeting(x+hspd, y, obj_wall))
############################################################################################
gml_GlobalScript_move_state (line 13)
My code is:
GML:
dir = point_direction(0, 0, xaxis, yaxis);
if (xaxis == 0) && (yaxis == 0)
{
len = 0
} else {
len = spd;
}
hspd = lengthdir_x(len, dir);
vspd = lengthdir_y(len, dir);
if (place_meeting(x+hspd, y, obj_wall))
{
while(!place_meeting(x+sign(hspd), y, obj_wall))
{
x += sign(hspd);
}
hspd = 0;
}
x += hspd;
if (place_meeting(x, y+vspd, obj_wall) )
{
while(!place_meeting(x, y+sign(vspd), obj_wall))
{
y += sign(vspd);
}
vspd = 0;
}
y += vspd;
I don't know what's wrong with it...any ideas on what's wrong?
Thanks!