IPhone : Couldn't make a particle follow a path in spriteKit

on Tuesday, March 31, 2015

This is the animation in XCode SKEmitter editor (I want to achieve this on the iPhone) :


enter image description here


This is the animation on the iPhone (I don't want this animation):


enter image description here


Using this code:



let sparkEmmiter = SKEmitterNode(fileNamed: "fireflies.sks")
self.addChild(sparkEmmiter) // self is a SKScene

var circle: CGPathRef? = nil
circle = CGPathCreateWithEllipseInRect(CGRectMake(400, 200, 200, 200), nil)
let followTrack = SKAction.followPath(circle!, asOffset: false, orientToPath: true, duration: 3.0)
let followTrackForever = SKAction.repeatActionForever(followTrack)
//sparkEmmiter.runAction(followTrackForever)
sparkEmmiter.particleAction = followTrackForever;


I tried both runAction and particleAction by referring to this question, but it doesn't work as I wanted it to...


0 comments:

Post a Comment