Every click an attribute change?? [SOLVED]

BasGoodboyBasGoodboy Member, PRO Posts: 310
edited August 2013 in Working with GS (Mac)
Hello all,

So I made a helpbutton in my app.

On click > change boolean to true
If boolean is true > spawn actor 'gametips'.

So when people click the helpbutton, an actor with gametips spawn..

However, I want it, that if you click it again, the boolean goes off to 0 again, so people can toggle the tips on and off.

How do I make this?

Best regards,

Comments

  • LiquidGameworksLiquidGameworks Anchorage, AKMember, Sous Chef Posts: 956
    This video demonstrates how to do a toggle "on/off" type button
  • artfishartfish Member, PRO Posts: 369
    edited August 2013
    @BasGoodboy

    You Need to add another boolean called changingvisible or something.
    Then create these rules

    Rule-when.touch.is.pressed and game.changingvisible=false
    Change attribute game.changingvisible to true
    Nested rule
    when.changing visible is true
    Change.attriubute.game.tipson to True

    Now to turn it off

    Rule-when.touch.is.pressed and game.changingvisible is false
    when attribute.game.tipson=true
    Change attribute changingvisible to true
    Nested rule
    when attribute.game.tipson=true and game.changingvisible is true
    Change attriubute game.tipson to false

    Also make sure you add this rule

    Rule-When.touch.is.released change attribute game.changingvisible to false
  • ericzingelerericzingeler Member Posts: 334
    edited August 2013
    Make a toggle switch like so:

    attribute:

    switch (index)

    rule:

    on touch pressed, change attribute switch To: (switch+1)%2

    the result is 1 or 0

  • BasGoodboyBasGoodboy Member, PRO Posts: 310
    Thanks a lot guys. You helped me a lot. It worked.
  • ericzingelerericzingeler Member Posts: 334
    Good deal. Make sure to mark this question as answered so others can benefit.
Sign In or Register to comment.