Summary
There was quite a lot of code in this chapter. We learned how to read from a file and convert strings of text into char
values and then into int values
. Once we had a two-dimensional array of int
values, we were able to populate a VertexArray
instance to show the level on the screen. We then used the same two-dimensional array of int
values to implement collision detection. We used rectangle intersection, just like we did in the Zombie Arena project, although this time, for more precision, we gave each character four collision zones – one each to represent their head, feet, left, and right-hand sides.
Now that the game is totally playable, we need to represent the state of the game (score and time) on the screen. In the next chapter, we will implement the HUD, along with some much more advanced sound effects than we have used so far.