Making random phrases appear on screen
ucorn
Member Posts: 12
Hi all,
I'm new to GameSalad but am really grateful this software exists for rookies like me. I'm working on a scene where random phrases need to appear on screen, but I'm a bit lost.
After the game ends, and final score appears, I've put in a new scene where an actor will appear and say a random phrase/line (out of a total of 20 such remarks/phrases) about the performance of the gamer. I know I have to put in an actor that displays text, but I don't know how to spawn random phrases so it's not the same line that comes over and over again.
Any guidance will be very valuable.
Thanks!
I'm new to GameSalad but am really grateful this software exists for rookies like me. I'm working on a scene where random phrases need to appear on screen, but I'm a bit lost.
After the game ends, and final score appears, I've put in a new scene where an actor will appear and say a random phrase/line (out of a total of 20 such remarks/phrases) about the performance of the gamer. I know I have to put in an actor that displays text, but I don't know how to spawn random phrases so it's not the same line that comes over and over again.
Any guidance will be very valuable.
Thanks!
Comments
Then you can just do in your Display Text behaviour:
tableCellValue(game.tblPhrases, random(1,X), 1)
where X is your maximum number of rows.
The 1st parameter is your Table's name, the 2nd is the Row number, and the 3rd is the column number.
The random(x,y) function gives you a random value from x to y.
Also remember to select your table's name from the navigator inside the Expression Editor. It will produce an error if you type it in manually.
New to GameSalad? (FAQs) | Tutorials | Templates | Greenleaf Games | Educator & Certified GameSalad User