Game Development Reference
In-Depth Information
import SpriteKit
class GameOverView: SKScene {
required init?(coder aDecoder: NSCoder) {
super.init(coder: aDecoder)
}
init(size: CGSize, score: String) {
super.init(size: size)
backgroundColor = UIColor.redColor()
let backgroundNode = SKSpriteNode(imageNamed:
"GameOverBackground")
backgroundNode.anchorPoint = CGPoint(x: 0.5, y: 0.0)
backgroundNode.position = CGPoint(x: 160.0, y: 0.0)
addChild(backgroundNode)
let scoreTextNode = SKLabelNode(fontNamed:
"Copperplate")
scoreTextNode.text = "SCORE : \(score)"
scoreTextNode.horizontalAlignmentMode
= SKLabelHorizontalAlignmentMode.Center
scoreTextNode.verticalAlignmentMode
= SKLabelVerticalAlignmentMode.Center
scoreTextNode.fontSize = 20
scoreTextNode.fontColor = SKColor.whiteColor()
scoreTextNode.position = CGPointMake(size.width
/ 2.0, size.height - 75.0)
addChild(scoreTextNode)
let tryAgainTextNodeLine1 = SKLabelNode(fontNamed:
"Copperplate")
tryAgainTextNodeLine1.text = "TAP ANYWHERE TO PLAY
AGAIN!"
tryAgainTextNodeLine1.horizontalAlignmentMode
= SKLabelHorizontalAlignmentMode.Center
tryAgainTextNodeLine1.verticalAlignmentMode
= SKLabelVerticalAlignmentMode.Center
tryAgainTextNodeLine1.fontSize = 20
tryAgainTextNodeLine1.fontColor
= SKColor.whiteColor()
tryAgainTextNodeLine1.position
= CGPointMake(size.width / 2.0,size.height - 200)
addChild(tryAgainTextNodeLine1)
Search WWH ::




Custom Search