So I'm trying to build on an example for grid movements, I need to be able to figure out what direction the sprite is moving to, since I want to be able to change animations, and create a wall block in front of them after they started moving. I am trying to achieve my sprites not overlapping trough each other and not moving on the same place so if I created a block after the sprite has started moving no other sprites could move there at the same time.
Currently I am using a lot of code to determine what direction to move to and "choose(1,2,3,4)" direction so I don't know how I can pick the direction directly because its random.
Basically what I want to do is;
if *sprites started moving to direction x*
--> set animation to x
--> create block at position x
I never added the animations, but I know how to do it by myself if I find a way to determine where and when it started moving.