button help

as7494as7494 Member Posts: 70
edited November -1 in Working with GS (Mac)
How can i make a button that actually stays either touched up or touched down? I want my button lets say to be able to keep value and change certain attributes when its pressed down without it coming back up immediately after the touch is released? I tried using rules with and without the otherwise statement, but I cant get this behavior. Can anyone help?

Comments

  • simo103simo103 Member, PRO Posts: 1,331
    not exactly sure what you're asking. Generally there is two parts to a button click:

    1. The image animation (if there is one) and
    2. The rules set in that actor

    If the rule is 'when actor is pressed' and you then have it set an attribute to a value it will not change unless you tell it to in the otherwise or another rule to say 'when that actor is released'. IE set it on touch and it will stay that way even if you release the button.

    However it appears you are talking about the visual of the button and I therefore suspect you have an animation on the button actor so all you would have to do is to remove the images in that animation that have it pop back up ie: leave only the down pressed images in the animation
  • msonesmsones Inactive, Chef Emeritus Posts: 75
    might help - it uses a "red" and "green" button, but you could easily use images that were "pressed" and "unpressed", etc.
  • UtopianGamesUtopianGames Member Posts: 5,692
    Another way would be to make a game.button integer and leave it set to 0 (name it what you like) then have 2 rules:

    Rule1: If game.button > 1 change attribute game.button to 0

    Rule2: If touch is inside change attribute game.button to game.button+1

    Then do what ever you want when game.button is at 0 and game.button is at 1.

    This is the way i do it for sound on off for eg but TSB's works great too.

    Darren.
  • as7494as7494 Member Posts: 70
    thank you guys
Sign In or Register to comment.