Swift Sprite Kit : SKShapeNode of circle
Swift Sprite Kit
SKShapeNode of circle
I has create new circle on the Sprite Kit How to Create circle on Sprite Kit
- Setup SKShapeNode
var newSprit = SKShapeNode()
- Create circle
newSprit = SKShapeNode(circleOfRadius: 25)
self.addChild(newSprit)
- Setup Physicsbody
newSprit.physicsBody = SKPhysicsBody(circleOfRadius: 25)
Full Code :
var newSprit = SKShapeNode()
func createNewSprite(point : CGPoint) {
newSprit = SKShapeNode(circleOfRadius: 25)
newSprit.strokeColor = UIColor.orange
newSprit.fillColor = UIColor.orange
newSprit.name = "TEST"
newSprit.physicsBody = SKPhysicsBody(circleOfRadius: 25)
self.addChild(newSprit)
}
留言
張貼留言