Go to random set location that isn't occupied

Get help using Construct 2

Post » Thu Jun 18, 2015 6:55 am

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?
Posts: 2
Reputation: 179

Post » Thu Jun 18, 2015 9:50 am

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.
Posts: 1,182
Reputation: 6,848

Post » Mon Jun 22, 2015 8:26 pm

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.
Posts: 2
Reputation: 179

Return to How do I....?

Who is online

Users browsing this forum: avatar45 and 8 guests