my player was moving before but it wont move now
heres the code:
xspd = (right_key - left_key) * move_spd;
yspd = (down_key - up_key) * move_spd;
//collisions
if place_meeting(x + xspd, y, Obj_wall) ==true
{
xspd = 0;
}
if place_meeting(x, y + yspd, Obj_wall) ==true
{
yspd = 0;
}
//move the player
x += xspd;
y += yspd;
//set sprite
if xspd > 0 {face = RIGHT}
if xspd < 0 {face = LEFT}
if yspd > 0 {face = DOWN}
if yspd < 0 {face = UP}
sprite_index = sprite[face];
heres the code:
xspd = (right_key - left_key) * move_spd;
yspd = (down_key - up_key) * move_spd;
//collisions
if place_meeting(x + xspd, y, Obj_wall) ==true
{
xspd = 0;
}
if place_meeting(x, y + yspd, Obj_wall) ==true
{
yspd = 0;
}
//move the player
x += xspd;
y += yspd;
//set sprite
if xspd > 0 {face = RIGHT}
if xspd < 0 {face = LEFT}
if yspd > 0 {face = DOWN}
if yspd < 0 {face = UP}
sprite_index = sprite[face];