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
42
S
21
G
31
Posts: 685
Reputation: 20,321

Post » Thu Aug 27, 2015 7:10 am

Image
B
64
S
23
G
7
Posts: 1,482
Reputation: 10,825

Post » Thu Aug 27, 2015 7:48 am

@korbaach, thanks for that! That was what I was looking for. Much appreciated!
B
42
S
21
G
31
Posts: 685
Reputation: 20,321


Return to How do I....?

Who is online

Users browsing this forum: No registered users and 7 guests