drawSprite

fun Canvas.drawSprite(sprite: Sprite2D, x: Float = sprite.x, y: Float = sprite.y, rotation: Float = sprite.rotation, scale: Float = sprite.scale)

Draws the given sprite to the canvas at its current position or at the specified x and y coordinates.

Parameters

sprite

The sprite to draw.

x

The x-coordinate to draw the sprite at. Defaults to the sprite's current x position.

y

The y-coordinate to draw the sprite at. Defaults to the sprite's current y position.

rotation

The rotation to draw the sprite with. Defaults to the sprite's current rotation.

scale

The scale to draw the sprite with. Defaults to the sprite's current scale


fun Canvas.drawSprite(sprite: Sprite3D, x: Float = sprite.x, y: Float = sprite.y, z: Float = sprite.z)

Draws the given sprite to the canvas at its current position or at the specified x, y, and z coordinates.

Parameters

sprite

The sprite to draw.

x

The x-coordinate to draw the sprite at. Defaults to the sprite's current x position.

y

The y-coordinate to draw the sprite at. Defaults to the sprite's current y position.

z

The z-coordinate to draw the sprite at. Defaults to the sprite's current z position.