Quiz: Help please?

natclarkenatclarke Brisbane, AustraliaMember, PRO Posts: 243
I am designing a baby quiz to determine if the mother to be is having a boy or a girl.
There will be 25 questions (one on each scene).

On each scene there are 2 answers : One for a boy and one for a girl.

How do I create it so that it calculates what the person picks and shows a % of chance of having a boy or a girl on the final scene?

Any assistance would be appreciated.

regards
Natalie

Nat Clarke
Life Cleansing

Comments

  • gyroscopegyroscope I am here.Member, Sous Chef, PRO Posts: 6,598
    edited January 2013

    @natclarke

    Hi Natalie, basically you need two integer attributes, let's call them BoyScore and GirlScore. Two buttons on each scene, in the Rules each, put:

    When touch is pressed
    Change Attribute BoyScore to BoyScore +1

    ---and in the second one

    When touch is pressed
    Change Attribute GirlScore to GirlScore +1

    Make another attribute, text this time, called Gender

    At the end of the quiz, in Rules somewhere:

    When BoyScore > GirlScore
    Change Attribute Gender to Boy
    Otherwise
    Change Attribute Gender to Girl

    ----

    The above assumes there will be an odd number of questions....

    That's roughly it, hope it helps.

    ""You are in a maze of twisty passages, all alike." - Zork        temp domain http://spidergriffin.wix.com/alphaghostapps

  • natclarkenatclarke Brisbane, AustraliaMember, PRO Posts: 243
    Thanks for the support. It works great. How do I create the totals at the end in % for a boy or a girl? There are 25 questions so it can be made into a % I hope!

    Greatly Appreciated!
    Nat

    Nat Clarke
    Life Cleansing

  • SocksSocks London, UK.Member Posts: 12,822
    Thanks for the support. It works great. How do I create the totals at the end in % for a boy or a girl? There are 25 questions so it can be made into a % I hope!

    Greatly Appreciated!
    Nat
    The score for each sex x 4 = the percentage.
  • natclarkenatclarke Brisbane, AustraliaMember, PRO Posts: 243
    What attributes do I need to add and where?

    I have done this so far:

    two integer attributes, let's call them BoyScore and GirlScore. Two buttons on each scene, in the Rules each, put:

    When touch is pressed
    Change Attribute BoyScore to BoyScore +1

    ---and in the second one

    When touch is pressed
    Change Attribute GirlScore to GirlScore +1

    Make another attribute, text this time, called Gender

    At the end of the quiz, in Rules somewhere:

    When BoyScore > GirlScore
    Change Attribute Gender to Boy
    Otherwise
    Change Attribute Gender to Girl

    Nat Clarke
    Life Cleansing

  • natclarkenatclarke Brisbane, AustraliaMember, PRO Posts: 243
    I have discovered the answer. Thanks to the great people out there who give up their time to assist. I am very grateful.

    You keep track of the score with a game attribute such as game.Score (type integer or index). Each time the player answers correctly, do Change Attribute game.Score to game.Score+[button value].

    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).

    Nat Clarke
    Life Cleansing

  • SocksSocks London, UK.Member Posts: 12,822


    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).
    . . . Or you could just type: game.score*4

  • natclarkenatclarke Brisbane, AustraliaMember, PRO Posts: 243
    Thanks Heaps!

    Nat Clarke
    Life Cleansing

  • natclarkenatclarke Brisbane, AustraliaMember, PRO Posts: 243
    I have added tables to my project with the following columns:

    question, Answer A and Answer B and an integer column called Solution (Either a 1 for a girl and 2 for a boy in the column)

    On the scenes I have two possible the questions and answers submitted. ie.

    The ring moves:

    side to side (It is a boy)
    in circles (It is a girl)

    Next to each answer there is a white baby footprint to press. I would like to link it to my table rather than manually going in change the image to a blue or pink footprint if the answer is related to either a boy or girl.

    How would I go about doing that? I have been searching on tutorials for 5 hours!

    Thanks
    Natalie

    Nat Clarke
    Life Cleansing

  • tatiangtatiang Member, Sous Chef, PRO, Senior Sous-Chef Posts: 11,949
    Hey that earlier quote about %s looks familiar... :)

    One way to change the image is to have two images in your library called 1.png and 2.png. Then, do Change/Constrain Attribute self.image to tableCellValue(TableName,Row,"Solution"). If the value in the "Solution" column is 1, it will show 1.png, if 2 it will show 2.png.

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

  • SocksSocks London, UK.Member Posts: 12,822
    edited January 2013
    Hey that earlier quote about %s looks familiar... :)
    Yeah, it's the quote you copied when you posted in that other thread.

    :)) ;)

    (Joking!!)
Sign In or Register to comment.