How do I spawn an enemy at a random position in the scene?

Get help using Construct 2

Post » Sat Nov 21, 2015 6:32 pm

I've been trying to figure out how to spawn an enemy object into the scene at a random position without spawners. Could anyone please help? Slightly new to C2.
B
3
S
1
Posts: 8
Reputation: 362

Post » Sat Nov 21, 2015 6:40 pm

Instead of giving a x and y cords... you can do something like this...

random(1,2,3,4)
for both of the cords... that way it will pick between those cords, and spawn the enemy there!
Eat ALL THE BACON!
B
44
S
17
G
3
Posts: 289
Reputation: 4,966

Post » Sat Nov 21, 2015 6:40 pm

What is the scene?
Do you mean the Layout or the Viewport?

To get a random value you can use the random() expression
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 » Sat Nov 21, 2015 6:46 pm

random(layoutwidth)
random(layoutheight)
Risk Rocket now available on Google Play
Image
B
35
S
15
G
6
Posts: 337
Reputation: 6,275


Return to How do I....?

Who is online

Users browsing this forum: No registered users and 5 guests