For our hero movement, do we want our hero to always be able to accelerate? Do we want our hero to only move for a period of time? Do we want our hero to move until a specific condition is met?
Add the "forever" loop below the variable set. Remember we want our hero to be able to move back / forth to avoid the enemies. So we'll use the "change x by ___" block. Then let's add the "x speed" variable to the "change x by ___" block.
Grab two "if ____ then _____" statements, and stack them inside of each other. This is called a Nested If Statement. It's important because it allows us to test two different things before we run the "change x speed by 1" code. The first condition is whether we used the left arrow key, or "key left arrow pressed?" from Sensing. We'll fill in the second next.
Now that we have the Left Movement, let's fix the change variable block we have. Recall if we want to go left, we will need to move in the - X direction. So we should change by -1. Now we are ready to add the second condition. Since we don't want our character to move too fast, grab an "____ < _____" block form the Operators Tab. We'll add -10 as the fastest we can go left, and add the "x speed" variable to test that it is always bigger than that.
Finally we'll right click on the first If Statement to duplicate it, and place it below the first set.
Ok now we'll switch the second "key left arrow pressed?" block to a "right arrow" and flip the order of the operator conditions so it reads: "x speed" < 10. Lastly adjust the change variable tab so that the "x speed" is increased by 1 instead.
Whenever we go through a big block of code, we want to make sure that everything is working as intended. Does your hero move back and forth using arrow keys? If you want try to update it to other keys on your keyboard.