Parsing object layers
The final topic we will cover in this chapter is loading objects from our Tiled map file. This is extremely useful and takes the guesswork out of placing objects within a level. Open up the Tiled application and we can create our first Object Layer by clicking Layer | Add Object Layer. This will create a new layer called Object Layer 1 as shown in the following screenshot:
We can create objects and assign any values and properties we want on these layers. First we will create a rectangle. Press R and click anywhere on your tile map, you will see a small square appear, as shown in the following screenshot:
Right-click on this square and click on Object Properties…. This will bring up the object properties dialog as shown in the following screenshot:
Here, we can set the values we want our object to have, just like our previous state XML files. Go ahead and fill in the dialog box as shown in the preceding screenshot. The positions and sizes of this dialog box deal in tiles...