O'Reilly logo

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

A Car Racer JavaScript Game Exercise Using Vanilla JavaScript

Video Description

Create a custom JavaScript Car racer game from scratch using only JavaScript - Practice Exercises

About This Video

  • Build a fully functional racing game from scratch.
  • Accelerate your web pages with Google Sheet, Docs and Slides

In Detail

Have you ever wanted to build amazing and interactive games? If yes, then this course is perfect for you.
A basic knowledge of JavaScript is desirable as the course covers only JavaScript relevant to building a game. Also, HTML and CSS knowledge is essential as the scope of this course focuses entirely on JavaScript.

The course is designed to teach you to use JavaScript. We cover the following:-

  • Learn how to set up your gameplay area using HTML and CSS
  • Add JavaScript setting event listeners
  • Add keyboard actions to move an HTML div using keyboard arrow keys
  • Run AnimationFrame() to change element position and respond to the user's commands
  • Set up and start game functionality
  • Create a dynamic JavaScript road
  • Create elements within JavaScript
  • Access the JavaScript Document Object Model to manipulate element properties
  • Set up and add values within an object to track location and movement
  • Set up a dashboard to output variables for the user such as the score and speed
  • Add road movement
  • Track speed dynamically with braking and accelerating
  • Add other cars and have them move within the gameplay area
  • Check for element overlap and detect collisions
  • Score and extend gameplay

Practicability is the key to this course. Using JavaScript, you have a wide variety of options whereby you can take the code provided within this course and expand it in any number of directions. Learn, practice, and create your own interactive game.