I have a person that remains on screen until he dies. As the person moves blocks comes off of him and fadeout into the air using an SKEmitterNode
. The longer I play the lower the FPS get and my game starts to run slow, usually around 1000 nodes it slows down.
I know I need to find a way to remove the nodes that have already faded away and I have tried the basic things to remove nodes but no luck.
I am also confused as to why my game slows down so much around 1000 - 1500 nodes when there are games that have HD graphics with dust particles and a million different things happening at once that run smooth?
Here is the SKEmitterNode
:
func gravityTrail(_ spriteToExplode : SKSpriteNode, color : UIColor) {
gravityTrail = SKEmitterNode(fileNamed: "TrailGravity.sks")
gravityTrail.particleColorSequence = nil
gravityTrail.particleColorBlendFactor = 1.0
gravityTrail.particleColor = color
gravityTrail.targetNode = person
gravityTrail.position = spriteToExplode.position
self.addChild(gravityTrail)
}
Thanks for your help!