random pictures quiz

0 favourites
  • 5 posts
From the Asset Store
500 monsters and creatures images for card games - Set 1
  • 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


    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.

  • 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

  • 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?

  • 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.

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • Ok, thank you very much, I will try it!

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)