-4

My score label sprite node x position is set to size.width * 0.4 and it looks like this:

(The 'Time' sprite node on the right simply adds 100 to the score sprite node x position)

enter image description here

If I change the score label sprite node x position to size.width * 0.3 it looks like this:

enter image description here

Of course it seems size.width is returning larger than the actual screen size. Any ideas what is wrong?

CodeSmile
  • 64,284
  • 20
  • 132
  • 217
Reece Kenney
  • 2,734
  • 3
  • 24
  • 57

2 Answers2

2

Put this in the viewDidLoad:

self.size = view.bounds.size
Reece Kenney
  • 2,734
  • 3
  • 24
  • 57
0

The visible part of the scene corresponds to the scene's view. The scene is 1024 wide, centered in the view. This is why most examples start by centering things in the view — that's the visible part. If you need to convert between coordinate systems, use the convertPointFromView and convertPointToView methods.

matt
  • 515,959
  • 87
  • 875
  • 1,141