java-game is a simple 2D spaceship game built using core Java. It features a spaceship navigating through obstacles, demonstrating basic Java game development using JFrame
, KeyListener
, and sprite rendering.
- ๐ธ Control a spaceship using keyboard arrows
- ๐งฑ Avoid obstacles (with simple collision logic)
- ๐จ Renders graphics using Java AWT/Swing
- ๐ฆ Lightweight and beginner-friendly Java game
java-game/
โ
โโโ Game.java # Main game logic and rendering
โโโ Game.class # Compiled class file
โโโ Game$1.class # Inner class for event handling
โโโ spaceship.png # Spaceship sprite
โโโ obs.png # Obstacle image
โโโ README.md # Project documentation
- Clone or download the repository:
git clone https://github.com/vishalvnair124/java-game.git
- Compile and run the game using terminal:
cd java-game
javac Game.java
java Game
Make sure spaceship.png
and obs.png
are in the same folder as Game.java
.
- Java JDK (8 or higher)
- Any text editor or IDE (e.g., VS Code, IntelliJ, NetBeans)
- OS: Windows/Linux/macOS
Vishal V Nair
Java Enthusiast
๐ซ GitHub: @vishalvnair124