How do I randomly spawn objects on a specific area?

Get help using Construct 2

Post » Wed May 06, 2015 8:31 am

I'm trying to spawn objects on specific area of the window. The area is basically the whole window minus the border. I use "Create Object" at random(0,layoutwidth), random(0,layoutHeight).I'm having trouble with the object spawning at the very far bottom of the window, where it's difficult to click. I tried decreasing the numbers but I seems like the randomness is skewed to the left side of the window. My first thought was to create a blank sprite with multiple image points to spawn from. Do I have any alternatives before I do this?
B
34
S
19
G
3
Posts: 22
Reputation: 4,437

Post » Wed May 06, 2015 9:43 am

Very simply put:

"Create Object" at random(100,layoutwidth-100), random(100,layoutHeight-100)

So just add the pixels offset from the border you would need (in this case 100)
Unless you want to be even more specific about the "randomness"
I told my dentist I had trouble with my teeth and asked her to fix it without looking in my mouth..
B
54
S
16
G
8
Posts: 6,160
Reputation: 19,775

Post » Wed May 06, 2015 10:46 am

D'oh! I hurt myself with a facepalm. haha, thanks @LittleStain!
B
34
S
19
G
3
Posts: 22
Reputation: 4,437


Return to How do I....?

Who is online

Users browsing this forum: repkino and 8 guests