Questionaire. Please help!!
natclarke
Brisbane, AustraliaMember, PRO Posts: 243
I am creating a quiz with 10 questions and scenes.
On each scene there are three buttons to press for the answer. Button 1 (10 Points), Button 2 (5 Points) & Button 3 (0 points)
How do you total up the score on the final page to show a final total out of 100 (%)
What attributes are required so that it works well?
Thanks for your help.
On each scene there are three buttons to press for the answer. Button 1 (10 Points), Button 2 (5 Points) & Button 3 (0 points)
How do you total up the score on the final page to show a final total out of 100 (%)
What attributes are required so that it works well?
Thanks for your help.
Nat Clarke
Life Cleansing
Comments
On the final page, add an actor with a DisplayText behavior, click on the expression editor (the 'e' button) and type this: floor(game.Score/game.PossiblePoints*100).
You can substitute an actual number for game.PossiblePoints if you prefer. Floor rounds the number down, while Ceil rounds it up. You can also concatenate a percent symbol by typing the formula above and adding .."%" after it (include those two periods).
New to GameSalad? (FAQs) | Tutorials | Templates | Greenleaf Games | Educator & Certified GameSalad User
Nat Clarke
Life Cleansing
Nat Clarke
Life Cleansing
New to GameSalad? (FAQs) | Tutorials | Templates | Greenleaf Games | Educator & Certified GameSalad User
You can check the value of game.devices.touches and only allow a guess if it is equal to one.
Where do you go? Is it under devices? Do I need to add a new attribute?
thanks
Nat
Nat Clarke
Life Cleansing
The rule would be:
When [All] conditions are valid
.....Touch is Pressed
.....attribute game.Touches.Count = 1
..........[check for correct answer]
Keep in mind that if the player taps the correct answer while touching some other part of the screen (not another incorrect answer), that rule will not run and nothing will happen. That's somewhat unlikely to happen, but it's certainly possible.
If you want a tighter rule, you might do something like:
[create an attribute game.numberOfTouches (index or integer) and set it to 3
When Touch is Pressed
.....change attribute game.numberOfTouches (integer/index) to game.numberOfTouches+1
Otherwise
.....change attribute game.numberOfTouches to game.numberOfTouches-1.
When [All] conditions are valid
.....Touch is Pressed
.....game.numberOfTouches=1
..........[check for correct answer]
*The reason that the attribute is set to 3 initially is because each actor is subtracting 1 when not touched, so when no actors are touched, the value of that attribute is 3-3=0. When one actor is touched, 3-2=1; when two actors are touched, 3-1=2; when three actors are touched, 3-3=0.
New to GameSalad? (FAQs) | Tutorials | Templates | Greenleaf Games | Educator & Certified GameSalad User
When [All] conditions are valid
.....Touch is Pressed
.....game.numberOfTouches=1
..........[check for correct answer]
I can not find under attributes when touch is pressed or check for the correct answer. Do I have to create an attribute for these?
Nat Clarke
Life Cleansing
[check for correct answer] is where your code goes. And yes, you would need to create at least one attribute. If this is your first app with GameSalad, you might want to start with someone a bit simpler until you have the basics down (e.g. Touch conditions).
My tutorials may be of help: http://tinyurl.com/GameSaladTutorials, as well as the Cookbook and GSHelper.com tutorials.
New to GameSalad? (FAQs) | Tutorials | Templates | Greenleaf Games | Educator & Certified GameSalad User