Use Tiled with Salmon - AgoutiGames/RawSalmonEngine GitHub Wiki
Download
Just get the newest tiled from here: Tiled Homepage All following instructions base on tiled version 1.3.3.
Setting up the map file
Click on "new map" and adjust settings to your liking.
- Map size: Infinite is currently not supported.
- Also the Tile layer format: Base64 (Zstandard compressed) doesn't work either!
Adding a tileset
Again adjust settings to your liking. Margin means the space in pixels around the whole tileset image and spacing refers to the space between each tile in the tileset. You can either embed the tileset inside the mapfile or save it seperately so it can be used for multiple maps.
- Type: Collection of images is not supported
Create and use actors/characters
A character is an actor with a set type which can be more easily augmented with code inside its character class. In this section we will refer to them as plain actors because there is no big difference inside Tiled between them.
Creating an actor template from a tile
Actors are the heart of every game. They can easily be directly controlled (animated, moved, resized, rotated) by the game code. Open a tileset inside Tiled and click on the tile you want to use as an actor. You have to set the following Properties of the tile:
- Type: Set to the class name of the character (or to ACTOR_TEMPLATE when not using SalmonEngine wrapper)
Custom Properties (All uppercase!):
- ACTOR_NAME: The name of the actor template. It's used to create additional actors from this template during runtime.
- ANIMATION_TYPE: Set to NONE if actor has no animation and exactly this tile should be displayed
- DIRECTION: Set to NONE, UP, DOWN, LEFT or Right to determine with which animation variant the actort starts out. Is ignored when ANIMATION_TYPE is NONE.
All differently named custom properties are stored and set inside the actor and can be retrieved inside each init() function.
Add an actor instance to the map
You have to add an object layer to the map layers inside Tiled. Do this by clicking on "Layer", "New" and "Object Layer" in the upmost bar. Then give the layer a unique name. When this new layer is highlighted click on "Insert Tile" in the tool bar (or press T). Then click on the tile you set up before inside the tileset view. When the correct tile is highlighted click somewhere into the map to place your actor. You can drag around your newly added actor by selecting "Select Objects" in the tool bar (or press S). Don't forget to add a unique name to the "Name" Property on the left of the just added actor instance.