The opacity of the entity (from 0 to 1)
An array of child entities for recursive update/render.
Whether or not the entity is dead.
The hitbox of the sprite.
Position of the entity.
The rotation of the sprite.
Scale of the entity.
Whether or not the entity is visible.
Gets the anchor point.
Whether or not there are any child entities.
Gets the height of the sprite in pixels, accounting for scale.
Sets the height.
Gets the pivot point (used for rotations).
Gets the texture.
Gets the width of the sprite in pixels, accounting for scale.
Sets the width.
Add and return a child object.
Object to add to the container.
Remove and return a child object.
Object to remove from the container.
Empty implementation from extending Entity.
Not used.
Not used.
An entity with additional properties for collision testing and display.
Example
// A 32x32 image is loaded into a texture, then the sprite // is created from that texture const texture = new Texture('assets/images/bullet.png') const bullet = new Sprite(texture) // Can also be combined into one line, e.g. // const bullet = new Sprite(new Texture('assets/images/bullet.png')) // Properties can then be set on the sprite. bullet.hitBox.set(4, 2, 16, 12) bullet.anchor.set(16, 16)