fixup! feat: Implement player lives, destruction, and respawn

Signed-off-by: Harald Hoyer <harald@hoyer.xyz>
This commit is contained in:
Harald Hoyer 2025-03-29 13:49:42 +01:00
parent 10b4648f78
commit 201b4589b3

View file

@ -1,20 +1,26 @@
# bglga # bglga
This project is a simple Galaga-like space shooter game built using the Bevy engine. This project is a simple Galaga-like space shooter game built using the Bevy engine.
## Current State ## Current State
The game features: The game features:
- A player ship at the bottom of the screen that can move left and right
- Shooting bullets upward using the spacebar or up arrow key * A player ship at the bottom of the screen that can move left and right.
- Enemy ships that spawn at the top and move downward * Shooting bullets upward using the spacebar or up arrow key.
- Collision detection between bullets and enemies * Enemy ships that spawn at the top and move downward.
* Collision detection between bullets and enemies.
* **Collision detection between the player and enemies.**
* **A player lives system (starting with 3 lives).**
* **Player destruction upon collision.**
* **Player respawn after a short delay with temporary invincibility.**
* **Remaining lives displayed in the window title.**
## Controls ## Controls
- Move Left: A key or Left Arrow * Move Left: A key or Left Arrow
- Move Right: D key or Right Arrow * Move Right: D key or Right Arrow
- Shoot: Spacebar or Up Arrow * Shoot: Spacebar or Up Arrow
## How to Compile ## How to Compile
@ -33,10 +39,10 @@ nix develop --command bash -c "cargo build"
**1. Core Gameplay Loop & State Management:** **1. Core Gameplay Loop & State Management:**
* **Player Lives:** * ~~**Player Lives:**~~ **(DONE)**
* Add a `PlayerLives` resource (e.g., starting with 3). * ~~Add a `PlayerLives` resource (e.g., starting with 3).~~
* Modify `check_player_enemy_collisions`: Instead of just printing, decrement the lives count. * ~~Modify `check_player_enemy_collisions`: Instead of just printing, decrement the lives count.~~
* Implement player destruction (despawn the player sprite) and respawn logic (maybe after a short delay, with temporary invincibility). * ~~Implement player destruction (despawn the player sprite) and respawn logic (maybe after a short delay, with temporary invincibility).~~
* **Game Over State:** * **Game Over State:**
* Use Bevy's `States` (e.g., `Playing`, `GameOver`). * Use Bevy's `States` (e.g., `Playing`, `GameOver`).
* Transition to `GameOver` when `PlayerLives` reaches zero. * Transition to `GameOver` when `PlayerLives` reaches zero.