We show the goal on the screen, but we want to detect when the player touches the goal and then end the game.
The first thing we need is a boolean variable that keeps track of whether or not the game is over. This should be initialized to false.
Now that we have this variable, we can set it to true when the player touches (collides with) the goal that we just added.
We can add a check_goal_collisions() function to detect when the player collides with the goal object. If that happens, we set the game_over flag to true.
We're also temporarily adding a "dummy" version of the collide() function. This dummy version does nothing except return false (meaning no collision found). We'll be creating a proper version of collide() once we finish hooking up the goal collision code. We'll add a "NYI" comment to indicate that it's "Not Yet Implemented".
Since we'll be doing a lot more collision detection, we might as well create a check_collisions() function that will check for all the collisions that we care about in the game.
Right now, we only have goal collisions, so we only need to call check_goal_collisions(). We'll be adding more to this function later.
And finally, we need to call our check_collisions() function. We need to do that in update_world() so that the game checks for collisions whenever anything moves on the screen.
The only thing missing is a proper collide() function. We'll add that now.