Help with Lesson 17 Interactive Card Project

Hello, I have a student that came up with code to have a hammer break an aquarium tank. He would like to have the pieces continue moving and not go back to normal after the mouse moves back to the right of the grid. Does anyone know how this might be possible? Here is a link to his code:


Another fun project! What I suggest is creating a variable at the top of the program called “broken”. I start it off by saying var broken=false; (the tank isn’t broken).

Then, Instead of using

if hammer.x<= 310

I would use

if (hammer.isTouching(aqua)) {
broken = true;

It seems a little more precise as it requires the hammer to hit the tank to start the process.

The “else” of that clause would contain all of the blocks that hide the glass shards and show the tank.

Then, a separate conditional clause would say,

If broken== true

… That clause would contain all of the blocks that show the shards and hide the tank and make them move.

I think that should make it work, but if not, check back in and we can help further!

Good luck!


I forgot one more thing … right now, there is a lot of empty space around the tank and around the hammer (in the animation tab). I would suggest removing that empty space. Your student can do that by opening the animation tab and selecting each sprite (one at a time). Click on the “crop sprite” icon on the right side of the tool panel (5th one down … below the onion skin). This will remove all of the empty pixels and make the collisions much more precise.


Thank you Mike! Here is what it looks like at this point.

I will pass along your recommendations and have him work through the code.

That looks great!