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.
//Player 1 Touch
GetRawFirstTouchEvent(1)
if GetRawTouchCount(1) = 1
if GetRawTouchCurrentX(1) < 60
if GetRawTouchCurrentY(1) < GetSpriteYByOffset(sprLeftPaddle)
MovePlayer(1, 0, 150)
endif
if GetRawTouchCurrentY(1) > GetSpriteYByOffset(sprLeftPaddle)
MovePlayer(1, 1, 150)
endif
endif
endif
GetRawNextTouchEvent()
if GetRawTouchCount(1) = 2
if GetRawTouchCurrentX(2) < 60
if GetRawTouchCurrentY(2) < GetSpriteYByOffset(sprLeftPaddle)
MovePlayer(1, 0, 150)
endif
if GetRawTouchCurrentY(2) > GetSpriteYByOffset(sprLeftPaddle)
MovePlayer(1, 1, 150)
endif
endif
endif
//Player 2 Touch
GetRawFirstTouchEvent(1)
if GetRawTouchCount(1) = 1
if GetRawTouchCurrentX(1) > 100
if GetRawTouchCurrentY(1) < GetSpriteYByOffset(sprRightPaddle)
MovePlayer(2, 0, 150)
elseif GetRawTouchCurrentY(1) > GetSpriteYByOffset(sprRightPaddle)
MovePlayer(2, 1, 150)
endif
endif
endif
GetRawNextTouchEvent()
if GetRawTouchCount(1) = 2
if GetRawTouchCurrentX(2) > 100
if GetRawTouchCurrentY(2) < GetSpriteYByOffset(sprRightPaddle)
MovePlayer(2, 0, 150)
elseif GetRawTouchCurrentY(2) > GetSpriteYByOffset(sprRightPaddle)
MovePlayer(2, 1, 150)
endif
endif
endif
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.