Sprite Kit game crashes on Game Over on tvOS 9.1 and iOS 9.2

这一生的挚爱 提交于 2019-12-06 06:23:56

The answer I found out was to lower the SKEmitterNode birthrate and particles to emit as this would cause the game to crash.

In the GameScene.swift:

func explosion(intensity: CGFloat) -> SKEmitterNode {
   let emitter = SKEmitterNode()
   let particleTexture = SKTexture(imageNamed: "spark")

   emitter.zPosition = 2
   emitter.particleTexture = particleTexture

   //LOWER the particleBirthRate and numParticlesToEmit
   emitter.particleBirthRate = 50; //4000 * intensity
   emitter.numParticlesToEmit = 50; //Int(400 * intensity)

   ....
 }

Once lowered to 50 respectively, then the game wouldn't crash. I don't know why this is happening, but Apple is currently working on this and is considered a bug.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!