Modifying Example Projects¶
A great way to learn LITIENGINE is to clone, run, and experiment with existing sample projects. This tutorial walks you through modifying SERVUS BONUS, an open-source 2D action game created with LITIENGINE.
1. Getting the Project¶
Clone the repository and build the project using Gradle:
2. Code vs. utiLITI: Where to Make Changes¶
When modifying a LITIENGINE game, changes are typically divided between Java Code (logic, controllers, physics) and the utiLITI Editor (sprites, animations, maps, entity placement):
| Game Aspect | Best Modified In | How It's Configured |
|---|---|---|
| Movement Speed | Java Code | @MovementInfo(velocity = ...) on Entity class |
| Combat Cooldowns & Abilities | Java Code | Ability subclass or @AbilityInfo attributes |
| Creature Sprites & Animations | utiLITI Editor | Sprite Editor & Keyframe durations in game.litidata |
| Map Layout & Enemy Placements | utiLITI Editor | Drag-and-drop objects onto map layers |
3. Practical Modification Examples¶
A. Adjusting Player Movement Speed (Code)¶
Open src/main/java/de/gurkenlabs/ldjam44/entities/Player.java:
// Increase velocity from 70 to 140 for double movement speed
@MovementInfo(velocity = 140)
@CollisionInfo(collisionBoxWidth = 8, collisionBoxHeight = 16, collision = true)
public class Player extends Creature {
// ...
}
B. Customizing Attack Cooldown (Code)¶
Open the combat ability class (e.g. Hit.java):
// Reduce cooldown from 1000ms to 250ms for rapid attacks
@AbilityInfo(cooldown = 250, range = 24)
public class Hit extends Ability {
public Hit(Creature executor) {
super(executor);
}
}
C. Modifying Spritesheets and Animations (utiLITI)¶
- Launch utiLITI and open
game.litidatafrom the project directory. - In the Spritesheet shelf, select
monger-walkormonger-attack. - Adjust keyframe durations (e.g. changing
100, 100, 100to50, 50, 50to speed up the animation). - Save the
.litidatafile and restart the game to see the updated visual pacing!
4. Next Steps¶
- Explore creating custom maps in utiLITI: Import Maps with utiLITI
- Learn about the full entity lifecycle: Entity Framework Overview