Lesson 4: Firing a Laser

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

In this lesson, we start working with the hero's weapon.  We'll add an HTML element to represent the laser, we style it in CSS, and we add JavaScript to let the user fire the laser with the spacebar.  We also add code to position the laser properly, move it on the screen after it's fired, and control the rate at which the laser can be fired.

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