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
- 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
WASDkeys. 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 aR. 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.
Before you can build and run this project, ensure you have the following software installed on your system:
Make sure Git is installed on your system before continuing with the installation
- Clone the repository
git clone https://github.com/tran-ethan/space-invaders.git- Navigate to the project directory
cd space-invaders- Build the project
./gradlew buildMake 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 runYou 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.
Game assets including graphics and sound effects were found on OpenGameArt
- "Assets for a Space Invader-like Game" by Clear_Code under CC-BY 4.0, via OpenGameArt
- "Pixel Space Invaders" by jlunsec under CC-BY 4.0, via OpenGameArt
This project is licensed under the MIT License.