1
votes

I am trying to create a SpriteKit game. I want to add a circle in the middle of the screen.

Here is my code (swift):

func createSimpleNode() {
    let spriteNode = SKShapeNode(circleOfRadius: CGFloat(2))
    spriteNode.position = CGPoint(x: CGRectGetMidX(frame), y: CGRectGetMidY(frame))
    spriteNode.antialiased = true
    spriteNode.fillColor = SKColor.blueColor()
    addChild(spriteNode)
}

And this is the result enter image description here if i change the radius to 0.5 i am getting this

enter image description here

1

1 Answers

0
votes

First, your background colour is blue, so it makes it hard to see your blue circle. Second, your circle is very small (2 points). I dropped your code into the "Hello, World!" app Apple provides and left the default grey background. I changed your circle size from 2 to 200. The result is in this screenshot. I hope that clarifies things for you. Good luck!

Hello, blue circle!