The new and improved map
For as good as the second project of this book looked, a lot of things about it were fairly primitive. Among its other shortcomings, the map design lacked complexity due to its inability to support tile layers. Having a more complex scene requires tiles being able to layer over each other, in a manner best represented by this illustration:
Adding layer support, as well as loading entity information after re-designing the way entities are handled requires some changes to be made to the map file format. Let's take a look at an example:
SIZE 32 32 DEFAULT_FRICTION 1.0 1.0 |ENTITY|Name|x|y|elevation| ENTITY Player 256.0 256.0 1 ... |TILE|ID|x|y|layer|solid| TILE 3 0 0 0 0 ...
While some map properties remain in place, things like gravity or background images have been removed, as it no longer suits the genre of the game we're making. The main changes here are the entity and tile lines.
Loading an entity is as simple as providing the name of its entity file and a few pieces...