Background Image

[Posts in the debugging category need to have the following pieces of information included in order to help other teachers or our moderator team best help you. Feel free to delete everything in brackets before posting your request for debugging help.]

Link to the project or level: https://studio.code.org/projects/applab/uWUC_Eom0_UDbZ-_07pUDEd1OaDMXVHvHYX8QjxBWUU
What I expect to happen: lives variable should subtract 1 everytime background image is clicked. When it reaches zero the end game screen should appear.
**What actually happens:**Each time the background image is clicked it goes directly to the end screen.
What I’ve tried: console.org shows only 1 life subtracted even though if statement calls for 3 misses for the game to end. It is not a background in the screen but a separate image. We tried using the URL and uploading the image to assets. This student had the same problem with the 1st clicker program. It only worked with mouseover but not with click.

You have two event handlers for the click on background image. Remove lines 8-10 and your program will work as expected.

2 Likes