refactor: improve code formatting and readability in components and resources
This commit is contained in:
parent
4727c370d2
commit
9aad8dd130
|
@ -31,8 +31,10 @@ impl Default for FormationLayout {
|
|||
for i in 0..crate::constants::FORMATION_ENEMY_COUNT {
|
||||
let row = i / crate::constants::FORMATION_COLS;
|
||||
let col = i % crate::constants::FORMATION_COLS;
|
||||
let target_x = (col as f32 - (crate::constants::FORMATION_COLS as f32 - 1.0) / 2.0) * crate::constants::FORMATION_X_SPACING;
|
||||
let target_y = crate::constants::FORMATION_BASE_Y - (row as f32 * crate::constants::FORMATION_Y_SPACING);
|
||||
let target_x = (col as f32 - (crate::constants::FORMATION_COLS as f32 - 1.0) / 2.0)
|
||||
* crate::constants::FORMATION_X_SPACING;
|
||||
let target_y = crate::constants::FORMATION_BASE_Y
|
||||
- (row as f32 * crate::constants::FORMATION_Y_SPACING);
|
||||
positions.push(Vec3::new(target_x, target_y, 0.0));
|
||||
}
|
||||
FormationLayout {
|
||||
|
@ -81,9 +83,16 @@ impl Default for StageConfigurations {
|
|||
let count = 16; // Example: Fewer enemies in a circle
|
||||
for i in 0..count {
|
||||
let angle = (i as f32 / count as f32) * 2.0 * std::f32::consts::PI;
|
||||
positions.push(Vec3::new(angle.cos() * radius, center_y + angle.sin() * radius, 0.0));
|
||||
positions.push(Vec3::new(
|
||||
angle.cos() * radius,
|
||||
center_y + angle.sin() * radius,
|
||||
0.0,
|
||||
));
|
||||
}
|
||||
FormationLayout {
|
||||
name: "Circle".to_string(),
|
||||
positions,
|
||||
}
|
||||
FormationLayout { name: "Circle".to_string(), positions }
|
||||
};
|
||||
let stage2 = StageConfig {
|
||||
formation_layout: stage2_layout,
|
||||
|
|
Loading…
Reference in a new issue