Star Defender is a 2D vertical arcade space shooter built with Java and libGDX/LWJGL3 for a Software Design Patterns course project. The player controls a ship, destroys endless enemy waves, collects power-ups, survives boss fights, and tries to reach the highest possible score.
Playable course build, documentation updated for the current implementation.
The project is beyond the original Day 3 README state. The current code includes the main menu, gameplay state, pause state, game-over state, multiple weapon strategies, power-ups, boss encounter, parallax background, HUD, and an event system.
Not yet implemented: saved high score, audio/music, and active mouse-driven menu buttons.
- Java 8 target compatibility
- libGDX
- LWJGL3 desktop backend
- Gradle
The game is an endless survival shooter:
- Start from the main menu.
- Move the ship horizontally near the bottom of the screen.
- Hold Space to shoot incoming enemies.
- Switch weapons with number keys depending on the situation.
- Collect power-ups for extra life, shield, or temporary faster fire rate.
- Survive increasingly frequent enemy spawns.
- Fight a boss at score thresholds.
- Lose when all lives are gone.
| Action | Input |
|---|---|
| Move left | A / Left Arrow |
| Move right | D / Right Arrow |
| Shoot | Hold Space |
| Ultimate attack | E |
| Single Shot | 1 |
| Double Shot | 2 |
| Pierce Shot | 3 |
| Splash Shot | 4 |
| Start from menu | Space / Enter |
| Pause during gameplay | Escape |
| Resume from pause | Space / Enter |
| Return from pause to menu | Escape |
| Return from game over to menu | Space / Enter |
| Exit from main menu | Escape |
Note: the old README/GDD mentioned W/S movement, Q ultimate, P pause, and mouse menu navigation. The table above describes the current active code.
- Main menu with animated space backdrop.
- Endless gameplay loop.
- Horizontal player movement with screen bounds.
- Auto-fire while Space is held.
- Manual weapon switching.
- Ultimate attack with cooldown and large explosion damage.
- Enemy spawning with increasing difficulty.
- Four regular enemy types: Slow, Fast, Tank, Zigzag.
- Boss fight with phases and bullet patterns.
- Power-ups: Health, Shield, Fire Rate.
- Score and lives system.
- HUD with score, lives, weapon info, HP bar, ultimate cooldown, and status messages.
- Pause overlay that renders gameplay behind a dimmed panel.
- Game-over screen with final score.
- Procedural parallax gameplay background.
Used for screen/game mode management:
StateStateManagerMainMenuStateGameStatePauseStateGameOverState
Used for weapon behavior:
WeaponStrategySingleShotStrategyDoubleShotStrategyPierceStrategySplashStrategy
Used for enemy creation:
EnemyFactoryEnemyFactory.EnemyType
Prototype support exists through:
EnemyPrototypeEnemy.clone()ZigzagEnemy.clone()
Current note: the active factory creates new enemy instances directly. A future improvement would be to store prototype instances in the factory and clone them when spawning enemies.
Used for shared game state:
GameManager
It stores score, lives, pause state, game-over state, and dispatches events.
Used for game events:
GameEventGameEventListenerGameManager.addListener/removeListener/notify
Events include score changes, life changes, game over, pause/resume, enemy kill, boss spawn/defeat, and power-up collection.
- Movement speed: 300 px/s.
- Start lives: 3.
- Player size: 70 x 80 px.
- Movement: horizontal only in the current build.
- Ultimate cooldown: 12 seconds.
| Type | Speed | Health | Score |
|---|---|---|---|
| Slow | 120 | 2 | 100 |
| Fast | 220 | 1 | 50 |
| Tank | 60 | 5 | 200 |
| Zigzag | 100 | 2 | 150 |
| Boss | Phase-based | 220 | 3000 |
| Weapon | Delay | Damage | Notes |
|---|---|---|---|
| Single Shot | 0.15s | 0.5 | Fast single bullet |
| Double Shot | 0.25s | 0.5 per bullet | Two bullets with wider coverage |
| Pierce | 0.40s | 0.5 per enemy | Can hit multiple enemies |
| Splash | 0.45s | 0.3 in radius | Explodes with area damage |
- Enemy spawn interval starts at 2.0 seconds.
- Spawn interval decreases by 0.05 seconds after each spawn.
- Minimum spawn interval is 0.5 seconds.
- First boss appears at 10000 score.
- Boss repeats every additional 10000 score.
Game/
|-- assets/ # PNG sprites and runtime asset root
| |-- sprites/
| | |-- player/
| | |-- enemies/
| | `-- effects/
| `-- laserBlue01.png
|-- core/
| `-- src/main/java/game/mygame/
| |-- background/ # Parallax and menu backgrounds
| |-- entities/ # Player, enemies, bullets, power-ups, effects
| |-- factory/ # EnemyFactory
| |-- observer/ # Game events/listeners
| |-- state/ # State pattern implementation
| |-- ui/ # Experimental/legacy UI helpers
| |-- weapon/ # Weapon Strategy pattern
| |-- Assets.java
| |-- GameManager.java
| |-- GameScreen.java
| `-- SpaceShooter.java
|-- docs/
| |-- GDD.md
| |-- diagrams/
| `-- UI/UX reports
|-- lwjgl3/
| `-- src/main/java/game/mygame/lwjgl3/
| |-- Lwjgl3Launcher.java
| `-- StartupHelper.java
|-- build.gradle
|-- settings.gradle
|-- gradlew
|-- gradlew.bat
`-- README.md
- Main GDD:
docs/GDD.md - Diagrams:
docs/diagrams/ - UI/UX audit and reports:
docs/
- Open the project root folder.
- Import/reload Gradle if needed.
- Run
game.mygame.lwjgl3.Lwjgl3Launcherfrom thelwjgl3module.
.\gradlew.bat :lwjgl3:run./gradlew :lwjgl3:run.\gradlew.bat build.\gradlew.bat :lwjgl3:distThe generated desktop JAR is produced by the lwjgl3 module.
- Zhalgas - Project Lead / Lead Programmer
- Nurdaulet - Programmer
- Abushakhman - Designer / Programmer
- No persistent high score saving yet.
- No audio or music yet.
- Menus are controlled by keyboard in the active state flow.
- Health power-up can increase lives above the displayed max lives.
- Some older/experimental classes remain in the codebase (
PlayingState,PauseOverlay,MainMenuUI,GameHUD). - Some source comments show encoding corruption and should be cleaned in a later polish pass.
- Add saved high score with libGDX
Preferences. - Add shooting, explosion, pickup, boss warning, and game-over sounds.
- Decide whether Health should cap at max lives or work as overheal.
- Remove or refactor legacy UI/state classes.
- Complete Prototype pattern usage inside
EnemyFactory. - Add mouse/Scene2D menu buttons if required by the final assignment.
- Add final release build and tag when ready to submit.