Kacy Phan Logo Image
Kacy Phan

Galaxy Shooter

Languages, Frameworks, & Libraries Used

HTML
CSS
JavaScript
GIT

Project Overview

This game is an implementation of a simple 2D shooting game. Galaxy Shooter is built using HTML, CSS, and JavaScript. The game uses the HTML5 Canvas API to update the game graphics and handle player input. JavaScript is used to manage the game state, including tracking the player's score, lives, and level. The game is played by controlling a spaceship to shoot down aliens while dodging their bullets. The main logic of the game is handled in a function called gameLoop, which is called every 60 milliseconds using the setInterval method.

The code creates four classes to handle the entities: Player, Alien, Bullet, and Player Bullet. Player handles the player spaceship, Alien handles the alien spaceships, Bullet handles the alien bullets fired by the aliens, and Player Bullet handles the player bullets fired by the player.

In the game, players must defend against a row of alien enemies that will descend towards the screen every 5 seconds. Additionally, a new row of aliens will appear every 10 seconds, creating a continuous loop until the game is over using the setInterval method.

Glaxy Shooter

The game detects collisions between entities using the detectHit function. The game also displays the player's score and updates it as they shoot down aliens.

In summary, this code creates a simple 2D shooting game where the player controls a spaceship to shoot down aliens while dodging their bullets. The game is played on an HTML canvas and the getContext method to create a game board using the draw and update methods to create and move the entities.