Help with matching.

DazegammingDazegamming UsaMember Posts: 2

I'm a complete rookie at this. It's probably an easy task. Well here it goes I need to match a picture actor to a display text actor. Say the word dog comes up you're to choose the images of dogs out of different images of animals and so on another word. Any advice?

Comments

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

    Let's say you had a list of words with each word as a separate row in a table (all in column 1). Let's also say you created a text attribute called game.word to store the current word and an integer attribute called game.row to store the current row. Each turn/round, you would change attribute game.row to random(1,tableRowCount(tableName)). You would then change attribute game.word to tableCellValue(tableName,game.row,1). Optionally, you could then delete the row at index game.row to prevent duplicate selections later on.

    You'll also need to set or at least know the filename of each image. Let's assume that you named the images, dog.png, cat.png, alligator.png, etc. and that your table contains:

    dog cat alligator

    You could constrain self.Image to game.word. To test for a match, you would have a rule that says If attribute self.Image = game.word then [it's a match!]

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

Sign In or Register to comment.