In spritekit, is there a quick way to position a node at the center of the screen without having to calculate the coordinate manually?
if your scene has an anchorPoint of CGPoint(x: 0.5, y: 0.5) then any object you add to the scene will automatically be placed in the center of the screen.
If your scene has an anchorPoint of CPoint.zero (lower left corner) you can set the position of the object by setting object.position = CGPoint(x: self.size.width / 2, y: self.size.height/ 2) where self is the scene
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With