# Unit 3 lesson 17 code help

**URL:** <https://forum.code.org/t/unit-3-lesson-17-code-help/33517>\
**Category:** Coding and Debugging Help\
**Created:** [October 12, 2020, 3:58pm UTC](https://forum.code.org/t/unit-3-lesson-17-code-help/33517 "2020-10-12T15:58:44Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![william.warren](https://avatars.discourse-cdn.com/v4/letter/w/b782af/32.png) [@william.warren](https://forum.code.org/u/william.warren)\
**Post date:** [October 12, 2020, 3:58pm UTC](https://forum.code.org/t/unit-3-lesson-17-code-help/33517/1 "2020-10-12T15:58:44Z")

</div>

[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.]

I had a student generate this for the Interactive Card project at the end of Unit 3 Chapter 1: [https://studio.code.org/projects/gamelab/mHBfm-SffZm88lQzcm6tinK2\_5qoIL\_8pzzlKtgWjMg](https://studio.code.org/projects/gamelab/mHBfm-SffZm88lQzcm6tinK2_5qoIL_8pzzlKtgWjMg)

They (and I) expected that each ball would disappear when clicked and then when a total of 3 clicks was recorded the net would become visible with the 3 balls “in” it.

The balls do not disappear when clicked.

I pared the code way down to try a variety of things. I changed the .visible = false to sprite.tint and sprite.rotation and was able to get changes. .visible continued to do nothing.

---

<div class="post-metadata">

**Author:** ![mwood](https://sea2.discourse-cdn.com/flex016/user_avatar/forum.code.org/mwood/32/4941_2.png) [@mwood](https://forum.code.org/u/mwood)\
**Post date:** [October 13, 2020, 3:28am UTC](https://forum.code.org/t/unit-3-lesson-17-code-help/33517/2 "2020-10-13T03:28:34Z")

</div>

@william.warren, This is a bit tricky, but … since your student drew the background outside of the draw loop (including the rectangle that is the grass), the background is drawn exactly once. Then, the balls are drawn (above the background) and then the draw loop executes the rest of the code.

When the balls are clicked, they should become invisible, however, that only happens by having the background drawn again to cover up the original instance of the balls. Since the background isn’t redrawn to cover up the original balls, they don’t disappear. They are no longer drawn, but the original drawing isn’t covered up.

The solution is to put the background (and rectangle) blocks inside the draw loop.

Hope this helps!

Mike
