Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

AppGameKit Studio Chat / [SOLVED] Can't get 2 point multitouch working effectively.

Author
Message
RoadKill
1
Years of Service
User Offline
Joined: 22nd Apr 2022
Location:
Posted: 22nd May 2022 00:01
Hi all, stuck on a new issue here, I'm trying to port my pong clone to AppGameKit tier 1, pretty much done with it but as the game has a two player option I'm trying to make multi touch work, I got the paddles moving independently with a single touch but once there's more than one touch it all falls apart and starts acting erratically.

From nothing working to the right player's side of the screen moving both paddles, the later has me confused, code is below that I'm using and reckon it's the very wrong of doing it.



My MovePlayer(Player, Direction, speed) function is pretty simple and works fine with keyboard so that shouldn't be an issue I would have thought.

I'd appreciate the help on this as I cant continue much further and would like to get this working soon.

The author of this post has marked a post as an answer.

Go to answer

Raven
19
Years of Service
User Offline
Joined: 23rd Mar 2005
Location: Hertfordshire, England
Posted: 22nd May 2022 01:57
This post has been marked by the post author as the answer.
Try this:


As we're not checking for Taps but Holds., we don't really need to check for "Unknown" Event Types.
Beyond this, the code above merely designated "Player" as the order of the Touch... that is, if someone was to let go; then it would switch which player is which.
Thus you want to designated a "Side" of the Phone., i.e. Touch is X = 0 to 50 is Player 1., X = Width - 50 to Width = Player 2
RoadKill
1
Years of Service
User Offline
Joined: 22nd Apr 2022
Location:
Posted: 22nd May 2022 15:25
Not 100% sure how your code snippet works but I've managed to lightly modify it and get multitouch working in the game, thanks Raven.

Login to post a reply

Server time is: 2024-03-29 06:11:58
Your offset time is: 2024-03-29 06:11:58