When the player dies, a little image is showing up saying: aww you're dead. But the code I am using is slowing down my fps as hell, what am I doing wrong?
the game goes on at 60 fps, when the image shows up the fps goes down to 30..
this is the function:
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)
})
] ))
}