Setting Up the Project

Build the basic setup of the game.

Introduction

From this lesson onwards, we are going to build our second game, which is based on arrays and objects. Let's start by going over the things we'll need to build for the Virus fighter game:

  1. We need a background image, an enemy image, a player character image, and a gem image.

  2. We need to attach an event listener on the canvas so the player character (PC) moves in the horizontal direction when a particular event is triggered.

  3. We need to write logic to move the enemy object vertically and bounce it back when it reaches the boundary of the canvas.

  4. We also need to write a collision detection algorithm that will help us know when the PC hits an enemy and the game ...