How do I randomly position four sprites?

Get help using Construct 2

Post » Fri Jul 21, 2017 1:14 pm

Hi, I want to place 4 sprites on four positions randomly without overlapping.

x y cordinates:

100-130, 160-130,
130-180, 190-180

How can I do it?
B
13
S
9
G
2
Posts: 23
Reputation: 2,373

Post » Fri Jul 21, 2017 7:05 pm

This is how I would do it in pseudo code -
Global var=0
Pick a random sprite, set object instance var to global var. Add 1 to GV
Repeat 3 times.
You then have 4 sprites with a variable set that is 0, 1, 2 or 3.
Then you relate the instance variables to the co-ords. If 0 then set position to 100,130, if 1 then set to 160,130 etc
B
45
S
15
G
73
Posts: 2,007
Reputation: 43,396


Return to How do I....?

Who is online

Users browsing this forum: leandrogenske, R0J0hound, TylerJS and 9 guests