Templates and the Map
Templates
allow you to define all the objects (obstacles, items, characters…) in your game. Each template
is represented by a character that you define (e.g., “X”, ”$”, “e”, ”#”). You can then define a set of properties for each of these templates
and use them in the map
.
For each template
, you can define the following properties:
sprite
(optional): Defines how the object will be represented (see sprites)dialog
(optional): Defines a message to open in the dialog box when the player interacts with this object.sound
(optional): Defines a sound to play when the player interacts with this object (see sounds).solid
(optional): Defines whether the player can pass through this element or not.visible
(optional): Defines whether the element is visible or not.end
(optional): Marks the element as a game-ending condition, triggering the end of the game when interacted with. Theend
property is a string representing the end message displayed to the player when they encounter the element.
Map
The map
configuration defines the layout of the game world in ASCII. Each character in the map
corresponds to a template
defined in the templates
configuration. The map
represents the spatial arrangement of game elements like walls, floors, obstacles, and interactive objects.
Drawing the map is similar to drawing a sprite.
- Each character used in the
templates
is interpreted. - Spaces, tabs, and empty lines are ignored.
- Any other character represents an empty tile.