I was wondering if any of you have an idea on how I could ask a player to enter his/her name and then display it.
Or say something like "Are you ready?" and the player needs to write down 'yes' to continue.
To record a players a name. You can do the following:
Create a new Game.Text Attribute. Lets call this attribute Player Name.
Next, you will need to use the Keyboard Input behaviour. This will need to be activated when you want the player to enter their name.
You want to link it to the Game.PlayerName attribute.
Finally, you need to use the Display Text behaviour. Open the expression editor in the behaviour and select the Game.PlayerName.
I've attached a quick Demo to help.
Note: You might also want to save the attribute if you want it be saved during multiple app openings.
GSLearn.com | Templates | Free Demos | Udemy Course
Wow thank you so much!! I'll try that now, I am super curious! Thank you!
Note that if you are checking user input, text attributes and expressions are case-sensitive. So yes, Yes, and YES are three different values. That means you either need three different rules to check the value or you need to convert the input attribute to a single case.
My preference would be to convert everything (e.g. to lower case) and check once:
Change attribute game.input to game.input:lower()
When attribute game.input is "yes"
[allow the game to continue, etc.]
Note: See this post for more information about the Lua function lower()
If you want everything airtight, you can also strip out spaces from game.input so that "yes" and "yes " are both equal to "yes" but that requires a little more work and may not be necessary for your project.
New to GameSalad? (FAQs) | Tutorials | Templates | Greenleaf Games | Educator & Certified GameSalad User