I was attempting a player swap so the player sprite changes based on the direction input. I created the following script, but the sprite only changes when going up and stays that way.
on update do
if event.dy==-1 then
swap "player_up"
if event.dy==1 then
swap "test"
if event.dx==-1 then
swap "player_right"
if event.dx==1 then
swap "player_left"
end
end
end
Your if statements are nested, so they don't check for all the conditions in sequence. What you want is something like,
on update do
if event.dy==-1 then
swap “player_up”
elseif event.dy==1 then
swap “test”
end
if event.dx==-1 then
swap “player_right”
elseif event.dx==1 then
swap “player_left”
end
end