How To Make Touch Not Hold?

MattcusMattcus Member Posts: 85
edited June 2014 in Working with GS (Mac)

I'm kind of stumped on this at the moment. My game involves taping the correct button that corresponds to what it being shown, then the one shown changes. However if someone holds the button down, if the next one would be incorrect it treats it like you got it wrong. Does this make sense? I'm not really sure how to word it, but anyway. This is how it works at the moment:

I have an integer attribute "attack" which when the button is pressed changes that attribute to 1,2,or 3 depending on which button it was. The 'enemy' actor (The thing that you have to choose the correct button to defeat) is destroyed if attribute "attack"
is correct, depending on what the enemy actor is, then once destroyed it spawns another one which could be different and would need a different button to be pressed.

The problem is if you hold the button down for to long, and the next enemy would be incorrect, you lose a life. I need a way so that holding the button down doesn't do anything to the next enemy, only the first one.

I hope you can understand what my problem is here, and how to help. Any help on this would be greatly appreciated.

Thanks

Best Answer

Answers

  • gyroscopegyroscope I am here.Member, Sous Chef, PRO Posts: 6,598
    edited June 2014

    Edit: programming below is incorrect - amendments explained later in this thread.

    Hi @Mattcus Off the top of my head, try something like:

    a Boolean attribute, let's call it SelectGo

    Just after your Touch Rule in each button, add

    Change Attribute SelectGo to true

    Now the other behaviours take outside of this touch rule in each case, in its own Rule:

    Rule: When Attribute SelectGo is true
    --- your stuff to change to show/change
    

    and add in each button:

    Rule: When Touch is released
    Change Attribute SelectGo to false
    

    ""You are in a maze of twisty passages, all alike." - Zork        temp domain http://spidergriffin.wix.com/alphaghostapps

  • MattcusMattcus Member Posts: 85

    Thanks for the reply, however that doesn't seem to work. It still does the same thing it did before.

  • gyroscopegyroscope I am here.Member, Sous Chef, PRO Posts: 6,598
    edited June 2014

    OK, mine was an educated guess without seeing any actual programming, obviously didn't work out in this case: personally the only way I'll be able to help now, is if I saw your programming where you've identified your problem. (Or even your full game file).

    Or hopefully someone else can help you.

    ""You are in a maze of twisty passages, all alike." - Zork        temp domain http://spidergriffin.wix.com/alphaghostapps

  • MattcusMattcus Member Posts: 85

    Ok, After a bit of messing around I've gotten it to work now. I used Armelline's suggestion to have it trigger after the button is released, not pressed. I don't why I didn't think of it before, because it seems so obvious now. Thanks for the help guys.

  • gyroscopegyroscope I am here.Member, Sous Chef, PRO Posts: 6,598
    edited June 2014

    Glad it worked out, @Mattcus, with the suggestion from @Armelline.

    For the record for other users who might have a similar problem, my solution does work - I've used that little "system" quite a few times in the past; it's quite "watertight". (So I don't know why it didn't work for you in your case).

    So if anyone else wanted the "reactions" to still happen on touch pressed, the way I showed is one way to avoid repeated actions if that's happening but you don't want that:

    i.e the touch pressed making a boolean set to to true; then a separate rule: when the boolean is true, do your thing, and that'll work once only as required.

    @gyroscope said:
    a Boolean attribute, let's call it SelectGo1

    Just after your Touch Rule in each button, add

    Change Attribute SelectGo1 to true

    Now the other behaviours take outside of this touch rule in each case, in its own Rule:

    Rule: When Attribute SelectGo1 is true
    --- your stuff to change to show/change
    

    and add in each button:

    Rule: When Touch is released
    Change Attribute SelectGo1 to false
    

    ""You are in a maze of twisty passages, all alike." - Zork        temp domain http://spidergriffin.wix.com/alphaghostapps

  • gyroscopegyroscope I am here.Member, Sous Chef, PRO Posts: 6,598
    edited June 2014

    @Mattcus

    Hang on, I see where I've gone wrong!!! I forgot to mention You'll need a separate boolean for each button.... darn, drat & poodles.... sorry..... (now I know why it didn't work for you...)

    So I'll amend above to SelectGo1; make new booleans SelectGo2, SelectGo3, etc., for each of the other buttons, it'll definitely work then...

    ""You are in a maze of twisty passages, all alike." - Zork        temp domain http://spidergriffin.wix.com/alphaghostapps

Sign In or Register to comment.