Default Entity Types¶
Master Entity Blueprint Matrix¶
Choose the optimal entity type for your game objects:
| Entity Type | Purpose / Use Case | Default Collision | Key Annotations | utiLITI Object Type | Key Behaviors & Hooks |
|---|---|---|---|---|---|
Creature |
Living characters, NPCs, enemies, players | Yes (Dynamic box) | @EntityInfo, @MovementInfo, @CombatInfo, @CollisionInfo |
CREATURE |
onMoved, onHit, onDeath, onResurrect |
Prop |
Interactive/static map objects (chests, trees, pots) | Configurable | @EntityInfo, @CollisionInfo |
PROP |
onHit, onDeath, PropState |
Trigger |
Invisible event zones (doors, cutscenes, teleporters) | Sensor only | @EntityInfo |
TRIGGER |
addActivatedListener, addDeactivatedListener |
Emitter |
Particle sources (fire, weather, explosions) | None | @EntityInfo |
EMITTER |
onFinished, data().setEmitterDuration(...) |
LightSource |
Dynamic/static ambient lights & torches | None | @EntityInfo |
LIGHTSOURCE |
activate(), deactivate(), setColor() |
Spawnpoint |
Level entry points and entity spawn markers | None | @EntityInfo |
SPAWNPOINT |
onSpawned, spawn(IEntity) |
CollisionEntity |
Invisible collision barrier / obstacle | Configurable (defaults to DYNAMIC) | @CollisionInfo |
COLLISIONBOX |
onCollision, setCollision(boolean) |
LITIENGINE provides a hierarchy of built-in entity types. Each type builds upon the previous, adding more functionality.
Entity Hierarchy¶
IEntity
└── Entity (base class)
└── CollisionEntity (has collision)
└── CombatEntity (has health/combat)
├── Creature (has animation, movement, facing)
└── Prop (static/dynamic destructible objects)
Entity¶
The base class for all game objects.
public class MyEntity extends Entity {
public MyEntity() {
super("my-entity");
setLocation(100, 100);
setSize(32, 32);
}
}
Key Properties¶
- Name: Unique identifier
- Location: X/Y position in the world
- Size: Width and height
- MapId: ID from map object
- Tags: String tags for categorization
- RenderType: Rendering layer (
NONE,BACKGROUND,GROUND,SURFACE,NORMAL,OVERLAY,UI)
CollisionEntity¶
Extends Entity with collision detection capabilities.
@EntityInfo(width = 32, height = 32)
@CollisionInfo(collisionBoxWidth = 28, collisionBoxHeight = 28, collision = true, collisionType = Collision.STATIC)
public class Wall extends CollisionEntity {
public Wall() {
super("wall");
}
}
Collision Types (Collision)¶
DYNAMIC(default): Collides with static geometry and other dynamic entities (used for actors, creatures, moving obstacles).STATIC: Immovable geometry that dynamic entities collide against (used for walls, map boundaries).NONE: Disables collision resolution for this entity.ANY: Special filter flag used exclusively forPhysicsEnginespatial queries and raycasts (cannot be assigned directly to an entity'scollisionType).
Key Properties¶
- Collision box dimensions and offset
- Collision type (
DYNAMIC,STATIC,NONE)
CombatEntity¶
Extends CollisionEntity with health and combat mechanics.
@EntityInfo(width = 32, height = 32)
@CombatInfo(hitpoints = 100, team = 1)
public class Destructible extends CombatEntity {
public Destructible() {
super("destructible");
}
}
Key Properties¶
- Hitpoints: Current and maximum health
- Team: For friend/foe identification
- Indestructible: Cannot be damaged
- Target: Can be targeted by abilities
Events¶
combatEntity.onHit(hitEvent -> { /* took damage */ });
combatEntity.onDeath((victim, hitEvent) -> { /* died */ });
combatEntity.onResurrect(resurrected -> { /* revived */ });
Creature¶
The most feature-rich entity type for living characters. Extends CombatEntity with movement, directional facing, and state animation controllers.
@EntityInfo(width = 18, height = 18)
@MovementInfo(velocity = 70, acceleration = 10)
@CombatInfo(hitpoints = 50)
@CollisionInfo(collisionBoxWidth = 14, collisionBoxHeight = 16, collision = true)
public class Player extends Creature {
public Player() {
super("player"); // Spritesheet name
}
}
Features¶
- Automatic animation controller from spritesheets
- Movement controller integration
- Facing direction tracking (
Direction.UP,DOWN,LEFT,RIGHT) - State management (
idle,walk,dead)
Key Methods¶
creature.getFacingDirection(); // Current facing direction
creature.setSpritesheetName("player-alt"); // Change spritesheet animation source
creature.isIdle(); // Check if not moving
creature.isDead(); // Check if dead
Prop¶
Static or interactive objects in the game world. Extends CombatEntity directly (does NOT inherit creature movement).
@EntityInfo(width = 32, height = 32)
@CollisionInfo(collision = true)
public class Barrel extends Prop {
public Barrel() {
super("barrel"); // Spritesheet name
}
}
Prop States¶
- INTACT: More than 50% health or indestructible
- DAMAGED: Less than 50% health
- DESTROYED: Zero health
State-based Spritesheets¶
Other Entity Types¶
Trigger¶
Area-based event triggers activated on collision or user interaction.
Trigger trigger = new Trigger(TriggerActivation.COLLISION, "door_sensor", "open_door");
trigger.addActivatedListener(event -> {
IEntity entity = event.getEntity();
// Action triggered when entity enters zone
});
trigger.addDeactivatedListener(event -> {
// Action triggered when entity leaves zone
});
LightSource¶
Dynamic lighting entities.
LightSource light = new LightSource(150, Color.ORANGE, LightSource.Type.ELLIPSE, true);
light.setLocation(100, 100);
Game.world().environment().add(light);
Emitter¶
Particle effect sources.
Emitter emitter = new Emitter(100, 100);
emitter.data().setEmitterDuration(5000);
Game.world().environment().add(emitter);
emitter.activate();
Spawnpoint¶
Entity spawn locations.
Spawnpoint spawn = new Spawnpoint(Direction.RIGHT);
spawn.setName("player_start");
spawn.setLocation(100, 100);
spawn.spawn(new Player());
Choosing the Right Type¶
| Use Case | Entity Type |
|---|---|
| Decorative object, no interaction | Entity |
| Wall, obstacle | CollisionEntity |
| Destructible object with health | CombatEntity or Prop |
| Player, enemies, NPCs | Creature |
| Interactive objects | Prop |
| Area triggers | Trigger |
| Lighting | LightSource |
| Particle effects | Emitter |
See Also¶
- Entity Framework Overview - Entity system intro
- Annotations - Configure entities
- Props - Detailed prop documentation