Designing the level in Tiled
Since we've already covered Tiled in an earlier chapter, we shall skip straight to the contents of the TMX file for a typical level. So, open up level_01.tmx
and you should see something like this:
This particular TMX file has a tileset with a tile of size 90
pixels. The tileset is designed in such a way that you can create any path that you wish by simply placing the appropriate tile.
Now you can see in the Layers window that there are two layers defined: an object layer named
PathObjects
and a tile layer named EnemyPath
. The PathObjects
object layer will provide us with every point where there is a change in the enemy's direction, represented by objects titled WalkPoint_0
, WalkPoint_1
, WalkPoint_2
, and so on.
In addition to this, the object layer also defines another object titled Pumpkin
that is nothing but the screen position of the pumpkin for this level. Let's now briefly glance at the CreateWalkPoints
function from GameWorld.cpp
where the CCTMXTiledMap
object...