Step 4: Using W-A-S-D instead of arrow keys

Many gamers like to use their left hand to control movement. This means we need to code in our W, A, S and D keys for them to use.

> Click on Level 4 to open it.
> Right-click on the Chicken and select Edit Script.

Oh no! Someone has pinched most of our Chicken's script blocks. Probably aliens.

Okay, let's repair the damage by figuring out how to code W for Up, S for Down, A for Left, and D for Right.

And remember that we need to use degrees for directions in video games?
Up = 270
Down = 90
Left = 180
Right = 0

Let's get coding!

If you need to check that you're on the right track at any point, have a look at the picture and compare this example script with your own.

Note: You can always remind yourself about previous steps by clicking on the circles at the top of the lesson.

When you are making your own game you can use any combination of keys (inputs) that you like. Or if you wanted to make a two-player game you could use your arrows AND W-A-S-D in the one game. Just remember to make sure your controls are comfortable for your players to use. For instance, Y-A-L-B isn't such a great combination unless your player has very big hands.

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

Once you've successfully used the W, A, S and D keys to direct our Chicken to the Coin, we can continue to Step 5.

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

results matching ""

    No results matching ""