Skip to main content
Module

x/oid/mod.ts>Sprite

oidoid 2D game engine.
Go to Latest
class Sprite
Re-export
import { Sprite } from "https://deno.land/x/oid@v0.0.6/mod.ts";

A renderable animation.

Constructors

new
Sprite(
film: Film,
layer: U8,
props?: SpriteProps,
)

Properties

readonly
bounds: I16Box
readonly
film: Film
readonly
h: I16

Height (negative when flipped).

writeonly
layer: U8
readonly
w: I16

Width (negative when flipped).

readonly
wrapLayerByHeightLayer: U16
readonly
x: I16
readonly
y: I16

Methods

animate(start: number, film?: Film): void

Clear the start time (set the animation to the starting cel) and optionally change the film. This is useful to reset the active film or switch films.

cel(time: number): Cel
compareDepth(sprite: Sprite): number
intersects(box: Readonly<Box<number>>, time: number): boolean
intersects(xy: Readonly<XY<number>>, time: number): boolean
intersectsBounds(xy: Readonly<XY<number>>): boolean
intersectsBounds(box: Readonly<Box<number>>): boolean
intersectsBounds(sprite: Readonly<Sprite>): boolean
intersectsSprite(sprite: Readonly<Sprite>, time: number): boolean
isInFrontOf(sprite: Sprite): boolean

True if this is in front of sprite.

moveBy(xy: Readonly<I16XY>): Sprite
moveTo(xy: Readonly<I16XY>): Sprite
toString(): string