Skip to main content
CodingHelp
HomeCareersCoursesSurveyCareer surveyForumsFAQContact
Log inSign up
Back to course overview
Game Prototyping & Systems

The Game Loop in Code

Draw on an HTML canvas, run an update/draw loop with delta time, and respond to keyboard input.

3 lessons · 2h
  • Drawing with canvasReading

    Draw a sprite on an HTML canvas, move it by changing its state, and keep it inside the play area.

    35m
  • The game loopReading

    Write an update/draw loop with requestAnimationFrame and delta time so movement is the same at any frame rate.

    53m
  • Input handlingReading

    Track keyboard state with keydown and keyup, move a player from that state each frame, and avoid stuck keys.

    32m
Coding Help
  • About
  • Careers
  • Courses
  • Career survey
  • Forums
  • FAQ
  • Contact
  • Terms
  • Privacy