Lesson 2: Creating a Game Loop and Handling Movement

This video will likely be best viewed in fullscreen mode.  It's about 12 minutes long.  You can download the resulting file below.

In this lesson we add to our JavaScript to interact with the keyboard.  We need to react to events - events are things that happen on your computer.  Two of the events we deal with here are keydown and keyup events - this allows our JavaScript to handle when a user presses or releases a key on the keyboard.

We also start building a game loop that is timed - this allows us to control how frequently our action is processed, and how frequently the sprites on our screen are redrawn.

Timothy James,
Jul 20, 2015, 6:34 PM