chore: apply cargo fmt formatting
This commit is contained in:
parent
52b5c9d7e6
commit
ff3416b664
3 changed files with 12 additions and 9 deletions
|
|
@ -11,8 +11,8 @@ use crate::constants::{
|
||||||
TRACTOR_BEAM_WIDTH, WINDOW_HEIGHT, WINDOW_WIDTH,
|
TRACTOR_BEAM_WIDTH, WINDOW_HEIGHT, WINDOW_WIDTH,
|
||||||
};
|
};
|
||||||
use crate::resources::{
|
use crate::resources::{
|
||||||
AttackDiveTimer, CurrentStage, EnemySpawnTimer, FormationState, StageConfigurations,
|
is_special_stage, AttackDiveTimer, CurrentStage, EnemySpawnTimer, FormationState,
|
||||||
is_special_stage,
|
StageConfigurations,
|
||||||
};
|
};
|
||||||
|
|
||||||
const BOSS_BASE_CHANCE: f32 = 0.30;
|
const BOSS_BASE_CHANCE: f32 = 0.30;
|
||||||
|
|
@ -64,8 +64,8 @@ pub fn spawn_enemies(
|
||||||
0.0,
|
0.0,
|
||||||
);
|
);
|
||||||
|
|
||||||
let boss_chance = BOSS_BASE_CHANCE
|
let boss_chance =
|
||||||
+ (stage.number as f32 * BOSS_CHANCE_PER_STAGE).min(BOSS_CHANCE_BONUS_CAP);
|
BOSS_BASE_CHANCE + (stage.number as f32 * BOSS_CHANCE_PER_STAGE).min(BOSS_CHANCE_BONUS_CAP);
|
||||||
let enemy_type = if fastrand::f32() < boss_chance {
|
let enemy_type = if fastrand::f32() < boss_chance {
|
||||||
EnemyType::Boss
|
EnemyType::Boss
|
||||||
} else {
|
} else {
|
||||||
|
|
|
||||||
|
|
@ -58,10 +58,10 @@ pub fn move_player(
|
||||||
|
|
||||||
transform.translation.x += direction * player.speed * time.delta_secs();
|
transform.translation.x += direction * player.speed * time.delta_secs();
|
||||||
let half_width = PLAYER_SIZE.x / 2.0;
|
let half_width = PLAYER_SIZE.x / 2.0;
|
||||||
transform.translation.x = transform
|
transform.translation.x = transform.translation.x.clamp(
|
||||||
.translation
|
-WINDOW_WIDTH / 2.0 + half_width,
|
||||||
.x
|
WINDOW_WIDTH / 2.0 - half_width,
|
||||||
.clamp(-WINDOW_WIDTH / 2.0 + half_width, WINDOW_WIDTH / 2.0 - half_width);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn handle_captured_player(
|
pub fn handle_captured_player(
|
||||||
|
|
|
||||||
|
|
@ -110,7 +110,10 @@ fn for_stage_returns_normal_config_at_stage_4() {
|
||||||
fn special_stage_has_full_formation() {
|
fn special_stage_has_full_formation() {
|
||||||
let configs = StageConfigurations::default();
|
let configs = StageConfigurations::default();
|
||||||
let config = configs.for_stage(3);
|
let config = configs.for_stage(3);
|
||||||
assert_eq!(config.enemy_count, 32, "Special stage should have 32 enemies");
|
assert_eq!(
|
||||||
|
config.enemy_count, 32,
|
||||||
|
"Special stage should have 32 enemies"
|
||||||
|
);
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
config.formation_layout.positions.len(),
|
config.formation_layout.positions.len(),
|
||||||
32,
|
32,
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue