Skip to content
Work in progress. These docs describe Spawnite at launch, and some parts are still being built.

CharacterSpriteProps

  • Pick<SpriteBaseProps<Clip>, "sheet" | "pivot" | "tint" | "flash" | "blend" | "blobShadow" | "upright" | "lit" | "castShadow" | "receiveShadow" | "lean" | "opacity" | "sortingLayer" | "sortingOrder" | "onFrameChange" | "onClipEnd">.Partial<Pick<CharacterViewProps, "entity" | "children">>
Type Parameter Default type
Clip extends string string
Property Type Default value Description
blend? "alpha" | "additive" | SpriteBlendMode | "cutout" SpriteBlendMode.Cutout How its pixels draw over what is behind it.
blobShadow? boolean | SpriteBlobShadow false An ellipse under the feet, the blob shadow every sprite game draws, since a flat quad casts no shadow worth having.
castShadow? boolean | SpriteShadowCasting | "self" | "proxy" false Casts into the sun’s shadow map, beside the blobShadow under its feet, which still draws: true casts through a proxy turned to the light, SpriteShadowCasting.Self the quad the camera sees. A sprite casts in the sun’s two live cascades, not its far map.
children? CharacterOverlay undefined The game’s own overlay, drawn inside the character’s body so it follows the character: a bar over its head, the item its hand holds. Handed its height.
clips? Partial<Record<"walk" | "idle" | "run" | "jump" | "fall", CharacterSpriteRename<Clip>>> undefined The sheet’s names for the clips it plays, such as { run: "dash" }: a clip with directions is the name and the way, dash-down, so a directional sheet renames to the name alone.
directions? 4 | 8 undefined Picks walk-down, walk-left, walk-up, walk-right, and the diagonals walk-down-left and the rest with 8, from the way the character moves on the screen; a sheet with no right draws its left flipped. Left out, it plays the plain clip mirrored by the heading. It never turns with the character’s yaw: a flat picture has left and right alone.
entity? Entity undefined The character it draws.
flash? SpriteFlash undefined A hit flash mixed over the frame, started each time its plays rises.
lean? number | BillboardLeanOptions { view: 1, shadow: 0 } How far a sprite facing the camera leans back: a share of the camera’s pitch, from 0, standing upright, to 1, square to the view, and in the shadow pass a share of the light’s elevation the proxy leans back. A number sets the view’s share alone. A sprite lying flat on the 2D plane takes none.
lit? boolean | SpriteLightingOptions false Lit by the scene’s lights with a bent normal and wrap, so a sprite stands in the sun and the shade as the ground around it does, taking the look’s fog: true for the reference’s values, or the values to change. Unlit, the art’s colours draw as painted.
onClipEnd? (clip) => void undefined As a one-shot ends without holding, or a Once loop ends.
onFrameChange? (frame) => void undefined Each time the frame it shows changes, on the page that draws it, for a footstep sound.
opacity? number 1 From 1, whole, to 0, gone. A cut out sprite fades through a 4 by 4 ordered dither, so a fading sprite still writes depth and casts its shadow; a blended one fades by its alpha.
pivot? SpritePivotOption undefined Where the entity’s origin sits on the frame: a SpritePivot, or fractions from the frame’s bottom left. Left out, the frame’s own pivot where the file has one, else SpritePivot.BottomCenter, the feet a character stands on.
receiveShadow? boolean true when lit Takes the shadows other things cast. Only a lit sprite takes light, so only a lit one takes shadow.
runSpeed? number half the character's top speed Metres a second from which a move plays run rather than walk.
sheet SpriteSheet<Clip> undefined The sheet it draws, which defineSpriteSheet declared.
sortingLayer? number 0 A whole number from −4 to 3 that draws over every lower layer whatever the feet say, as a roof over the characters under it.
sortingOrder? number 0 A whole number from −64 to 63 within the layer, ahead of the feet, the range a tile layer takes too.
tint? ColorRepresentation white A colour multiplied into the frame, Unity’s and Phaser’s color and tint.
upright? boolean false Stands on the ground plane facing the camera, about its feet, for a tilted 2.5D look, as Godot’s Sprite3D billboard. Under a 3D camera every sprite faces the camera so.