drawSprite

fun Canvas.drawSprite(sprite: Sprite2D, x: Int = sprite.x, y: Int = sprite.y)

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.


fun Canvas.drawSprite(sprite: Sprite3D, x: Int = sprite.x, y: Int = sprite.y, z: Int = 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.