N
Nek0Slime
Guest
I've been programming a movement system, and there is a problem with the variables that I'm baffled with
___________________________________________
ERROR in
action number 1
of Step Event
for object obj_player:
Error in code at line 16:
hspeed = lengthdir_x(len, dir)
at position 23: Unknown variable len
but I'm certain I've already had len as a variable.
here is the full code:
///scr_move_state
scr_get_input() ;
scr_key_input() ;
// Move
x += hspeed;
y += vspeed;
// Get the axis
xaxis = (right_key - left_key);
yaxis = (down_key - up_key);
// Get the hspd and vspd
hspeed = lengthdir_x(len, dir)
vspeed = lengthdir_y(len, dir)
// Get Direction
dir = point_direction(0, 0, xaxis, yaxis);
//Get the length
if (xaxis == 0 and yaxis = 0) {
len = 0;
}else {
len = spd;
}
if anyone can help that would be great! I'm using a mac to do this if it helps.
___________________________________________
ERROR in
action number 1
of Step Event
for object obj_player:
Error in code at line 16:
hspeed = lengthdir_x(len, dir)
at position 23: Unknown variable len
but I'm certain I've already had len as a variable.
here is the full code:
///scr_move_state
scr_get_input() ;
scr_key_input() ;
// Move
x += hspeed;
y += vspeed;
// Get the axis
xaxis = (right_key - left_key);
yaxis = (down_key - up_key);
// Get the hspd and vspd
hspeed = lengthdir_x(len, dir)
vspeed = lengthdir_y(len, dir)
// Get Direction
dir = point_direction(0, 0, xaxis, yaxis);
//Get the length
if (xaxis == 0 and yaxis = 0) {
len = 0;
}else {
len = spd;
}
if anyone can help that would be great! I'm using a mac to do this if it helps.