Chapter 8: Adding a UI
It may appear that we've developed everything we need for a video game, and to some extent, we have, except for that annoyance where we need to hit refresh every time little Red Hat Boy (RHB) hits a rock. A real game has buttons for a "new game" or "high scores", and in this chapter, we'll be adding that UI. To do so may seem trivial, but event-driven UIs that you might be familiar with from web development are an odd fit with our game loop. To add a simple button, we'll need to make significant changes to our application and even write a little HTML.
In this chapter, you'll do the following:
- Design a new game button
- Show the button on game over
- Start a new game
At the end of the chapter, you'll have the framework in place for a more full-featured UI and the skills to make it work.