I'd like to know if there is a way I can check if an object with the platformer behavior changes its direction. Note that this object is not controlled by the arrow keys, it's an enemy, so detecting a direction change would not work by checking for arrow key presses.
Develop games in your browser. Powerful, performant & highly capable.
With an instance variable. I set left to -1 and right to 1 ( i do this because I use those values for calculating
But you could have 0 and 1 respectively
if the enemy sprite is mirrored then value a
else if its not mirrored then value b
But the enemy sprite doesn't mirror, it constantly faces the same direction. (To make the sprite mirror on direction change was the reason I wanted to test if the sprite changes direction)