Registering when touch 2 is pressed inside...not just count = 2

floydianspiralfloydianspiral Member, PRO Posts: 308
edited November -1 in Working with GS (Mac)
So I've tried looking up multitouch solutions but they don't solve my issue really. I'm wondering if there is an explicit way to register if a second touch is pressed inside an actor. It's for my game zeke in orbit so if you watch the gameplay video I basically want people to be able to touch more than one gravity node at the same time and have my cosmonaut accelerate towards both at the same time.

Right now inside my gravity node
Rule: when touch is inside:
-change attribute NodeX/Y > self.positionX/Y
-Change NodePressed > True (boolean)

Inside my cosmonaut
Rule: When NodePressed = True
-Accelerate towards NodeX and Node Y

I have tried having a second rule saying when count=2 and touch is inside, change Node2X/Y to self.position and then using another boolean 2NodesPressed turn true, but this doesn't seem to work. I also can't use touch2x and touch2y because then players can touch anywhere on the screen. I almost want to suggest that gamesalad make it a feature where instead of just when touch is pressed,inside,etc. Why not specify which touch? I believe this could easily make users create multitouch games without going through a whole workaround. Any suggestions on how to fix my problem? I could send you a demo version if you want to as well.

Comments

  • floydianspiralfloydianspiral Member, PRO Posts: 308
  • beefy_clyrobeefy_clyro Member Posts: 5,394
    Could you maybe try the following, i havent tested this, just an idea;

    Create a new game attribute boolean named 2ndtouch for example

    Then have a rule

    If touch.count=2 .. Change attribute ... game.2ndtouch to true
    Otherwise change attribute ... game.2ndtouch to false

    Then on your node have a rule thats is like;

    If ALL is true
    Game.2ndtouch is true
    Mouse/touch is pressed/down
    Mouse/Touch is inside

    Change attribute game.2ndNodeTouched
    Change attributes game.2ndNodeX and 2ndNodeY to self.position X and Y respectively

    Then on your cosmonaut

    If game.2ndNodeTouched is true
    Accelerate ....
  • floydianspiralfloydianspiral Member, PRO Posts: 308
    I tried that as well before and it works kind of. If you place both fingers on the nodes at the same time it will go to the equidistant part of it but if you are holding one down and then place another finger the second nodes acceleration trumps the first. Furthermore if you release the first node's finger, the second node's accel cancels out yet is still animating/making sound.

    What I want is for someone to be able to place their fingers on whatever node and it will accelerate towards it regardless of how many fingers are down. So that people could touch node 1 and accel towards node1x/y or 2nd touch creates another node2x/y and 3, 4, etc but regardless of what touch it is, if someone lets up all fingers except node 3 (for example) the cosmonaut still accelerates towards 3. I'm starting to think this isn't possible with GS as I've tried many other ways like using magnitude to accel towards the midway point, etc. Any Sous Chefs have any words of wisdom?
  • HoneyTribeStudiosHoneyTribeStudios Member Posts: 1,792
    You can't accelerate to two different x positions or 2 different y positions.

    So you'd take the average. i.e. the character would accelerate towards the middle of the two.

    So have your orig game.nodeX
    and also game.Node2X which will be for the second touch.

    And then if 2 touches are detected accelerate towards the average of the two.
Sign In or Register to comment.