Random Image Generation

Get help using Construct 2

Post » Thu Sep 26, 2013 7:46 pm

Hello all:

I have a group of images. Each of these images has a text instance variable.

On load, I want to load a random image. Depending on the image selected at random, I want to load a series of images that are "tagged" with some attributes related to the one that was picked.

So, say on load, I pull an image with an instance variable "green".

I want to load all images that have that instance variable included also. So out of a larger pool of images, I want to pull out the 3 images that have "green" as an instance variable also.

1) How would I randomize the image generation on load?
2) How would I then take that instance variable value and draw only those images that have that variable applied?

Thanks.
B
2
Posts: 2
Reputation: 154

Post » Thu Sep 26, 2013 10:22 pm

Assign an instance variable for each colour
Use rand(min,max) on start of layout to select a random number
Use create object to create all objects with rand as instance variable
B
47
S
17
G
81
Posts: 2,223
Reputation: 48,093

Post » Fri Sep 27, 2013 12:16 am

Thanks. Will give this a look and post my CAPX.
B
2
Posts: 2
Reputation: 154


Return to How do I....?

Who is online

Users browsing this forum: No registered users and 60 guests