1

I am trying to create an explosion effect using SKEmitterNode, I followed some of this tutorial (http://www.waveworks.de/kill-your-characters-animating-explosions-with-skanimations-in-sprite-kit/), but it didn't seem to work. Here is what i have:

var superDabParticle = SKEmitterNode(fileNamed: "superDabParticle.sks")

func setUpEmiterNode(){
    superDabParticle?.position = CGPoint(x: self.size.width * 0.5, y: self.size.height * 0.5)
    let superDabParticleEffectNode = SKEffectNode()
    superDabParticle?.zPosition = 1
    superDabParticle?.setScale(0)
    superDabParticleEffectNode.addChild(superDabParticle!)
    self.addChild(superDabParticleEffectNode)
}

func animateEmiterNode(){
    let birth = SKAction.runBlock { self.superDabParticle?.particleBirthRate = 0 }

    superDabParticle!.runAction(SKAction.sequence([SKAction.waitForDuration(0.1), SKAction.scaleBy(1.5, duration: 0.1), birth]))
}

So i need to call setUpEmiterNode() when the app first launches up, then when the user taps a button, call animateEmiterNode to have the particles fly from the bottom of the screen up to about 75% of the screen, then fall back down; giving a sort of explosion under water effect. Im using the SPARK emitter effect. If you know my issue or have any other ways that are better to do this, please assist!!

Alexey Pichukov
  • 3,377
  • 2
  • 19
  • 22
OriginalAlchemist
  • 391
  • 1
  • 7
  • 28

0 Answers0