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
Map Objects
MapObjects are objects placed on your tile map using the Tiled editor or utiLITI. They define where and how entities spawn in your game world. When a map is loaded, LITIENGINE’s MapObjectLoader implementations translate these map objects into game entities.
Map Object Types
LITIENGINE supports several built-in map object types:
| Type | Description | Entity Class |
|---|---|---|
CollisionBox | Static collision geometry | CollisionBox |
Creature | Movable combat entities | Creature |
Prop | Static or destructible objects | Prop |
Spawnpoint | Entity spawn locations | Spawnpoint |
Trigger | Area-based event triggers | Trigger |
LightSource | Dynamic lighting | LightSource |
Emitter | Particle effects | Emitter |
MapArea | Named areas for scripting | MapArea |
Adding Map Objects in utiLITI
Via Right-Click Menu
- Select an object layer in the map
- Right-click on the map view
- Choose Add -> [Object Type]
- Click and drag to define the bounding box
Via Resources Panel
- In the Resources tab, find your spritesheet
- Click the + button to create a map object
- The object is created with pre-configured dimensions
Map Object Properties
Each map object has configurable properties accessible in the utiLITI properties panel:
Common Properties
- Name: Unique identifier for the object
- Type: Entity type (CollisionBox, Prop, Creature, etc.)
- X, Y: Position in tile coordinates
- Width, Height: Bounding box dimensions
- Layer: Which object layer the object belongs to
Entity Properties
For entity-type objects:
- Sprite: Spritesheet to use for rendering
- Collision: Collision box dimensions and settings
- Tags: Comma-separated tags for entity queries
Loading Map Objects
Map objects are automatically loaded when loading an environment:
Game.world().loadEnvironment("level1");
// All MapObjects are converted to entities by MapObjectLoadersAccessing Loaded Entities
// Get entity by name
IEntity entity = Game.world().environment().get("my-entity-name");
// Get entities by type
Collection<Creature> creatures = Game.world().environment().getByType(Creature.class);
// Get entities by tag
Collection<IEntity> tagged = Game.world().environment().getByTag("enemy", "flying");Custom MapObjectLoaders
Create custom loaders for your own entity types:
public class MyEntityLoader extends MapObjectLoader {
public MyEntityLoader() {
super("MY_ENTITY_TYPE");
}
@Override
public Collection<IEntity> load(Environment environment, IMapObject mapObject) {
Collection<IEntity> entities = new ArrayList<>();
MyEntity entity = new MyEntity();
entity.setLocation(mapObject.getLocation());
entity.setWidth(mapObject.getWidth());
entity.setHeight(mapObject.getHeight());
entities.add(entity);
return entities;
}
}
// Register before Game.start()
Environment.registerMapObjectLoader(new MyEntityLoader());Spawnpoints
Spawnpoints define where entities appear in the level:
// Get a spawnpoint by name
Spawnpoint spawn = Game.world().environment().getSpawnpoint("enter");
// Spawn an entity at the spawnpoint
spawn.spawn(Player.instance());
// Use spawnpoint in world loaded event
Game.world().onLoaded(env -> {
Spawnpoint start = env.getSpawnpoint("start");
if (start != null) {
start.spawn(Player.instance());
}
});See Also
- Tile Maps Overview – Introduction to TMX maps
- Custom Properties – Entity property configuration
- Entity Framework – Entity system documentation
Last updated 2 months ago
Feedback / Collaborate
