Sprite Kit / Swift Stars Effect
this is what I would like to achieve:
The stars spawn at random, resizing the small dot image, so the stars appear to be shining at random positions. I just started working with Swift a few weeks ago and I am working on this cool game project, it could be a great feature and I'm sure some of the other users can use and answer this too.
Any ideas?
edit: And it's a shame I'm such a newbie.
+3
source to share
2 answers
Speaking of Sprite-kit, you can now use SKEmitterNode
.
Create a new Xcode file:
let stars : SKEmitterNode = NSKeyedUnarchiver.unarchiveObjectWithFile(NSBundle.mainBundle().pathForResource("stars", ofType: "sks")!) as! SKEmitterNode
stars.position = CGPointMake(CGRectGetMidX(self.frame),CGRectGetMidY(self.frame))
stars.zPosition = 1
self.addChild(stars)
+1
source to share