Game Development Reference
In-Depth Information
Figure 2-8
.
The playerNode at the top right of the scene
While you successfully positioned your player in the upper-right corner of the scene, you
will notice something a little odd—only the bottom-left quarter of the
playerNode
is
visible. You will see why this is in the next section when I focus on anchor points.
Anchor Points
As you saw in the previous section, when you positioned the
playerNode
in the top-
right corner of the scene, only the bottom-left quarter of the node was visible in the scene.
This is because the default anchor point for
SKSpriteNode
s is positioned at the center
of the node.
A sprite's
anchorPoint
property is used to set the point in the
SKSpriteNode
's
frame in which the sprite's position property will be applied. This sounds a little complic-
ated, but it is really pretty straightforward. Take a look at
Figure 2-9
.