CSD UNIT 3, LESSON 20, Bubbles 4 & 8

[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: [replace with link to the curriculum or get the “Share” link to a project]

Student was trying to get something to happen (health counter to go down) when two sprites touched.

Instead, he got a red square on the coding line.

When looking at the sample, there is no red square next to the line.

Not sure what the comment at the bottom meant about overlap. Online I saw something about needing to define edges for the sprites…?

Screen Shot 2022-10-28 at 2.04.21 PM

Thank you!

Gary Ellis

Hi @gellis1,

The like to refer to this great post about overlap errors. Based on that post, the issue here is that “the programmer had stored a sprite inside a variable, then stored SOMETHING ELSE inside the variable”. If you take a look on line 53, a var aircraft variable is declared but it is already declared on line 5. So, I would suggest taking out the var on line 53. That might lead to a few other issues.

  • The health and score are overlapping but that can be adjusted with some tweaks to the x and y of each.
  • I noticed that “100” is placed in the text box on line 63. The “” around 100 mean the 100 will never change. How can the programmer change “100” from this literal string to the actual variable score?
  • Once the score is working, it will probably decrease for the entire time the two planes are touching…which is a long time and many points. This is a great post about methods to use to only decrease the score by one when the planes touch.

Hope these tips help!
~Michelle

It worked! Thanks, Michelle!

Gary