diff --git a/.gitignore b/.gitignore index 96b244a..7e17b2b 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ /target /.direnv /logs +/.idea diff --git a/.roo/mcp.json b/.roo/mcp.json new file mode 100644 index 0000000..7001130 --- /dev/null +++ b/.roo/mcp.json @@ -0,0 +1,3 @@ +{ + "mcpServers": {} +} \ No newline at end of file diff --git a/README.md b/README.md index 4166dbc..8b33cbf 100644 --- a/README.md +++ b/README.md @@ -47,35 +47,35 @@ nix develop --command bash -c "cargo build" * ~~Use Bevy's `States` (e.g., `Playing`, `GameOver`).~~ * ~~Transition to `GameOver` when `PlayerLives` reaches zero.~~ * ~~In the `GameOver` state: stop enemy spawning, stop player controls, display a "Game Over" message (using `bevy_ui`), potentially offer a restart option.~~ -* **Scoring:** - * Add a `Score` resource. - * Increment the score in `check_bullet_collisions` when an enemy is hit. +* ~~**Scoring:**~~ **(DONE)** + * ~~Add a `Score` resource.~~ + * ~~Increment the score in `check_bullet_collisions` when an enemy is hit.~~ * Consider different point values for different enemy types or hitting enemies during dives later. -* **Levels/Stages:** - * Add a `CurrentStage` resource. - * Define criteria for clearing a stage (e.g., destroying all enemies in a wave/formation). - * Implement logic to advance to the next stage, potentially increasing difficulty (enemy speed, firing rate, different formations). +* ~~**Levels/Stages:**~~ **(DONE)** + * ~~Add a `CurrentStage` resource.~~ + * ~~Define criteria for clearing a stage (e.g., destroying all enemies in a wave/formation).~~ + * ~~Implement logic to advance to the next stage, potentially increasing difficulty (enemy speed, firing rate, different formations).~~ **2. Enemy Behavior - Formations & Attack Patterns:** * **Enemy Formations:** This is a core Galaga feature. - * Define target positions for the enemy formation on screen. - * Give enemies an `Entering` state/component: They fly onto the screen following predefined paths (curves, waypoints). - * Give enemies a `Formation` state/component: Once they reach their target position, they stop and hold formation. + * ~~Define target positions for the enemy formation on screen.~~ **(DONE)** + * ~~Give enemies an `Entering` state/component: They fly onto the screen following predefined paths (curves, waypoints).~~ **(DONE - Basic linear path implemented)** + * Give enemies a `Formation` state/component: Once they reach their target position, they stop and hold formation. **(DONE - Stop implemented by removing FormationTarget)** * **Enemy Attack Dives:** - * Give enemies an `Attacking` state/component. - * Periodically trigger enemies in the formation to switch to the `Attacking` state. - * Define attack paths (swooping dives towards the player area). - * Make enemies fire bullets (downwards or towards the player) during their dives. - * After an attack dive, enemies could return to their formation position or fly off-screen. + * ~~Give enemies an `Attacking` state/component.~~ **(DONE)** + * ~~Periodically trigger enemies in the formation to switch to the `Attacking` state.~~ **(DONE - Random selection after formation complete)** + * ~~Define attack paths (swooping dives towards the player area).~~ **(DONE - Basic swoop towards center implemented)** + * ~~Make enemies fire bullets (downwards or towards the player) during their dives.~~ **(DONE - Downward)** + * After an attack dive, enemies could return to their formation position or fly off-screen. **(Fly off-screen implemented)** * **Enemy Variety:** - * Introduce different types of enemies (e.g., using different components or an enum). - * Assign different behaviors, point values, and maybe sprites to each type. + * ~~Introduce different types of enemies (e.g., using different components or an enum).~~ **(DONE - Added EnemyType enum and field)** + * ~~Assign different behaviors, point values, and maybe sprites to each type.~~ **(DONE - Behaviors, points & color based on type)** **3. Advanced Galaga Mechanics:** * **Boss Galaga & Capture Beam:** - * Create a "Boss" enemy type. + * ~~Create a "Boss" enemy type.~~ **(DONE - Added to Enum, handled in matches)** * Implement the tractor beam attack (visual effect, player capture logic). * Player needs a `Captured` state. * Logic for the Boss to return captured ships to the formation. diff --git a/src/bullet.rs b/src/bullet.rs new file mode 100644 index 0000000..2cd46a4 --- /dev/null +++ b/src/bullet.rs @@ -0,0 +1,113 @@ +use bevy::prelude::*; + +use crate::components::{Bullet, Enemy, EnemyBullet, EnemyType}; +use crate::constants::{ + BULLET_ENEMY_COLLISION_THRESHOLD, BULLET_SIZE, BULLET_SPEED, ENEMY_BULLET_PLAYER_COLLISION_THRESHOLD, + ENEMY_BULLET_SIZE, ENEMY_BULLET_SPEED, WINDOW_HEIGHT, +}; +use crate::resources::{PlayerLives, PlayerRespawnTimer, Score}; +use crate::game_state::AppState; +use crate::components::Player; // Needed for check_enemy_bullet_player_collisions +use crate::components::Invincible; // Needed for check_enemy_bullet_player_collisions + +// --- Player Bullet Systems --- + +pub fn move_bullets( + mut query: Query<(Entity, &mut Transform), With>, + time: Res