How do I display a random image?

Get help using Construct 2

Post » Sat Nov 08, 2014 8:01 am

Hi there,

is it possible to display a random image using an array?
Here's what I would like to create: based upon an existing game where you have to guess which logo is from which company, I have to display random images and let the player guess which image belongs to which company.
Therefore I need a bunch of images to display in a random way.

If the player guesses (through textbox), C2 would also have to check whether it's the right answer. I don't really know how to do this either...

Any help would be appreciated!
Image
B
54
S
24
G
12
Posts: 96
Reputation: 10,316

Post » Mon Nov 10, 2014 4:17 am

You need below things :

1) image sprite
Add all images as frames
Add 1 variable, to store its frame no.

2) array
add relevant frame no and name of logo

3) on start create image instances and pick random frame
store frame no in variable

4) when someone type then scan through array for logo name and check if it compares to right company frame

Hope this helps...
Image
B
50
S
12
G
1
Posts: 254
Reputation: 4,456

Post » Mon Nov 10, 2014 7:49 am

Thanks a lot!
I was looking for the solution in this direction and know for sure that I'm on the right track now!
Image
B
54
S
24
G
12
Posts: 96
Reputation: 10,316

Post » Mon Nov 10, 2014 8:16 am

RJan try this tutorial and you might find what you looking for
https://www.scirra.com/tutorials/1090/using-arrays
B
249
S
39
G
15
Posts: 1,952
Reputation: 40,579

Post » Mon Nov 10, 2014 10:45 am

Thanks Lordshiva1948!

I'll check it out. Saw it is one of your tutorials: always gooood! :-)
Wish I could get a couple of months off from my work so I could go through all tutorials...
Image
B
54
S
24
G
12
Posts: 96
Reputation: 10,316

Post » Mon Nov 10, 2014 11:16 am

Rjan take your time son Rome was not built in day
B
249
S
39
G
15
Posts: 1,952
Reputation: 40,579

Post » Mon Nov 10, 2014 11:54 am

Hahaha. I know, but there's still soooo much to learn... ;-)
Image
B
54
S
24
G
12
Posts: 96
Reputation: 10,316

Post » Mon Nov 10, 2014 1:57 pm

Rjan I am 67 and still learning new things everyday
B
249
S
39
G
15
Posts: 1,952
Reputation: 40,579


Return to How do I....?

Who is online

Users browsing this forum: brunopalermo, MikaelS, nahima and 12 guests