ios - Making a particle follow a path in spriteKit -
i have created particle , when test moving on xcode's property window, looks this:
i have added particle scene, made circle , forced particle run circle using this:
nsstring *myparticlepath = [[nsbundle mainbundle] pathforresource:@"particle" oftype:@"sks"]; skemitternode *myparticle = [nskeyedunarchiver unarchiveobjectwithfile:myparticlepath]; [self addchild:myparticle]; cgpathref circle = cgpathcreatewithellipseinrect(cgrectmake(0,0,400,400), null); skaction *followtrack = [skaction followpath:circle asoffset:no orienttopath:yes duration:1.0]; skaction *forever = [skaction repeatactionforever:followtrack]; [myparticle runaction:forever];
this how looks like. block of white sugar candy. node particle following path, not generated particles.
i have represented circle in dashed can see path following...
any ideas?
thanks
you sent particle emitter follow path. if want individual particles run action, use emitter's particleaction property:
myparticle.particleaction = forever;
Comments
Post a Comment