Table of Contents
An entity is the most common type of active game object in Aquaria. The following things are all implemented as entities:
- Enemies, Bosses
- Collectibles (Food, Ingredients, Treasures)
- Objects that change size or position but that are not tiles, e.g. doors
Composition of an entity
Graphically, an entity can be a simple sprite (entity_setTexture()
) or a more advanced skeletal entity (entity_initSkeletal()
) that can also be animated.
In the editor
Entity edit mode lists all keyboard shortcuts.
Scripting
For scripting information, see Entity scripting
Most entities have a script attached. There are some exceptions, the following entities are handled internally and have no script:
- Gas Cloud (green cloud that does damage and applies a poison effect, appears in Mithalas cathedral)
- Avatar (Internal name for Naija)
- FlockEntity (Fish grouped in a school as placed by the
<SchoolFish>
tag in a map XML file). There are two variations: Fish that are spawned in the foreground do regular shot collision and die when hit; fish in the background are unkillable by normal means and purely decoration. - Ingredients
- ManaBall (the small sparkly bits that refill health when picked up)
- Spore (apparently does not normally appear in the game)
They can still be controlled by scripts though.
Li, on the other hand, is completely script controlled, but receives a lot of special handling in the game's code. The Li entity, if Li is enabled, is actually spawned before the map file is even loaded. So if you have any super-special code that must run before anything else on map load, put it inside li.lua's init()
function, and stick setFlag(1000, 100)
into your mod-init.lua's init()
function to enable Li from the very beginning.
Entity death
On death, an entity usually plays a sound effect and leaves a small puff of particles. Optionally, an entity may drop ingredients or a ManaBall. All of this can be controlled by scripting.
The defeat of special entities like bosses shall not be rushed. For this purpose, a death scene can be enabled that will delay an entity's death by some time while a script runs, e.g. a cutscene.
Once an entity is dead it will despawn. There is no way to revive a dead entity.
Some special entities (e.g. Naija, Li) must not be killed:
- In case Naija despawns, the game will crash immediately. This is normally not possible but a wrong
entity_delete()
can still accidentally delete Naija and cause a crash. - In case Li despawns without proper cleanup (
setLi(0)
), the game will crash next time it tries to do anything with Li.