Project 545: Grid Game

4. Set up Nano and Variables

We are going to combine the X and Y axis we just talked about to make our grid game. In this project we are going to be using variables to track Nano's X and Y position, so we have to set those numbers at the beginning of the game, and also tell Nano to use them to control its movement.
Starting point file for this challenge

Your goal

Steps

1. When green flag clicked

To start our code, add a "when green flag clicked" block from the yellow "Events" tab.

2. Set Xpos to 0

Go to the orange "Variables" tab and get the "set ____ to __" block. Click on the second word to get a list of variables. Select 'Xpos' and make the number 0.

3. Set Ypos to 0

Again, go to the orange "Variables" tab and get the "set ____ to __" block. Click on the second word to get a list of variables. Select 'Ypos' and make the number 0.

4. Tell Nano to use the variable

In order for Nano to use the variables, we have to tell it to always go to the position that the variables say.