The properties of SKSpriteNode
Let us discuss the properties of SKSpriteNode
in the following sections.
Physical
Let us look at some physical properties of SKSpriteNode
:
size
: This property determines the size of a sprite in points. In ourGameScene
andMenuScene
classes, we use this property in the background sprite to cover the screen.AnchorPoint
: An anchor point is a point of co-ordinate related to sprite. Say, for example, co-ordinates for each corner of a sprite are(0,0)
,(1,0)
,(0,1)
, and(1,1)
representing corners bottom left, bottom right, top left, and top right respectively. These points of reference can be assigned as anchor points to draw a sprite on screen in respect. An assigned anchor point will position a sprite on screen, accordingly.For example, assume that our anchor point for a sprite is
(0,0)
. If we position this sprite on screen, it will place itself from co-ordinate(0,0)
, that is, bottom left. To position a sprite from the centre, we need to assign the anchor point...