Rule for Number sequence

mikbiomikbio Member Posts: 54
edited December 2011 in Working with GS (Mac)
I need to add a couple of rules to change the images for my howto page. How do i create a button that once clicked it changes an atribute from 0 to 4?I mean every time i click this button i would like that GS changes the atribute "Howtopage" from 0 to 1, from 1 to 2, from 2 to 3, from 3 to 4 and then stops. It's there a way to do that?

Comments

  • POMPOM Member Posts: 2,599
    edited December 2011
    Yes, sure its possible,
    Make a game attribute , integer, call it "how to page number"
    Now make a background actor with the initial image , in that actor make a rule,

    First change "game.how to page number" to 1 ( so the first image will come up every time)
    When touch is pressed:
    Change "game.how to page number" TO "game.how to page number" + 1

    Now make rules like this:
    When "game.how to page number" = 1
    Change image to the first image.

    When "game.how to page number" = 2
    Change image to the second image.

    And so on..
    Then when "game.how to page number" = 5
    You can change scene back to the menu!

    Hope it helps you.
    Roy.
  • SlickZeroSlickZero Houston, TexasMember, Sous Chef Posts: 2,870
    One way is to create a 'real' attribute, and every time the button is clicked, add one to the attribute. "When 'touch' is pressed.change attribute'Howtopage' to 'Howtopage'+1 Then have a rule that says When 'attribute' 'Howtopage' > 4 Change attribute 'Howtopage' to 0 or 1 or 2 or 3 or 4.

    And I think Tshirt has a tutorial on how to do counting like this with just math expressions that would probably be more efficient. I don't know how to do it without looking at it myself.
  • morphinegamingmachinemorphinegamingmachine Member, PRO Posts: 449
    ok question, why mess with the %4?
    when adding +1 would be perfectly fine? is there a better response in game salad to multiplying it by a %?
Sign In or Register to comment.