So far we have discussed the Green Flag event. The Green Flag can be used to get everything started, but once the program is running you can use keyboard and mouse events to respond to user input. Experiment with keyboard and mouse events by dragging them from the Control tab onto the Scripts panel and then attaching actions to them:

The keyboard event has a drop-down box which allows you to select which key to respond to:
The mouse event responds to clicking on a particular sprite:
Now let's make the Sprite walk back and forth on the screen using the left and right arrow keys. The first thing we will need to do is press the "only face left-right" button which is the second button down on the top center panel:
Next we will create a loop that runs forever once the Green Flag is clicked. Inside the loop we create a conditional if statement that determines whether or not the right or left arrow has been pressed and executes actions accordingly: