Using TiledMap to create your 2D game level

With TiledMap, developing 2D games in WaveEngine will not be the same anymore. Tiled maps have been used for a long time in games, now you can load and integrate TiledMap (.TMX) files, created by the Tiled Map Editor (http://www.mapeditor.org/), the most popular map editor based in tiles. With Tiled, you can easily design your 2D map levels and run in WaveEngine like a charm.

Load a TiledMap (.tmx) in WaveEngine

1. Install WaveEngine.TiledMap NuGet package

First of all, you need to install WaveEngine.TiledMap NuGet package into your Game solution. This action allows you to use the TiledMap components into your project:

2. Copy Tiled assets to your WaveEngine project

Copy all Tiled assets to your Content folder in Wave Visual Editor:

  • The .tmx file that contains the tiled map
  • All tileset images, keeping the same directory structure referenced by .TMX file.

3. Load the TMX map

Now we want to create a Wave Entity that holds the Tiled Map information.

  • Drag the .tmx file from the Asset Details panel to the Viewport. It will automatically create an entity with a TiledMap component using our .tmx file:
  • After that, you will see your TiledMap loaded into Wave Visual Editor:

TiledMap component

TiledMap component is responsible for the control and instantiate of each of the tiled layers. So, for every tiled layer defined in your .tmx file, it will create a child entity that constructs a layer mesh and draws it.

These child entities have its own Transform2D component, so you can translate, rotate, and scale each layer separately.

Please, take a look at our great TiledMap example, available here.

Leave a Reply

Your email address will not be published. Required fields are marked *