What I am trying to do is this:
There is a 5 x 5 grid with dots in the middle. A sprite will be randomly spawned and than randomly move to a neighboring dot. It can only move right, left, up, down. It cannot go outside the grid area and it cannot go to a dot from which it previously came from.
I am now using collision detection and checking conditions to control the movements, but I am getting weird and inconsistent results, which is why I am having trouble pinpointing what is wrong. I've included the capx below.
Or perhaps there is a more efficient and simple way to achieve the results?
Would appreciate any help. Thanks guys!