|
VEGO-Engine
0.1
|
In order to create a map for your game the library has .tmx format support. In order to get .tmx files you use the associated tile editor "Tiled" which gets automatically downloaded when executing the VEGO libraries setup file (the installer is provided the installation itself must be finalized by the user). This section will walk you step by step through the creation of your first map/background using Tiled.
see also: the official Tiled documentation
After opening Tiled, select "New Map", a custom size measured in tiles and as tile size select 32x32 as this is the size the library currently supports. Also choose the size of your canvas, it is recommended you choose the same size as the one you defined in the games config (default is 25w x 20h, measured in tiles, to get the pixel size just multiply by 32 as that is the tilesize the library uses)
Once imported, you can select tiles from the tileset and use them to build your environment.
Tiled allows you to use multiple layers for organizing your map.
You need to give your Layers seperate z-Indices to decide their rendering order, the lower the number the earlier it gets rendered. In order to do this:
Important: Tiles that should have collision must be placed on a separate layer as custom properties are per layer not per tile.
To add collision to a layer:
Any tile placed on this layer will now automatically have collision—meaning moving entities cannot pass through them.
After completeing your map, save it in the asset folder of the library (or any place really the asset folder just exists as a recommendation to easily find all of your maps and textures)
The map gets loaded into the game in GameImplementation.cpp, simply add the path of the map .tmx file to the Map constructor