docsReading time: 3 minutes
General
Basics
- Getting Started
- Game API
- Input API
- Configuration
- Tile Maps
- Resource Management
- Entity Framework
- Control Entities
- User Interface
- utiLITI
- Deployment
- Savegames
- Libraries and Tools
- Glossary
Advanced
- The Particle System
- Dynamic Lighting
- Static Lighting
- Performance Optimization
- Custom MapObjectLoaders
- String Localization
- Object Serialization
- Utility Classes
- Network Communication
- Advanced Entity Knowledge
Tutorials
Default Entity Types
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)
└── Prop (static/dynamic 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 (BACKGROUND, GROUND, NORMAL, OVERLAY, UI)
CollisionEntity
Extends Entity with collision detection capabilities.
@EntityInfo(width = 32, height = 32)
@CollisionInfo(collisionBoxWidth = 28, collisionBoxHeight = 28, collision = true)
public class Wall extends CollisionEntity {
public Wall() {
super("wall");
}
}Collision Types
- STATIC: Collides with static geometry
- DYNAMIC: Collides with moving objects
- ANY: Collides with everything
- NONE: No collision
Key Properties
- Collision box dimensions and offset
- Collision type
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(event -> { /* took damage */ });
combatEntity.onDeath(event -> { /* died */ });
combatEntity.onResurrect(event -> { /* revived */ });Creature
The most feature-rich entity type. Combines collision, combat, movement, and animation.
@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"); // spritePrefix
}
}Features
- Automatic animation from spritesheets
- Movement controller integration
- Facing direction tracking
- State machine (idle, walking, dead)
Key Methods
creature.getFacingDirection(); // Current facing direction
creature.setSpritePrefix("prefix"); // For animation lookup
creature.isIdle(); // Check if not moving
creature.isDead(); // Check if deadProp
Static or interactive objects in the game world.
@EntityInfo(width = 32, height = 32)
@CollisionInfo(collision = true)
public class Barrel extends Prop {
public Barrel() {
super("barrel");
}
}Prop States
- INTACT: More than 50% health or indestructible
- DAMAGED: Less than 50% health
- DESTROYED: Zero health
State-based Spritesheets
prop-barrel-intact.png
prop-barrel-damaged.png
prop-barrel-destroyed.pngOther Entity Types
Trigger
Area-based event triggers that activate when entities enter.
Trigger trigger = new Trigger("myTrigger", TriggerActivation.PROPAGATE);
trigger.onActivated(e -> { /* entered */ });
trigger.onDeactivated(e -> { /* exited */ });LightSource
Dynamic lighting entities.
LightSource light = new LightSource();
light.setIntensity(150);
light.setColor(Color.ORANGE);Emitter
Particle effect sources.
Emitter emitter = new Emitter("fire");
emitter.getData().setEmitterDuration(5000);Spawnpoint
Entity spawn locations.
Spawnpoint spawn = new Spawnpoint("start", Direction.RIGHT);
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
Last updated 2 months ago
Feedback / Collaborate
