Recently I have been creating a game where I put circles on the screen. However, I noticed that the circulars were not circles, but in fact ovals. The y axis had been stretched of the x axis had been shrunk. In order to figure out the issue, I am now trying to debug with a rectangle. I made the rectangle have the same height and width (square) however, when turned into an skshapenode it is no longer the correct shape. The code:
var testSquare = CGRect(x: CGRectGetMidX(self.frame), y: CGRectGetMidY(self.frame), width: 1, height: 1)
var squareNode = SKShapeNode(rect: testSquare)
println(testSquare.width)
println(testSquare.height)
println(squareNode.frame.width)
println(squareNode.frame.height)
self.addChild(squareNode)
Here is what gets printed from this:
1.0
1.0
513.5
385.5
If I change the testSquare's height and width both to 100 this is what gets printed:
100.0
100.0
612.5
484.5
For some reason the frame of the squarenode in the x adds 512.5 and in the y adds 384.5. The rectangle that is created is longer in the Y for some reason on the screen though. Maybe the frame is not the number I should be printing, but regardless the shape on the screen is NOT a square. Does anyone know why that is? Any help is greatly appreciated!