How do i flip a sprite dependent on what direction it is traveling the X axis

I want it to flip around if the number on X axis is decreasing or increasing.

i don’t know how else to explain it

Maybe you’re not approaching the problem the right way… usually we flip the sprites in the same event as the controls (if left is pressed, simulate left, flip: yes), but to answer your question, store X position in a variable, before moving it, then compare it to current position on the next frame.
So the event order would be:

  • compare X to oldX - flip action depending on result.
  • store X in oldX.
  • move.
1 Like