Skip to content

tran-ethan/space-invaders

Repository files navigation

Space Invaders

This project is a 2D shooter game, inspired by the classic 1978 Space Invaders, where players control a spaceship to destroy alien invaders before they reach you. It is implemented using JavaFX 20 with FXML for the graphical interface, featuring features multiple levels, each with increasing difficulty, and providing an interactive experience with sound effects, explosions, and various game assets.

Space-Invaders.mov

Game Mechanics

  • Objective: Eliminate all alien invaders before they reach the bottom of the screen.
  • Spaceship: The spaceship moves freely in all directions and is controlled using the WASD keys. You start with 3 lives and lose a life when you get shot by an invader.
  • Shooting and Rockets: Players can fire rockets to eliminate invaders by pressing SPACE. The type of rocket can be changed by pressing a R. The number of rockets you shoot at once increases every level.
  • Invaders: The game generates invaders at the top of the screen that will slowly make their way to the bottom of the screen while shooting at you. Their speed and number increase as the player progresses through levels.
  • Game Over: The game ends when all aliens are eliminated on all 3 levels. You lose when an alien reaches the bottom of the screen, when you run out of lives, or when an invader touches your spaceship.

Getting started

Prerequisites

Before you can build and run this project, ensure you have the following software installed on your system:

Installation

Make sure Git is installed on your system before continuing with the installation

  1. Clone the repository
git clone https://github.com/tran-ethan/space-invaders.git
  1. Navigate to the project directory
cd space-invaders
  1. Build the project
./gradlew build

Usage

Using Gradle Wrapper

Make sure Oracle OpenJDK 18 is properly configured in the JAVA_HOME environment variable before trying this method. To run the application using the Gradle Wrapper, execute the following command:

./gradlew run

Using IDE

You can run the program by directly executing the main method in the SpaceInvadersApp class directly from within your IDE. Ensure your IDE is configured to use the JDK 18 and has the necessary dependencies in build.gradle installed.

Assets

Game assets including graphics and sound effects were found on OpenGameArt

License

This project is licensed under the MIT License.

About

2D Space Shooter game inspired by the classic 1978 Space Invaders game

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •  

Languages