diff --git a/src/components.rs b/src/components.rs index 6b02234..0577976 100644 --- a/src/components.rs +++ b/src/components.rs @@ -33,20 +33,11 @@ pub struct FormationTarget { pub position: Vec3, } -// Enum defining different ways an enemy can attack -#[derive(Component, Clone, Copy, PartialEq, Debug)] -pub enum AttackPattern { - SwoopDive, // Original pattern: dive towards center, then off screen - DirectDive, // Dive straight down - Kamikaze(Vec3), // Dive towards a specific target location (e.g., player's last known position) - Needs target Vec3 - // Add more patterns later (e.g., FigureEight, Looping) -} - -#[derive(Component, Clone, PartialEq, Debug)] // Added Debug derive +#[derive(Component, Clone, PartialEq)] pub enum EnemyState { - Entering, // Flying onto the screen towards formation target - InFormation, // Holding position in the formation - Attacking(AttackPattern), // Diving towards the player using a specific pattern + Entering, // Flying onto the screen towards formation target + InFormation, // Holding position in the formation + Attacking, // Diving towards the player } #[derive(Component)] diff --git a/src/enemy.rs b/src/enemy.rs index 23b92e9..145553d 100644 --- a/src/enemy.rs +++ b/src/enemy.rs @@ -2,69 +2,59 @@ use bevy::prelude::*; use std::time::Duration; use crate::components::{Enemy, EnemyBullet, EnemyState, EnemyType, FormationTarget}; -use crate::constants::{ // Added WINDOW_WIDTH +use crate::constants::{ ENEMY_BULLET_PLAYER_COLLISION_THRESHOLD, ENEMY_BULLET_SIZE, ENEMY_BULLET_SPEED, ENEMY_SHOOT_INTERVAL, ENEMY_SIZE, ENEMY_SPEED, FORMATION_BASE_Y, FORMATION_COLS, - FORMATION_ENEMY_COUNT, FORMATION_X_SPACING, FORMATION_Y_SPACING, WINDOW_HEIGHT, WINDOW_WIDTH, + FORMATION_ENEMY_COUNT, FORMATION_X_SPACING, FORMATION_Y_SPACING, WINDOW_HEIGHT, }; use crate::resources::{ AttackDiveTimer, CurrentStage, EnemySpawnTimer, FormationState, PlayerLives, - PlayerRespawnTimer, StageConfigurations, // Make sure StageConfigurations is imported if not already + PlayerRespawnTimer, }; -use crate::game_state::AppState; +use crate::game_state::AppState; // Needed for check_enemy_bullet_player_collisions pub fn spawn_enemies( mut commands: Commands, time: Res