Step 2: Moving forward

In Level 2 our Chicken needs to move up and right, so we'll have to code in our Up arrow key and make sure our Chicken knows how to face in the Up direction.

Note: If you are still in the code editor, click the X button in the top right corner to return to the level editor by saving your code.

> Click on Level 2 in the levels tab to switch to Level 2.
> Right-click on the Chicken and select Edit Script.
> Click on Events and drag "When backspace/delete pressed" into the work space.
> Click on "backspace/delete" and change it to "up arrow".
> Click on Scratch Blocks and drag the "point in direction 90" block into the "When up arrow pressed" block.

In video games, we use 'degrees' to know which way our player character is facing. For instance, when facing to the Right our Chicken is at 0 degrees. But when facing Up, our Chicken is at 270 degrees.

Here's a picture to show you the different directions in 'degrees':

> To get our Chicken facing Up, let's click on "90" and change it to "270".
> Click on Scratch Blocks and drag the "move 10 steps" block into the work space. Then connect it under the "point" in the "direction 270" block.
> Change "10" steps" to "1" step.

You're done. Nice work!

Now you know which block to use to make the Chicken point in different directions. Let's use a "point in direction 0" block to ensure that the Right arrow key points the Chicken in the Right direction.

Our code should look like this:

> When you are ready to test your script, click Play and select Level 2 from the game menu.

If our Chicken can now move to Up and to the Right then we've completed this level and can continue to the next step.

Otherwise, have a look back over your Script and see if you can spot the bugs.

results matching ""

    No results matching ""