当玩家死亡时,会出现一个小小的图像:aww你已经死了。 但我正在使用的代码正在减慢我的fps速度,我做错了什么?
游戏以60 fps的速度运行,当图像显示时fps下降到30 ..
这是功能:
func Dood(){
let labelDood = SKSpriteNode(imageNamed: "labelDood")
labelDood.size.width = frame.size.width/1.2
labelDood.size.height = frame.size.height/4
labelDood.position.x = frame.size.width/2
labelDood.position.y = -frame.height/2
labelDood.zPosition = 3
var labelLevens = SKLabelNode(fontNamed: "Arial-Bold")
labelLevens.text = ("3")
labelLevens.position.x = frame.size.width / 2.13
labelLevens.position.y = (-frame.size.height / 1.68)
labelLevens.fontColor = SKColor.blackColor()
labelLevens.fontSize = frame.size.height / 17
labelLevens.zPosition = 4
addChild(labelDood)
addChild(labelLevens)
self.runAction(SKAction.sequence([SKAction.waitForDuration(1.0),
SKAction.runBlock({
println("doodddd")
self.kikker.removeFromParent()
labelDood.removeFromParent()
labelLevens.removeFromParent()
self.kikker.position = CGPointMake(self.frame.size.width/2, -self.frame.size.height/20*19)
self.kikker.zRotation = 0
self.addChild(self.kikker)
})
] ))
}