(Solved)How do I choose random movements within a grid

  • 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!

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)