random pictures quiz

Just started using Construct 2? Post your questions here

Post » Mon Oct 02, 2017 6:46 pm

Message: kiki4construct can only post plain text URLS until they have 500 rep. 1 URLS modified. Why?
Hello, i would appreciate it if you'd share some ideas on
how can i create a quiz game that displays 3 random pictures
on start of layout and on picture click.
One picture of the displayed three, will contain the correct answer and must not be displayed again.
Also the images should be placed in three random spots.
Here is how I am starting
https://www.dropbox.com/s/dzy0eomffxhi40p/i.PNG?dl=0
I have an instance variable for each image to indicate it as correct or false.
I intend to delete the round(rand(0,array.width)) variables on each display.
B
5
Posts: 4
Reputation: 237

Post » Tue Oct 03, 2017 5:24 am

You don't need arrays. And if you want to do it with arrays, use For loops to populate them.

Also, you shouldn't have separate sprite object for every type of picture. Use one sprite with different frames or animations.
If you want to have different objects, add them to a family for easier management.

Here is a little demo I made:
https://www.dropbox.com/s/mhyhuexih8stj ... .capx?dl=0
Check out my awesome game Doptrix
B
17
S
9
G
50
Posts: 829
Reputation: 27,967

Post » Tue Oct 03, 2017 11:12 am

Thank you so much, it helped a great deal. I implemented your solution but I set isCorrect in the Layout view to be true for the images that i know that are the correct ones. It works but the problem is that more than one correct image gets displayed on the screen. Should i create a different set of instances for the correct images?
B
5
Posts: 4
Reputation: 237

Post » Tue Oct 03, 2017 11:29 am

I didn't know how you were going to select 3 sprites, so I made it random.
You can do it differently.

Keeping all instances of the sprite off-screen and then moving 3 to the screen works for a small number of pictures.
If you have lots of pictures, it will probably be better for each round to create (spawn) 3 instances of the sprite, set the right frame/animation/tag for each of them and set isCorrect=true for one of them.
Check out my awesome game Doptrix
B
17
S
9
G
50
Posts: 829
Reputation: 27,967

Post » Tue Oct 03, 2017 12:47 pm

Ok, thank you very much, I will try it!
B
5
Posts: 4
Reputation: 237


Return to Beginner's Questions

Who is online

Users browsing this forum: No registered users and 2 guests