A 2D texture that can be displayed on screen.

Constructor

new(x:Int, y:Int, sprite:Texture)

Constructor used to initialize internal variables. It is not recommended to override this! use init instead!!

Parameters:

x

X position of the sprite

y

Y position of the sprite

sprite

Texture of the sprite

Variables

@:value(0)angle:Float = 0

The rotation of the sprite

@:value(Rl.Colors.WHITE)color:Color = Rl.Colors.WHITE

Tint of the sprite.

@:value(1)scale:Float = 1

The scale of the sprite

Methods

center(?axies:Axies):Void

Automatically centers the sprite on the scree

Parameters:

axies

the axies to center the sprite on. Takes either X, Y, or XY. If left empty, XY is used.

draw():Void

Used to draw the sprite on every frame

unload():Void

Used to unload and free all allocated resources, it is not recommended to override this, Called automatically upon scene switch or when un-registering the sprite.

update():Void

Used to update internal variables upon every frame. called automatically.

Inherited Variables

Defined by RgObject

pos:Rect

Position and scaling of the object.

Inherited Methods