Swap not changing player sprite, not sure what I'm doing wrong

Hi all, sorry if this is a repeat/super newb topic but I’m not quite finding the solution when searching the previous posts. So currently I have my player sprite with 6 frames named ‘playerRight’ and a mirrored sprite, 6 frames as well, ‘playerLeft’ and trying to bind the directions to DPAD x axis:

on update do
if event.dx1==1 then
swap "playerRight"
elseif event.dx1==-1 then
swap "playerLeft"
end
end

I have this script on the Player and it executes fine but the sprite just faces right no matter the input. I tried a second test game with non-animated tiles and it would flip once but then never flip back even with opposing directional input on the DPAD. Not sure what I’m doing wrong with such a tiny bit of code.

Any help would be super appreciated!

My best guess is the additonal ‘1’ in event.dx1, as it doesn’t recognize it as the player’s X direction event.dx

Ahhhh - absolutely typo issue. Thank you!

1 Like