How do I create object at free location

Get help using Construct 2

Post » Fri Jun 09, 2017 8:42 am

How would i solve this problem the correct/easy way :)

I wan't to create an object every 1 sec at some chosen/random locations (1-20).
If there already is an object at that location a new one should not spawn at that location instead pick any other of the open locations.

This is what i started with:
Every 1 sec :
Set variable "position" - choose(0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19)
Create object "objectname" at 100+(32*"position"), 10

I'm probably overthinking this one. :)
Anyone got any good solution?
B
14
S
3
Posts: 4
Reputation: 860

Post » Fri Jun 09, 2017 11:42 am

You can keep the current position in an array, and add a sub event that checks if the current position exits in the array, if it does recall the spawn position again to chouse another positon.
Like my work? Fallow me on social media, and see my games on the arcade.
B
7
S
5
G
9
Posts: 298
Reputation: 5,367


Return to How do I....?

Who is online

Users browsing this forum: No registered users and 8 guests