public marks

PUBLIC MARKS from an_ta with tags particles & spritekit

12 August 2015 13:30

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

(via)
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 the emitter in your first example as a child. let sparkEmmiter = SKEmitterNode(fileNamed: "fireflies.sks") mySprite.addChild(sparkEmmiter) // 3) I'd set the emitters targetNode to the scene. sparkEmmiter.targetNode = self // 4) Then I'd just animate the sprite itself in an 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)

an_ta's TAGS related to tag particles

core +   development +   graphics +   how +   important +   ios +   ipad +   must +   particle +   path +   programming +   read +   sdk +   spritekit +   tips +   to +   tutorial +   useful +   very +