September 2018
Intermediate to advanced
434 pages
8h 47m
English
SpriteKit uses a grid of points to position nodes. In this grid, the bottom left corner of the scene is (0,0), with a positive x-axis to the right and a positive y-axis to the top.
Similarly, on the individual sprite level, (0,0) refers to the bottom-left corner of the sprite, while (1,1) refers to the top-right corner.
Each sprite has an anchorPoint property, or an origin. The anchorPoint property allows you to choose which part of the sprite aligns to the sprite's overall position.
The default anchor point is (0.5,0.5), so a new SKSpriteNode centers perfectly on its position.
To illustrate this, let's examine the blue square sprite we just drew on the screen. Our sprite is 50 points wide and ...
Read now
Unlock full access