Defining the XML file for a level
We could just as easily have used a single XML file that gives us information on the enemy's path as well as the waves that will comprise the level. However, since we already have some experience on Tiled, we will use it to create the enemy path and use our XML file to store details about the waves for a given level.
As such, the XML file for a typical level contains information about waves in which enemies will attack the field and will look like this:
<Level cash="150"> <Wave spawn_delay="2" enemy_list="0,0,0,0,0,0,0,0" /> <Wave spawn_delay="3" enemy_list="1,0,1,0,1,0,1,0" /> <Wave spawn_delay="1.5" enemy_list="0,0,1,0,0,1,0,0,1" /> . . . </Level>
The root element of the document titled Level
contains an attribute to describe how much cash the player starts out with. We then have a number of Wave
tags, each describing a single wave. Each Wave
tag contains two attributes: spawn_delay
and enemy_list
. The spawn_delay...