Project 114: Ant Racing

3. Make Racer #1 turn left

Get your Racer #1 sprite to turn to the left when you press the left arrow on your keyboard.
Starting point file for this challenge

Your goal

Steps

1. Add a "When green flag clicked" block

You can find the block in the yellow "events" section.

2. Add a "turn left" block

You can find it in the dark blue "motion" section. When you click the green flag after adding the block, your Racer #1 should turn slightly to the left. 

3. Repeat your code with a forever loop

We don't want the motion to just happen once – we want it to repeat. To repeat code, we need to add a loop. Add a forever loop to keep your racer turning. Don't worry, we'll control the turn in the next step. You can find the forever loop in the orange "control" section.

4. Add an if-statement

It's great that the turning repeats, but the racer shouldn't turn automatically – it should only turn when we press down the left arrow key. This kind of functionality means our code has to make a decision. 

If we want our code to make decisions, we need to use an if-statement. You can find the "if __ then"-statement in the orange "control" section. 

5. Add a "left arrow pressed" condition

If-statements only work if they have a condition that tells them when to run. A condition is a statement that boils down to "true" or "false". In this case, we can use a sensing condition that checks whether or not a key is pressed. We need to change the key in that sensing block to the "left arrow key".