How can i change Display text to Random and display image for the text?

Hey Guys,
i am making a Quiz and i want know how i can display the text (question) and change the image with the question that is displayed randomly without getting my game bugged !? I tried many different ways i was thinking about a random table
to display my text (questions) but how can i tell my Image Table to change accordingly to the random table ?


  • tatiangtatiang Member, Sous Chef, PRO, Senior Sous-Chef Posts: 11,926

    Use a single table. Enter the questions, answers, and image names in the table as separate columns. For example:

    How much is 3+5?     8     eight.png

    Change an attribute (e.g. game.questionNumber) to random(1,tableRowCount(tableName)).
    Change game attributes to the values in each column to temporarily store them.
    Delete the chosen row.
    Repeat as necessary.

    New to GameSalad? (FAQs)   |   Tutorials   |   Templates   |   Greenleaf Games   |   Educator & Certified GameSalad User

  • dontblockmedontblockme Member Posts: 3
    edited April 2016

    if i do that it doesnt display all my questions and my images wont display according to the question ! i have my question and images tied to each other by telling the image to display the image 1... when question number is 1... so now i want to set my question number to the random table ive set up how can i do that ?

    how can i set the question number to my random table ?

    by the way thanks for the answer tatiang but i looking for something a bit different because the random function always brings some kind of problem with it.

  • The_Gamesalad_GuruThe_Gamesalad_Guru Member Posts: 9,914
    edited April 2016

    You can display text right from a table and you can call an image by name as well. Since you have your images named with a number prefix you can sync it with the table row of the matching question. So you can call the image like this change attribute self.image to game.questionnumber..".png"

    The random issue is fixed in 1.25 and we can now set a seed value. The method @tatiang mentioned is the best method. I just built a quiz app for a client and coded it as he described above. This is a common method for syncing data across a series of column rows and is used for more than quizzes.

  • dontblockmedontblockme Member Posts: 3
    edited April 2016

    Could you please make a tutorial or a screen shot of the rule ?

Sign In or Register to comment.