wywal wszystkie keyboard eventy a ich zawartość wstaw w step w tej kolejności:
GML
if (global.facing="R")
{
if global.moving=true {sprite_index=sprCharR_run; image_speed=imgSpeed} else if global.moving=false { sprite_index=sprCharR }
}
if (global.facing="D")
{
if global.moving=true {sprite_index=sprCharD_run; image_speed=imgSpeed} else if global.moving=false{ sprite_index=sprCharD }
}
if (global.facing="L")
{
if global.moving=true {sprite_index=sprCharL_run; image_speed=imgSpeed} else if global.moving=false{ sprite_index=sprCharL }
}
if (global.facing="U")
{
if global.moving=true {sprite_index=sprCharU_run; image_speed=imgSpeed} else if global.moving=false{ sprite_index=sprCharU }
}
if (keyboard_check(vk_left)) or (keyboard_check(vk_right)) or (keyboard_check(vk_up)) or (keyboard_check(vk_down)) {global.moving=true}
else if place_snapped(32,32) {global.moving=false}
if keyboard_check(vk_left)
{
if place_snapped(32,32) if !place_meeting(x-1,y,Rock1)
{
if vspeed=0 {{hspeed=-charSpeed}; global.facing="L"}
}
else {hspeed=0; global.moving=false}
}
if keyboard_check(vk_up)
{
if place_snapped(32,32) if !place_meeting(x,y-4,Rock1)
{
if hspeed=0 {{vspeed=-charSpeed}; global.facing="U"}
}
else {vspeed=0; global.moving=false}
}
if keyboard_check(vk_right)
{
if place_snapped(32,32) if !place_meeting(x+1,y,Rock1)
{
if vspeed=0 {{hspeed=charSpeed}; global.facing="R"}
}
else {hspeed=0; global.moving=false}
}
if keyboard_check(vk_down)
{
if place_snapped(32,32) if !place_meeting(x,y+1,Rock1)
{
if hspeed=0 {{vspeed=charSpeed}; global.facing="D"}
}
else {vspeed=0; global.moving=false}
}