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?
Check out my first word hex game: Hexagon Game
B
16
S
9
G
2
Posts: 25
Reputation: 2,454

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
47
S
18
G
84
Posts: 2,271
Reputation: 49,796


Return to How do I....?

Who is online

Users browsing this forum: dop2000 and 13 guests

cron