How do I create grid of random but not repeating objects

Get help using Construct 2

Post » Thu Aug 27, 2015 6:42 am

Let's say that I have 9 different objects in the game. And I want to place them randomly on a 3x3 grid, and each object can only be represented once on the grid. What are the most efficient ways to do this?

I tried creating a 3x3 grid of dummy objects, and on the start of layout, manually set each object to pick a random dummy object as its location and delete that dummy object, but it only worked well for the first few, after that they weirdly overlapped each other.

I was think maybe an array, but I am having problems with that as well as I don't know how to remove a number that has been chosen from the random event.

Would greatly appreciate any help and advice or even if you think there is a better approach to this.
B
46
S
23
G
31
Posts: 693
Reputation: 20,637

Post » Thu Aug 27, 2015 7:10 am

B
67
S
24
G
7
Posts: 1,518
Reputation: 11,072

Post » Thu Aug 27, 2015 7:48 am

@korbaach, thanks for that! That was what I was looking for. Much appreciated!
B
46
S
23
G
31
Posts: 693
Reputation: 20,637


Return to How do I....?

Who is online

Users browsing this forum: acousticputty and 29 guests