Project 545: Grid Game

5. Use "Subtract Y" button to move down

Add code to the "Subtract Y" button to make Nano move down when the button is clicked on.
Starting point file for this challenge

Your goal

Steps

1. Add "when this sprite clicked"

We want Nano to move when we click on the button sprite, so we'll start with a "when this sprite clicked" block, from the "Events" tab. 

2. Increase 'Clicks' variable by 1

We are going to keep track of the number of moves it takes for us to get to a battery, so whenever we move Nano, we will add 1 to the number of clicks.

3. Add an "if ____ then ____" statement

Go to the "Control" tab and get a "if ____ then ____" statement

4. Check if Nano is at the bottom of the grid

Nano shouldn't be able to move down anymore once it is at the bottom of the grid. We need to check Nano's Y position so that we only make it move down when there is somewhere for it to go.

If Nano's Ypos is greater than -70 then that means it is not yet at bottom of the grid.

5. Move down

To make Nano move down, subtract 70 from the Y position variable.