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
1. Setup SKShapeNode
```
var newSprit = SKShapeNode()
```
2. Create circle
```
newSprit = SKShapeNode(circleOfRadius: 25)
self.addChild(newSprit)
```
3. 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)
}
```
留言
張貼留言