showSprite

Built-ins

Canonical ID: sprites.show. Nederlands: toonSprite.

Creates or updates a named retained sprite. Updating an existing name preserves stacking position; showing a name again after hiding it places it above surviving sprites. Rotation is clockwise about the rectangle center. Local horizontal/vertical mirroring is applied before rotation. Omitted transform arguments reset to 0,false,false each call. The rectangle remains the layout and clipping rectangle. Native image fitting currently stretches while the IDE preserves aspect ratio; use matching source and destination aspect ratios for portability.

Signature

showSprite(name, asset, x, y, width, height)
showSprite(name, asset, x, y, width, height, rotation)
showSprite(name, asset, x, y, width, height, rotation, flipHorizontal)
showSprite(name, asset, x, y, width, height, rotation, flipHorizontal, flipVertical)

Arguments

Parameter Type Requirement
name Text Nonempty sprite identity; not a variable binding.
asset Text Nonempty packaged project-relative asset path, normally under assets/.
x Number Finite horizontal coordinate in logical pixels.
y Number Finite vertical coordinate in logical pixels.
width Number Finite and positive.
height Number Finite and positive.
rotation Number, optional Finite clockwise degrees; default 0.
flipHorizontal Boolean, optional Default false; provide rotation first.
flipVertical Boolean, optional Default false; provide preceding arguments.

Return value

None.

Example

# language: en
showSprite("hero", "assets/hero.png", 100, 220, 48, 64, 15, true, false)
wait(0.2)
showSprite("hero", "assets/hero.png", 160, 220, 48, 64)

Package assets/hero.png. The second call moves the same sprite and resets rotation and mirroring.

Notes and common mistakes

Use the function name for your source language. Its canonical ID is a shared documentation label; you do not type that ID as a call. Giving your own variable or function the same name can hide the built-in. Supply the documented arguments and value types. Pliro reports mismatches when checking can detect them, or when the call runs.

A host is the app or environment running your program. To see a drawing, it needs a renderer, the part that draws on screen. The command-line command pliro run shows text but does not draw these graphics. The host support table explains which effects work in the IDE, browser, native app, and phone preview. A native build reports an unsupported capability instead of leaving it out.

The example requires the named files inside a .bipli project. Packaged assets are currently limited to 12 MiB each. Paths under assets/ are project references, not arbitrary files or URLs. Current native export does not implement playSound.

hideSprite · Programming guides · Host support · Calls and arguments