objective c - Couldn't make a particle follow a path in spriteKit -


this animation in xcode skemitter editor (i want achieve on iphone) :

enter image description here

this animation on iphone (i don't want animation):

enter image description here

using code:

    let sparkemmiter = skemitternode(filenamed: "fireflies.sks")     self.addchild(sparkemmiter) // self 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; 

this emitter settings:

enter image description here

i tried both runaction , particleaction referring question, doesn't work wanted to...

-----------------update----------------------------------------------

tried solution mentioned hamobi (still doesn't work) :

    //if you:     // 1) i'd make sprite ,      let texture = sktexture(imagenamed: "spark")     let mysprite = skspritenode(texture: texture)     self.addchild(mysprite)      // 2) add emitter in first example child.     let sparkemmiter = skemitternode(filenamed: "fireflies.sks")     mysprite.addchild(sparkemmiter)      // 3) i'd set emitters targetnode scene.     sparkemmiter.targetnode = self      // 4) i'd animate sprite in arc.     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; 

enter image description here

-----------------update 2----------------------------------------------

got it! thx hamobi :d result :d:d

enter image description here

if i'd make sprite , add emitter in first example child. i'd set emitters targetnode scene. i'd animate sprite in arc.

edit:

okay main thing missing should forget using particleaction. make mysprite run followtrackforever action.

heres code

//if you: // 1) i'd make sprite , let texture = sktexture(imagenamed: "spark") let mysprite = skspritenode(texture: texture) mysprite.position = cgpoint(x: self.size.width/2, y: self.size.height/2) self.addchild(mysprite)  // 2) add emitter in first example child. let sparkemmiter = skemitternode(filenamed: "fireflies.sks") mysprite.addchild(sparkemmiter)  // 3) i'd set emitters targetnode scene. sparkemmiter.targetnode = self  // 4) i'd animate sprite in arc. var circle: cgpathref? = nil circle = cgpathcreatewithellipseinrect(cgrectmake(100, 200, 200, 200), nil) let followtrack = skaction.followpath(circle!, asoffset: false, orienttopath: true, duration: 3.0) let followtrackforever = skaction.repeatactionforever(followtrack) mysprite.runaction(followtrackforever) 

screenshot of particle

enter image description here

my particle in action

enter image description here


Comments

Popular posts from this blog

Payment information shows nothing in one page checkout page magento -

tcpdump - How to check if server received packet (acknowledged) -