| name | fxgl-metroidvania |
| description | Build a Metroidvania in FXGL — connect multiple platforming rooms, transition between Tiled maps at screen edges, gate progression behind movement abilities, persist room state and item pickups, add a map overlay for explored rooms, support save points and fast travel, and handle backtracking through an interconnected world.
|
| triggers | ["metroidvania","ability gate","room transition","save statue","map overlay","double jump","wall slide","dash","backtracking"] |
| compatibility | Java 17+, FXGL 21.x. Combines patterns from fxgl-platformer, fxgl-level-assets, fxgl-ui-scenes, and fxgl-save-load.
|
| category | fxgl/game-types |
| tags | ["fxgl","java","javafx","game-types","metroidvania"] |
| metadata | {"author":"fxgl-skills","version":"1.0","fxgl-version":"21.1"} |
| allowed-tools | ["Read","Write","Edit","Bash"] |
FXGL Metroidvania
World Structure
Model the world as room coordinates rather than one giant map.
public record RoomCoord(int x, int y) {}
private final Map<RoomCoord, String> worldMap = Map.of(
new RoomCoord(0, 0), "rooms/room_0_0.tmx",
new RoomCoord(1, 0), "rooms/room_1_0.tmx",
new RoomCoord(1, 1), "rooms/room_1_1.tmx"
);
private RoomCoord currentRoom = new RoomCoord(0, 0);
Room Transition
private void loadRoom(RoomCoord room, String entryPoint) {
currentRoom = room;
getGameWorld().clearLevel();
setLevelFromMap(worldMap.get(room));
Entity spawn = getGameWorld().getSingleton(e -> e.isType(EntityType.SPAWN_POINT)
&& e.getString("name").equals(entryPoint));
player.setPosition(spawn.getX(), spawn.getY());
applyRoomState(room);
}
Use edge triggers or named exits in Tiled to move to adjacent rooms.
Ability Flags
public final class {
hasDoubleJump;
hasDash;
hasWallSlide;
hasGrapple;
}
();