0

For exemple I have two SKLabelNode: "Easy" and "Medium"

I set them at the same height but because easy contains a 'y', it is higher because of his tail

How can I put them at the same height?

Luca Angeletti
  • 58,465
  • 13
  • 121
  • 148
Clément Bisaillon
  • 5,037
  • 8
  • 32
  • 53

1 Answers1

2

You just need to set them in order to have the same position.y value

let easy = SKLabelNode(fontNamed:"Chalkduster")
easy.text = "Easy"
easy.fontSize = 45
easy.position = CGPoint(x:CGRectGetMidX(self.frame) - 200, y:CGRectGetMidY(self.frame))
self.addChild(easy)

let medium = SKLabelNode(fontNamed:"Chalkduster")
medium.text = "Medium"
medium.fontSize = 45
medium.position = CGPoint(x:CGRectGetMidX(self.frame) + 200, y:CGRectGetMidY(self.frame))
self.addChild(medium)

enter image description here

Luca Angeletti
  • 58,465
  • 13
  • 121
  • 148