Touch Functions... Pressed Released etc...

cwbh10cwbh10 Member Posts: 52
edited November -1 in Working with GS (Mac)
When I have one touch down (Controlling movement) and I want the other touch to do an action when release it won't let me. I hope that we can specify which touch number (1-11) that we want the rule to check for a release or pressed.

This is quite important to my game, and I feel like it should be an option. :)

Comments

  • AsymptoteellAsymptoteell Member Posts: 1,362
    when touch count is 2, change global attribute to 1. When global attribute is 1 and touch count is <2, change attribute global attribute to 0 and DO WHATEVER YOU NEED IT TO DO.
  • cwbh10cwbh10 Member Posts: 52
    what?
  • tenrdrmertenrdrmer Member, Sous Chef, Senior Sous-Chef Posts: 9,934
    in the attributes under devices there is touches and count.

    you need to setup a rule

    When game.touches.count = 2
    --change game.action to 1

    a second rule

    When game.action = 1
    and game.touches.count < 2
    --your desired action here
    --Change game.action to 0
  • cwbh10cwbh10 Member Posts: 52
    Sorry, I still am not getting this. I work better with examples. Perhaps you could make one? :S

    Thank you.
  • marksmarks Inactive, Chef Emeritus Posts: 14
    I believe tenrdrmer is indicating that you should use an attribute, not an "actor receives event", to control what you want to do. This is done by counting how many touches are down at any time, and when it goes from two to one it knows that the second touch has just released and your action can take place.

    Rule:
    When Attribute game.touches.count = 2
    change attribute [touchcount] to equal 1

    Rule:
    When attribute [touchcount]=1 AND attribute game.touches.count<2
    behavior: action you want to take place
    change attribute [touchcount] = 0

    You'll need to create an attribute (I called it touchcount, he called it game.action), and set it to 0 initially. Put the behaviors / rules that control what happens when the second touch is released into the first rule where I wrote "action you want to take place".

    The final "change attribute" behavior is to reset it so when the second touch goes down again it can detect when it is removed.
  • cwbh10cwbh10 Member Posts: 52
    Ohhhh! I get it now! Thanks everyone for explain this to me! Thank you Marks for making it quite detailed and for taking the time out of your day to respond. Right now i have it covered with a Timer, but this will work much better! :)

    So back to the topic, do you believe this might be put into a GameSalad Update?

    Special Thanks to: Asymptoteell, tenrdrmer, and Marks!
Sign In or Register to comment.