A definition of a sprite, which can later be used for drawing by BeetPxDraw.sprite.

$spr

Static factories

Methods

Properties

Static factories

Methods

Properties

imageUrl: string
type: "static" = "static"

A property helpful for TypeScript type inference, when distinguishing from other types of sprites.

const s: BpxSprite | BpxAnimatedSprite = getSprite();
if (s.type === "static") {
// s is BpxSprite here
} else if (s.type === "animated") {
// s is BpxAnimatedSprite here
} else {
$u.assertUnreachable(s);
}