How do I Random Pro spawn

Get help using Construct 2

Post » Fri Jun 10, 2016 12:11 am

How can I get it to where it spawns props randomly and stays the same when leaving and revisiting the same layout

Like Online with Random Generated Layouts
B
55
S
33
G
19
Posts: 67
Reputation: 14,412

Post » Fri Jun 10, 2016 2:39 pm

Using the PERSIST behaviour for any object will make it "remember" where it was when you left the layout and then returned later.

As far as placing objects randomly, just set X coordinate and Y coordinate to;

->Create object at
X = random(layoutwidth)
Y= random(layoutheight)

This is obviously a very basic example of random placement, but you should get the idea. That code would create the object anywhere on the layout based on it's size. You could use specific numbers if you wanted the objects to appear in a localised spot (maybe only on one side of the layout, or perhaps outside the layout?)

~Sol
Tired of crappy file hosts that are crappy? Get DROPBOX - https://db.tt/uwjysXJF
Moderator
B
84
S
34
G
40
Posts: 3,032
Reputation: 30,499


Return to How do I....?

Who is online

Users browsing this forum: No registered users and 8 guests