I am making a simple Pong game using SpriteKit + Swift. It is a multiplayer game, so I want two people to be able to move the two paddles. I want to be able to move the paddles at the same time. When I run the code below, which is the touchesBegan function, I am only able to move each paddle when one finger is pressing the display. When I try to touch another paddle, while my finger is already on the screen, it does not respond.
let touch = touches.first as UITouch?
let touchLocation = touch?.locationInNode(self)
let body: SKPhysicsBody? = self.physicsWorld.bodyAtPoint(touchLocation!)
if body?.node!.name == PaddleCategoryName {
print("Paddle Touched!")
fingerIsOnPaddle = true
} else if body?.node!.name == PaddleCategoryName2 {
print("Paddle2 Touched!")
fingerIsOnPaddle2 = true
}
I know this is a bit late but if you still dont know the answer I believe you need to set this line in your viewController when loading your first scene