Find the gold LIVES challenge

We are using the CTCT curriculum and are having difficulty with the "lives" challenge which starts lives @ 5 and every time we hit a wall lives goes down 1. The game functions properly until we put in the blocks to lower lives as outlined in the challenge. When these blocks are put in the ball goes thru the wall. any help?

I see you setting up the Sprite VerticalWall1 twice, and I don't see any blocks that set up a Sprite VerticalWall2, which I imagine you would need to add the fourth wall to a box on the Canvas.

Is that your missing wall?

If this does not help,

Export your .aia file and upload it here.

FindTheGold2.aia (565.9 KB)
Thanks but that is not the issue as everything works fine BEFORE adding the if, then, else for lives.

You will notice if those blocks are removed, it restarts as it is supposed to when ball hits wall

You are asking Lives.Text to serve double duty, as a verbose display and as a pure number for arithmetic.

You cannot subtract 1 from "Lives: 5".
The text breaks the math block.

A better approach would be to keep the text "Lives:" in a Label preceding the Lives Label in a Horizontal Arrangement.

Alternatively, init a global LIVES variable to 5, and decrement that instead.
Use the text JOIN block to prefix it with text "Lives:" when you want to update the display.

I was thinking it needed the Global initialization and maybe something else. Thanks for catching the fact we need a separate label for the number.

I thought I was going crazy because the 4 units in the CTCT curriculum, I dont think the curriculum touched on that yet. Maybe I will have the students focus on the timer instead as that doesnt seem to require much beyond what is on the page.

it dont works

Welcome Yehia.

What does not work? The aia code in this discussion (see post number 2) is almost complete . Sorry the posted code does not entirely work. You have to fix the code to make it work. The discussion explains one of the reasons the code does not work as posted however no one posted the solution.