Go to random set location that isn't occupied

0 favourites
  • 3 posts
From the Asset Store
The ultimate voice pack filled with 1,536 files of .......wav and mp3 of individual numbers, letters, and words (that go
  • I have bullet type enemy sprites being created offscreen, and when it's created I want it to randomly move straight to one of the set positions I have on screen and stop there. The main thing I can't figure out is how get it to not chose a position that another enemy is currently at.

    So on enemy creation, I want it to only choose one of the unoccupied locations to go to.

    How can I go about doing this?

  • An easy way to do it is to make an invisible "tracker" sprite so when your enemy have chosen a location to go to. You use the tracker to see if the location is free. Can do that by doing a "Tracker is overlapping enemy" and if that is true you make your newly created enemy find a new location etc.

    Or you can use the tracker to find a valid location and when it does you throw that to the newly created enemy.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Thanks a lot. I took me a while to get things working without other issues, but thanks to your advice about using a "tracker" sprite to check the locations, I seem to have gotten things set up the way I want it.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)