Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #440064 Score: 0
    Profile photo of Therese Michael
    Therese Michael
    Member
    beginner
    intermediate
    curious george
    wise owl
    friend finder
    contributor
    picture perfect
    @tmichael9734

    Hi Everyone,

    I’m designing a game where users roll two dices and then pick the question to answer. Rolling the dices activates all questions’ buttons.  Is there a way to activate only the button that associates with the total numbers on the dice tiles? For example, if the total number of dice tiles shows 10, then question 10 only becomes active.

    I know this needs a variable, but I was not able to reach to it thus far.

    Thank you,

    #440068 Score: 0
    Profile photo of Tim K
    Tim K
    Member
    contributor
    beginner
    intermediate
    advanced
    friend finder
    junior moderator
    advocate
    wise owl
    curious george
    Group Member
    333 pts
    @timk

    How did you program the dice … without variables to decide which value each shows?

    #440148 Score: 0
    Profile photo of Therese Michael
    Therese Michael
    Member
    beginner
    intermediate
    curious george
    wise owl
    friend finder
    contributor
    picture perfect
    @tmichael9734

    Thank you Tim.  Here’s what I did:

    1- Saved images for each tile of each dice.

    2- Grouped the 6 images and called them Dice 1; same with the other 6 images and called them Dice 2

    3- Created 2 variables and called them Dice 1 and Dice 2

    4- On the Roll button I added actions to Modify the Variable of Dice 1 to set to Random (0,6), and then Change Content of the dice image to the side image if the dice variable is equal to 1, 2, etc.  For instance: Change Content, Target: Dice, Resource: Dice-side 1 If Dice_1 (the variable) is Equal to 1; and so on. (please see attachments).

    So basically, I didn’t use calculations to roll the dice. I just enabled and disabled the questions buttons with the click on the Rolling button, and used the Move to action to move the dice while rolling.

    Now, I want to do some math and enable only the question when the sum of the two dices’ sides is equal to the number of question.  For example, the two dices’ total is 6, then question 6 becomes active.

    How do I do that?

    Thank you

    #440174 Score: 0
    Profile photo of Tim K
    Tim K
    Member
    contributor
    beginner
    intermediate
    advanced
    friend finder
    junior moderator
    advocate
    wise owl
    curious george
    Group Member
    333 pts
    @timk

    So, you do know how variables work… the math part is simpler than what you’ve got so far. Just create a third variable, e.g. “Both_Dice”, and two actions after those that randomly set the two dice:

    On: Click
    Action: Modify variable
    Target: Both_Dice
    Type: Set equal to
    Value: VAR(Dice1)

    On: Click
    Action: Modify variable
    Target: Both_Dice
    Type: Add to variable
    Value: VAR(Dice2)

    … make sure it matches the correct names, yours won’t have blanks have they?

    “Both_Dice” now contains the sum of the two value.

    Then add actions similar to those changing the images:

    Action: Set state
    Target: Button 1
    State: Enable

    If “Both_Dice” equal to “1”

    You’ll need 1 for each button / for each value “Both_Dice” might have.

    #440186 Score: 0
    Profile photo of Therese Michael
    Therese Michael
    Member
    beginner
    intermediate
    curious george
    wise owl
    friend finder
    contributor
    picture perfect
    @tmichael9734

    That was easy!!!

    Thanks a lot Tim, that solved the problem and assigned the dices to the correct question numbers.

    Thank you so very much,

     

Viewing 5 posts - 1 through 5 (of 5 total)

You must be logged in to reply to this topic.