Help with Players Game Code

I hope someone can help my student figure out why his counter isn’t working. He has a very cool game. Please let me know if you need more info than what I’ve provided below. Thanks so much for your help!!

Link to the project or level: Game Lab -

What I expect to happen:
[var redBarrier1lives to go down by one upon contact with player 1 fire]

What actually happens: [var redBarrier1lives does not go down on contact with player 1 fire - no response]

What I’ve tried: [tried switching variables. Also have been using the watcher to see that the counter is not working.]


This does look like an amazing game.

I think I have found the problem… He has two different statements that check for the collision. There is one on line 145 and one on line 77. The one on line 77 is never triggering and that’s where the lives would be updated.

The one on line 145 triggers first and then it moves the player1fire back off the screen. The next time through the draw loop, it encounters line 77 and the fire isn’t touching because it was moved off the screen.

He should have the lives deducted right after the collision moves the fire off the screen and there probably shouldn’t be two different places in the code to check for the collision.

This should help, but please check back in if it still isn’t working!


You are so helpful : - ) My student read your message and was able to correct the problem. He and I are very grateful. Thank you so much!!!