15

I'm trying to keep the left side of an SKLabelNode fixed after updating it. The thing is that the SKLabelNode is growing in both directions. All I want is to grow only in the right side. Thanks a lot.

prototypical
  • 6,731
  • 3
  • 24
  • 34
Ady Năstase
  • 249
  • 2
  • 9

1 Answers1

29

The problem is, that SKNodes have their origin in the center of their node. So you will have to set the SKLabelHorizontalAlignmentMode to "left" to resolve this problem.

var label:SKLabelNode = SKLabelNode()
label.horizontalAlignmentMode = SKLabelHorizontalAlignmentMode.Left

Here a picture, what the different modes do:

enter image description here Link to picture origin

Community
  • 1
  • 1
Christian
  • 22,585
  • 9
  • 80
  • 106