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
This post includes a demo game that shows how I handle this behavior, btw: Pulp how-to: two-tile-tall player - #3 by Guv_Bubbs