Sprite
Abstract base class for drawable game objects with a texture and transform.
Constructor
-
Sprite() → Sprite -
Sprite(texture: Texture) → Sprite -
Sprite(texture: Texture, transform: Transform) → Sprite
Abstract base class for drawable game objects with a texture and transform.
Properties
| Name | Description | Type |
|---|---|---|
texture | The sprite's texture. | Texture |
transform | The sprite's transform. | Transform |
velocity | The sprite's velocity. | Vec2 |
visible | Whether the sprite is visible. | bool |
Methods
Draw
draw() → NoneDraw the sprite to the screen with its current transform.
Move
move() → NoneApply frame-independent velocity to position.
Update
update() → NoneUpdate the sprite state (must be overridden).