Initializer

init(texture:size:)

Initializes a textured sprite using an existing texture object but with a specified size.

Declaration

convenience init(texture: SKTexture?, size: CGSize)

Parameters

texture

A SpriteKit texture.

size

The size of the sprite in points.

Return Value

A newly initialized sprite object.

Discussion

The sprite is initialized using the texture, but the texture’s dimensions are not used. Instead, the size passed into the constructor method is used.

See Also

Creating a Sprite from a Texture

init(texture: SKTexture?)

Initializes a textured sprite using an existing texture object.

init(texture: SKTexture?, color: UIColor, size: CGSize)

Initializes a colored and textured sprite using an existing texture object.

init(texture: SKTexture?, normalMap: SKTexture?)

Initializes a textured sprite with a normal map to simulate 3D lighting.

var texture: SKTexture?

The texture used to draw the sprite.