the font file is called "herculanumRegular.ttf"
I put it in the code for a score counter, the font doesn't show but the score counter does.
i don't understand why
I've been following a series of videos called "Solo mission"
so i don't fully understand a lot
dumb it down for me
here's the code
var gameScore = 0
let scoreLabel = SKLabelNode(fontNamed: "herculanumRegular")
override func didMove(to view: SKView) {
scoreLabel.text = "Score: 0"
scoreLabel.fontSize = 70
scoreLabel.fontColor = SKColor.white
scoreLabel.horizontalAlignmentMode = SKLabelHorizontalAlignmentMode.left
scoreLabel.position = CGPoint(x: self.size.width0.20, y: self.size.height0.9)
scoreLabel.zPosition = 100
self.addChild(scoreLabel)
}
func addScore(){
gameScore += 1
scoreLabel.text = "Score: \(gameScore) "
}
Selecting any option will automatically load the page
Post
Replies
Boosts
Views
Activity
this is where the problem is
let randomXStart = arc4random(min: CGRectGetMinX(gameArea), max: CGRectGetMaxX(gameArea))
let randomXEnd = arc4random(min: CGRectGetMinX(gameArea), max: CGRectGetMaxX(gameArea))
for some reason it says to delete it but when i do, it doesnt work
btw im just following a video so please dumb it down for me
this is all the code for the section it's located in
func spawnEnemy (){
let randomXStart = arc4random(min: CGRectGetMinX(gameArea), max: CGRectGetMaxX(gameArea))
let randomXEnd = arc4random(min: CGRectGetMinX(gameArea), max: CGRectGetMaxX(gameArea))
let startPoint = CGPoint(x: randomXStart, y: self.size.height * 1.2)
let endPoint = CGPoint(x: randomXEnd, y: self.size.height * 0.2)
let Dino = SKSpriteNode(imageNamed: "BlueDino")
Dino.setScale(1)
Dino.position = startPoint
Dino.zPosition = 2
self.addChild(Dino)
let moveDino = SKAction.moveTo(endPoint, duration: 1.5)
let deleteDino = SKAction.removeFromParent()
let dinoSequence = SKAction.sequence([moveDino, deleteDino])
Dino.run(dinoSequence)
let dx = endPoint.x - startPoint.x
let dy = endPoint.y - startPoint.y
let amountToRotate = atan2(dy, dx)
Dino.zRotation = amountToRotate