Skip to content

Update Maps in Tiled

alekmaul edited this page Oct 9, 2023 · 23 revisions

You must now have a tmx file with a tileset properly configured for Tiled. We need now to update tile properties for map engine. If not, read 1st part of the tutorial to create it (https://github.com/alekmaul/pvsneslib/wiki/Import-maps-for-Tiled)

Update tile properties

On the screen below, click on "Edit Tileset" button to open a new tab with tileset properties.

If you used the converter tool described in Part1, you will have 3 properties for each tile ("attribute", "palette" and "priority"). If not, select all the tiles on the right with the mouse and use the "+" button on the bottom left to add the 3 properties.

Now select the tiles as shown below (red rectangles to show the tiles) to change their "attribute" property to FF00 to describe them as blocker. Our hero will not be able to pass through them.

Do the same with pillars (again, red rectangles to show the tiles) to change priority property to 1, to allow our hero to pass behind them.

If you have a tileset with multiple palettes, you can do the same with the "palette" property of each tile.

The property "attribute" is special, some values are managed by the map/object engines.

  • FF00 is for solid tiles, objects can't pass through them
  • 0002 will change action property of object to ACT_BURN value (see object.h file of PVSneslib)
  • 0004 will change action property of object to ACT_DIE value (see object.h file of PVSneslib)

"attribute" property value 0002 or 0004 will need to be managed in your code.

Export map in jSON format

To export your map in a format usable with PVSnesLib, you need to click on the first tab named tiled.tmx, to be on the map file and not on the tiles part of the map. You also need to use menu Map, option Map properties... to have the correct properties. Select CSV as Tile Leyer Format.

Then, choose File/Export and save the file in json format. Name the file tiled.tmj (Type is JSON map files(*.tmj *.json)). Next time, Tiled will not ask you about a filename as you previously saved your file in json format.

Next tutorial will explain how to code the first part to display the map on screen.