SpriteLocation Class

A Sprite location. Sprites generally move around on the screen and this object holds the current location and current Sprite within a ScreenViewport. SpriteLocations can be either inactive (not visible) or active.

A SpriteLocation can also specify that a Sprite should be drawn partially transparent.

Implements

Methods

Name Description
constructor(): SpriteLocation    
activate(sprite: Sprite, viewport: ScreenViewport, locationWorld: Readonly<WritableXYAndZ>, alpha?: number): void Activate this SpriteLocation to show a Sprite at a location in a single ScreenViewport.  
deactivate(): void Turn this SpriteLocation off so it will no longer show.  
decorate(context: DecorateContext): void If this SpriteLocation is active and the supplied DecorateContext is for its Viewport, add the Sprite to decorations.  
drawDecoration(ctx: CanvasRenderingContext2D): void Draw this sprite onto the supplied canvas.  

Properties

Name Type Description
isActive Accessor ReadOnly boolean    
position Readonly Point3d The current position of this sprite in view coordinates.  

Defined in

Last Updated: 14 November, 2024