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

@ -5,16 +5,22 @@ This project is a simple Galaga-like space shooter game built using the Bevy eng
## Current State
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
- Enemy ships that spawn at the top and move downward
- Collision detection between bullets and enemies
* 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.
* 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
- Move Left: A key or Left Arrow
- Move Right: D key or Right Arrow
- Shoot: Spacebar or Up Arrow
* Move Left: A key or Left Arrow
* Move Right: D key or Right Arrow
* Shoot: Spacebar or Up Arrow
## How to Compile
@ -33,10 +39,10 @@ nix develop --command bash -c "cargo build"
**1. Core Gameplay Loop & State Management:**
* **Player Lives:**
* Add a `PlayerLives` resource (e.g., starting with 3).
* 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).
* ~~**Player Lives:**~~ **(DONE)**
* ~~Add a `PlayerLives` resource (e.g., starting with 3).~~
* ~~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).~~
* **Game Over State:**
* Use Bevy's `States` (e.g., `Playing`, `GameOver`).
* Transition to `GameOver` when `PlayerLives` reaches zero.