Measure Swipe distance on a specific touch

BigDaveBigDave Member Posts: 2,239
edited December 2016 in Working with GS (Mac)

So i got typical platformer controls.
But one of the buttons activated by swiping it upwards a secondary behaviour.
This works fine as long the player does not use any other button at the same time.
As it starts taking the distance value of that second touch or first touch corrupting the distance from the actual touch it should measure.

How?

Comments

  • IceboxIcebox Member Posts: 1,485

    I think you will need multi touch for this , to see which touch is active , not entirely sure though , you can find tutorials on youtube

  • Two.ETwo.E Member Posts: 599

    Can you just use the "any" function in the rule... And add in extra conditions for all touch numbers.
    So just check if any of the touch distances is equal to your value.

  • fmakawafmakawa Member Posts: 567

    @BigDave @Armelline has a comprehensive touch factory template that highlights measurements etc for a lot of swipe stuff. Check out his website. http://www.armelline.com/Templates/The%20Swipe%20Factory.zip

  • RossmanBrothersGamesRossmanBrothersGames Member Posts: 659
    edited December 2016

    I use swipe controls on just on side of the screen, you could use similar principles to tie it to a single button.

    Take the x coordinates on your button, lets say the left side of the button is at 300 the right side is 400.

    Then

    When button is pressed

    If touch1 x > 300 and <400
    Change attribute buttoncontrolledbytouch1 to true

    If touch2 x > 300 and <400
    Change attribute buttoncontrolledbytouch2 to true

    Then check for swipes in touch1 or in touch2 depending on which attribute is true

    If your game uses more than two touches then just add more of these rules

    You will also need rules to turn the attributes off when they aren't being touched

    You could also contain the data in a single attribute using integer 0 being the button is not being pressed
    1 pressed by touch 1
    2 pressed by touch 2

  • The_Gamesalad_GuruThe_Gamesalad_Guru Member Posts: 9,922

    When the button is pressed you can see which touch it is using the touch game level booleans. I have a thred somewhere with my multitouch controls that can track all 11 possible touches.

  • BigDaveBigDave Member Posts: 2,239

    thanks guys sounds. thats so helpful tips here.
    so tomorrow I try this again.

    I think I go with something like if button is pressed use the current touch (save it to actor variable) count to determine the y distance

  • BigDaveBigDave Member Posts: 2,239
    edited December 2016

    hm there is one further problem.

    Even tough i get the current touch number count.
    I can Not define it is this touch number withought making rules right?
    I cant assign it via expression directly.

    Thats my currently working rule - > as long no other touch is down.

  • BigDaveBigDave Member Posts: 2,239

    i can do it via rules tough, maybe its good enough. A bit more code as if it were possible directly via expression.

  • The_Gamesalad_GuruThe_Gamesalad_Guru Member Posts: 9,922

    @BigDave said:
    i can do it via rules tough, maybe its good enough. A bit more code as if it were possible directly via expression.

    Yes you need to use a rule. It won't be an issue as the other rules will be ignored if they are not active.

  • BigDaveBigDave Member Posts: 2,239

    @The_Gamesalad_Guru
    alright thanks buddy

Sign In or Register to comment.