How to create double click button?

MaestroKaizersMaestroKaizers Member Posts: 6
edited January 2012 in Working with GS (Mac)
Hi, in my game for iPhone i want to have a actor.
When the actor is touched, it will spawn another actor in upper right corner that says remove.
When you click the remove button, it will remove both main actor and itself, and then reset all attributes to 0.
But, i also want to have that when the main actor is pressed once, the remove button pops up.
But when the main actor is pressed while the remove button is in the screen, it will only remove the "remove" button, and reset all attributes to 0.

I have tried some ways to do this.. But i just cannot come up with a good solution.

Comments

  • coojamcoojam Member Posts: 26
    So basically the behaviour you want is for the main actor to toggle the remove button's visbility on and off? (so first click turns it on, second click turns it off?)

    • Create a boolean scene attribute called something like "Remove Button Visible"
    • Create a rule on your main actor that says:
    If Actor is touched
    • Create a rule within that rule that says
    If "Remove Button Visible" = false
    Change Attribute "Remove Button Visible" to "true"
    Otherwise
    Change Attribute "Remove Button Visible" to "false"

    That *should* work. It might possibly put it in a loop of setting it to true and false, in which case create another rule alongside the second one (within the first one) that changes it to false if the remove button visible attribute is already true.

    Hope that helps!
  • The_Gamesalad_GuruThe_Gamesalad_Guru Member Posts: 9,922
    That's why I tend to use an index with 1 0 2 so zero is nothing and so you switch between 1 and 2.
  • coojamcoojam Member Posts: 26
    Yes I was thinking that and started typing it out, but thought the above solution would be simpler... then realised the possible issue :D
  • MaestroKaizersMaestroKaizers Member Posts: 6
    edited January 2012
    Ahaaaa! I have never been thinking about that you can actually put a rule into another rule ! lol :P
    Thx for help mate ;)
    Cheers :D
  • MaestroKaizersMaestroKaizers Member Posts: 6
    I finally made it :P
    I found out that the simplest way to do it is the way that @FryingBaconStudios mentioned, this also solved the problem with the looping, tho i had to create 2 index attributes.

    Thx for help ;)
Sign In or Register to comment.