This week I restructured some of the code in draw() to make the program more readable and added initializeGame() to allow the game to start over if the player loses.
With the restructuring, my attempt was to make draw() the table of content to the rest of the program and only include logic that starts, restarts, and stops the game. However, I think the overall structure is still very messy. For instance, do I need to have a function to draw the background and a function to move it? Also, should initializeGame() and play() be in the same function? I think being able to figure out some of these structural issues and feeling more comfortable and confident building these structures would bring my programming skills to the next level.
initializeGame() is not working very well right now, because play() is still running. So the obstacle objects end up repeating when the player loses and click to restart the game. Again, I think this is a structure issue.
For the next step, I would like to do a better job restructuring the whole program and add new levels.