YouTube

Got a YouTube account?

New: enable viewer-created translations and captions on your YouTube channel!

English subtitles

← Event Listening - HTML5 Game Development

Get Embed Code
4 Languages

Showing Revision 6 created 05/25/2016 by Udacity Robot.

  1. Now for this next task, what we'd like you to do is actually hook up mousemove
  2. and keydown to proper listener events. So that we can receive and then respond
  3. to those two actions appropriately. Now remember, the proper syntax to add an
  4. event listener is as such. Make sure you utilize this while filling out your
  5. code. Now for mousemove, the event object itself will contain two properties
  6. that you'll need to use. The client x and client y values represent the
  7. position of the mouse on the canvas itself not on the webpage. So make sure you
  8. take that into account. The onKeyDown event, instead of containing a clientX
  9. and clientY, contains a keyID property.