-
Notifications
You must be signed in to change notification settings - Fork 1
Creating Game Maps and Areas
- Creating Game Maps and Areas Game maps and areas define the environment and locations where your story's events take place. In this section, we'll cover how to create and use game maps and areas using Audax Engine.
Step 1: Create a Game Map Class To create a game map, create a new class that extends the GameMap class provided by Audax Engine. For example:
java Copy code package me.adversing.story.map;
import me.adversing.engine.obj.map.GameMap; import me.adversing.engine.obj.map.info.GameMapInformation;
public class FirstGameMap extends GameMap { public FirstGameMap() { super(new GameMapInformation("map-1", "First Map", "Test")); } } Step 2: Create a Game Area Class To create a game area, create a new class that extends the GameArea class provided by Audax Engine. For example:
java Copy code package me.adversing.story.map.areas;
import me.adversing.engine.obj.map.area.GameArea; import me.adversing.engine.obj.map.area.info.GameAreaInformation; import me.adversing.engine.obj.map.properties.Accessible;
import java.util.ArrayList; import java.util.List;
public class FirstGameArea extends GameArea implements Accessible { public FirstGameArea() { super(new GameAreaInformation("area-1", "Prima area", "Test", new ArrayList<>(), List.of()), new ArrayList<>()); }
@Override
public void onEnter() {
// Implement any actions when the character enters the area.
}
@Override
public void onExit() {
// Implement any actions when the character exits the area.
}
} Step 3: Configure Game Maps and Areas In the constructors of your FirstGameMap and FirstGameArea classes, you can configure their properties.
For the FirstGameMap, provide information such as the map ID, title, and description.
java Copy code public FirstGameMap() { super(new GameMapInformation("map-1", "First Map", "Test")); } For the FirstGameArea, provide information such as the area ID, title, description, accessible areas, and blocked areas. Additionally, implement the onEnter and onExit methods to define actions when the character enters or exits the area.
java Copy code public FirstGameArea() { super(new GameAreaInformation("area-1", "Prima area", "Test", new ArrayList<>(), List.of()), new ArrayList<>()); }
@Override public void onEnter() { // Implement any actions when the character enters the area. }
@Override public void onExit() { // Implement any actions when the character exits the area. } With these steps, you have successfully created game maps and areas using Audax Engine. Game areas can be used to structure the environment and locations in your interactive story.