small adjusts
This commit is contained in:
parent
e34c82483a
commit
9532911b00
3 changed files with 10 additions and 9 deletions
|
|
@ -30,7 +30,8 @@ pub fn bubble_spawn_wave(commands: &mut Commands, asset_server: &Res<AssetServer
|
||||||
for BubbleSplash { bubble_type, center, radius, nb_bubbles } in bubble_splashes {
|
for BubbleSplash { bubble_type, center, radius, nb_bubbles } in bubble_splashes {
|
||||||
for _ in 0..*nb_bubbles {
|
for _ in 0..*nb_bubbles {
|
||||||
let angle = rng.random_range(0.0..TAU);
|
let angle = rng.random_range(0.0..TAU);
|
||||||
let pos = center + Vec2::from_angle(angle) * radius;
|
let spawn_radius = rng.random_range(0.0..1.0f32).sqrt() * radius;
|
||||||
|
let pos = center + Vec2::from_angle(angle) * spawn_radius;
|
||||||
|
|
||||||
commands.spawn((
|
commands.spawn((
|
||||||
Bubble { move_force: bubble_type.move_force },
|
Bubble { move_force: bubble_type.move_force },
|
||||||
|
|
|
||||||
|
|
@ -44,7 +44,7 @@ impl BubbleSplash {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const BASE_MOVE_FORCE: f32 = 3000.0;
|
const BASE_MOVE_FORCE: f32 = 4000.0;
|
||||||
const BASE_LIFE: f32 = 10.0;
|
const BASE_LIFE: f32 = 10.0;
|
||||||
|
|
||||||
const NORMAL_BUBBLE: BubbleType = BubbleType {
|
const NORMAL_BUBBLE: BubbleType = BubbleType {
|
||||||
|
|
@ -79,14 +79,14 @@ fn get_bubble_waves() -> BubbleWaves {
|
||||||
vec![BubbleSplash::new(NORMAL_BUBBLE, RIGHT, 10.0, 10), BubbleSplash::new(NORMAL_BUBBLE, TOP, 10.0, 10)],
|
vec![BubbleSplash::new(NORMAL_BUBBLE, RIGHT, 10.0, 10), BubbleSplash::new(NORMAL_BUBBLE, TOP, 10.0, 10)],
|
||||||
vec![BubbleSplash::new(NORMAL_BUBBLE, RIGHT, 10.0, 100), BubbleSplash::new(NORMAL_BUBBLE, TOP, 10.0, 100)],
|
vec![BubbleSplash::new(NORMAL_BUBBLE, RIGHT, 10.0, 100), BubbleSplash::new(NORMAL_BUBBLE, TOP, 10.0, 100)],
|
||||||
vec![
|
vec![
|
||||||
BubbleSplash::new(NORMAL_BUBBLE, RIGHT, 10.0, 100),
|
BubbleSplash::new(NORMAL_BUBBLE, RIGHT, 100.0, 100),
|
||||||
BubbleSplash::new(NORMAL_BUBBLE, TOP, 10.0, 100),
|
BubbleSplash::new(NORMAL_BUBBLE, TOP, 100.0, 100),
|
||||||
BubbleSplash::new(RED_BUBBLE, BOTTOM, 10.0, 20),
|
BubbleSplash::new(RED_BUBBLE, BOTTOM, 10.0, 20),
|
||||||
],
|
],
|
||||||
vec![
|
vec![
|
||||||
BubbleSplash::new(NORMAL_BUBBLE, RIGHT, 10.0, 200),
|
BubbleSplash::new(NORMAL_BUBBLE, RIGHT, 100.0, 200),
|
||||||
BubbleSplash::new(RED_BUBBLE, RIGHT, 10.0, 100),
|
BubbleSplash::new(RED_BUBBLE, RIGHT, 100.0, 100),
|
||||||
BubbleSplash::new(RED_BUBBLE, LEFT, 10.0, 100),
|
BubbleSplash::new(RED_BUBBLE, LEFT, 100.0, 100),
|
||||||
],
|
],
|
||||||
],
|
],
|
||||||
collectables: vec![
|
collectables: vec![
|
||||||
|
|
|
||||||
|
|
@ -11,7 +11,7 @@ const MAX_MAP_SIZE: usize = MAX_MAP_WIDTH * 2;
|
||||||
const ARRAY_WIDTH: usize = MAX_MAP_SIZE / CELL_SIZE;
|
const ARRAY_WIDTH: usize = MAX_MAP_SIZE / CELL_SIZE;
|
||||||
const GRID_ARRAY_SIZE: usize = ARRAY_WIDTH * ARRAY_WIDTH;
|
const GRID_ARRAY_SIZE: usize = ARRAY_WIDTH * ARRAY_WIDTH;
|
||||||
|
|
||||||
const DENSITY_FORCE_SCALE: f32 = 6000.0;
|
const DENSITY_FORCE_SCALE: f32 = 3000.0;
|
||||||
|
|
||||||
#[derive(Resource)]
|
#[derive(Resource)]
|
||||||
pub struct DensityGrid {
|
pub struct DensityGrid {
|
||||||
|
|
@ -78,7 +78,7 @@ pub fn density_grid_force(
|
||||||
let index = get_index_from_uvec2(neighbor_cell);
|
let index = get_index_from_uvec2(neighbor_cell);
|
||||||
let density = density_grid.grid[index];
|
let density = density_grid.grid[index];
|
||||||
|
|
||||||
density_gradient += offset.as_vec2() * density as f32;
|
density_gradient += offset.as_vec2().normalize_or_zero() * density as f32;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
density_gradient += density_obj.random_offset; // To not have a "grid" thingy
|
density_gradient += density_obj.random_offset; // To not have a "grid" thingy
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue