Student Work

Challenge 3: Adding Screens to Shooting Monkeys Game

After completing lessons 1 to 18, you are ready for your third challenge! In Rock Paper Scissors you used the same endScreen whether the player won, lost, or tied. You could have had a different screen for each of these situtations and just displayed them at the appropriate time. This would have eliminated the need to update the text on the endScreen.

Generally, it is usually more elegant and requires less duplicate code to use one element for multiple purposes (as you did with the endScreen). However, sometimes you need to have multiple elements because the design of those elements, or the purpose of those elements, are too different.

Add an Intro Screen, Lose Screen, and Win Screen to the Shooting Monkeys game that you finished in Lesson 12. Here are a few suggestions:

Add a Start button to the Intro Screen and a corresponding start() function. In addition to hiding the Intro Screen, this function should start the gameTimer (instead of starting it when the page loads).

Add replay buttons to the Win and Lose screens that, when pressed, reloads the page.