Skip to content

Entity Annotations & Architecture Matrix

LITIENGINE uses declarative Java annotations to define static metadata (bounding boxes, movement velocity, combat stats, render layers) when entities are instantiated from map objects or spawned in code.


Interactive Collision Box & Pivot Visualizer

Experiment with entity dimensions and @CollisionInfo alignments to see how bounding boxes align with character feet in 2.5D top-down games:

Generated Annotation:
@EntityInfo(width = 32, height = 32)
@CollisionInfo(collisionBoxWidth = 16, collisionBoxHeight = 12, collisionBoxValign = Valign.DOWN)
Entity Sprite (Blue) vs Physics Collider (Red)

Built-in Entity Architecture Matrix

LITIENGINE includes 9 pre-built entity classes optimized for 2D level design and physics partitioning:

Entity Class Base Hierarchy Physics Collision Default Render Layer Primary Purpose & utiLITI Tool
Creature CombatEntityEntity Dynamic (Align.CENTER, Valign.DOWN) NORMAL Playable characters, NPCs, enemies with animation states and steering navigation.
Prop CollisionEntityEntity Static (Obstacle) NORMAL / SURFACE Interactive world objects (crates, trees, chests, destructible barrels).
Trigger Entity None (Sensor Area) NONE (Editor Overlay) Volume regions activating scripts, teleports, cutscenes, and quest dialogs.
Spawnpoint Entity None (Position Marker) NONE (Editor Overlay) Respawn locations, creature spawn anchors, and camera checkpoint nodes.
CollisionBox CollisionEntityEntity Static Solid Bounding Box NONE Invisible physics barriers preventing characters from walking through walls.
LightSource Entity None OVERLAY / Dark Ambient Dynamic radial or ambient 2D lighting nodes with real-time shadow casting.
StaticShadow Entity None SURFACE / SHADOW Static drop-shadow geometry baked below props and structures.
Emitter Entity None (Custom Particle Bounds) NORMAL / OVERLAY Particle systems spawning sparks, dust, weather, magic spells, and smoke.
SoundSource Entity None NONE Positional 2D audio emitter with automatic distance falloff attenuation.

Render Layer Hierarchy

Entities are sorted and rendered in strict depth order to guarantee proper occlusion:

graph TD
    A["RenderType.BACKGROUND<br/>(Parallax sky, distant mountains)"] --> B["RenderType.GROUND<br/>(Base terrain tiles, floors, paths)"]
    B --> C["RenderType.SURFACE<br/>(Ground decals, rugs, static shadows)"]
    C --> D["RenderType.NORMAL<br/>(Creatures, Props, Walls — Y-Sorted)"]
    D --> E["RenderType.OVERLAY<br/>(Tree canopies, roofs, dynamic lighting, weather)"]
    E --> F["RenderType.UI<br/>(HUD, healthbars, dialog text, inventory)"]

Available Annotation Reference

1. @EntityInfo

Configures dimensions and render layer placement:

Player.java
@EntityInfo(
    width = 32, // Entity width in pixels
    height = 32, // Entity height in pixels
    renderType = RenderType.NORMAL // Rendering layer
)
public class Player extends Creature { ... }
Parameter Type Default Description
width int 16 Bounding box width in pixels
height int 16 Bounding box height in pixels
renderType RenderType RenderType.NORMAL Layer depth for engine render sorting

2. @CollisionInfo

Configures physics bounding box dimensions, collision type, and alignment:

Chest.java
@CollisionInfo(
    collision = true,
    collisionBoxWidth = 16,
    collisionBoxHeight = 12,
    collisionBoxAlign = Align.CENTER,
    collisionBoxValign = Valign.DOWN
)
public class Chest extends Prop { ... }
Parameter Type Default Description
collision boolean true Enables/disables solid physics registration
collisionBoxWidth int -1 (Full Width) Collider width in pixels
collisionBoxHeight int -1 (Full Height) Collider height in pixels
collisionBoxAlign Align Align.CENTER Horizontal anchoring: LEFT, CENTER, RIGHT
collisionBoxValign Valign Valign.DOWN Vertical anchoring: TOP, MIDDLE, DOWN

3. @MovementInfo

Configures locomotion speeds and steering characteristics:

Goblin.java
@MovementInfo(
    velocity = 80, // Pixels per second
    acceleration = 20, // Acceleration rate
    deceleration = 40, // Deceleration rate
    turnOnMove = true // Face movement heading
)
public class Goblin extends Creature { ... }
Parameter Type Default Description
velocity float 0.0f Maximum movement speed in pixels per second
acceleration float 0.0f Speed increase rate
deceleration float 0.0f Speed decrease rate
turnOnMove boolean true Automatically updates sprite direction when moving

4. @CombatInfo

Configures health attributes and faction alignment:

Boss.java
@CombatInfo(
    hitpoints = 500,
    team = 2,
    isIndestructible = false,
    isTarget = true
)
public class Boss extends Creature { ... }
Parameter Type Default Description
hitpoints int 100 Maximum health points
team int 0 Team/faction ID for friend/foe targeting
isIndestructible boolean false When true, entity ignores all incoming damage
isTarget boolean true Can be selected and locked-on by abilities

5. @AnimationInfo

Binds spritesheet naming prefixes for automatic state animation:

Hero.java
@AnimationInfo(
    spritePrefix = "hero",
    spriteBatched = true
)
public class Hero extends Creature { ... }

See Also

  • Custom Entities


    Step-by-step guide to extending Creature, Prop, and registering custom loaders.

  • Ability Framework


    Attaching abilities, cooldowns, and combat effects with @AbilityInfo.