Measure Swipe distance on a specific touch
BigDave
Member Posts: 2,239
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
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
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.
GSLearn.com | Templates | Free Demos | Udemy Course
@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
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
www.rossmanbrosgames.com
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.
Guru Video Channel | Lost Oasis Games | FRYING BACON STUDIOS
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
My Apps
https://itunes.apple.com/de/artist/david-zobrist/id733552276
https://play.google.com/store/apps/developer?id=David+Zobrist&hl=de
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.
My Apps
https://itunes.apple.com/de/artist/david-zobrist/id733552276
https://play.google.com/store/apps/developer?id=David+Zobrist&hl=de
i can do it via rules tough, maybe its good enough. A bit more code as if it were possible directly via expression.
My Apps
https://itunes.apple.com/de/artist/david-zobrist/id733552276
https://play.google.com/store/apps/developer?id=David+Zobrist&hl=de
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.
Guru Video Channel | Lost Oasis Games | FRYING BACON STUDIOS
@The_Gamesalad_Guru
alright thanks buddy
My Apps
https://itunes.apple.com/de/artist/david-zobrist/id733552276
https://play.google.com/store/apps/developer?id=David+Zobrist&hl=de