I'm working on a Breakout type game. I created the paddle in a different scene (PaddleScene.sks) so I could reference it across multiple levels. Not sure if that's how it's done yet, still a newbie.
I added the paddle inside GameScene.sks
through SKReferenceNode
and referenced it in code like this:
paddle = self.childNode(withName: "//paddle") as! SKSpriteNode
This works, but the problem is that now paddle.position.x
gives me 0, because that is its position inside PaddleScene.sks
. So I have to use the SKReferenceNode
to get the position inside GameScene.
paddleRef = self.childNode(withName: "paddleScene") as! SKReferenceNode
So now I have to keep track of two variables instead of one. Is there an easier way to import external objects in my scenes without having multiple variables?