Compare commits

..

No commits in common. "d168e48759c3297b04d20c65a42492d787ad05c3" and "e6da44779e0ab6d47155c12499c342673ea21d38" have entirely different histories.

8 changed files with 18 additions and 47 deletions

View file

@ -30,8 +30,7 @@ pub fn bubble_spawn_wave(commands: &mut Commands, asset_server: &Res<AssetServer
for BubbleSplash { bubble_type, center, radius, nb_bubbles } in bubble_splashes {
for _ in 0..*nb_bubbles {
let angle = rng.random_range(0.0..TAU);
let spawn_radius = rng.random_range(0.0..1.0f32).sqrt() * radius;
let pos = center + Vec2::from_angle(angle) * spawn_radius;
let pos = center + Vec2::from_angle(angle) * radius;
commands.spawn((
Bubble { move_force: bubble_type.move_force },

View file

@ -1,7 +1,7 @@
use std::path::Path;
use std::time::Duration;
use crate::core::game_state::DispawnOnGameOver;
use crate::core::game_state::{DispawnOnGameOver, GameStartupSet, GameState};
use crate::core::kirby::{Kirby, kirby_spawn};
use crate::physics::sphere_collider::SphereCollider;
use bevy::prelude::*;

View file

@ -27,7 +27,6 @@ pub enum GameState {
#[default]
Starting,
Running,
#[allow(dead_code)]
Paused,
}

View file

@ -90,7 +90,7 @@ pub fn bubble_receive_damage(
pub fn kirby_receive_damage(
mut bubble_exploded: ResMut<BubbleExplodedCountThisFrame>,
mut kirby_hit: ResMut<KirbyHitCountThisFrame>,
mut kirby_query: Query<(&Kirby, &GlobalTransform, &mut Life), Without<Bubble>>,
mut kirby_query: Query<(&Kirby, &GlobalTransform, &mut Life), (Without<Bubble>)>,
mut bubble_query: Query<
(&GlobalTransform, &SphereCollider, &DamageDealer, &mut Life),
(With<Bubble>, Without<Kirby>),

View file

@ -1,6 +1,7 @@
use std::time::Duration;
use std::{thread::panicking, time::Duration};
use bevy::prelude::*;
use bevy::{ecs::system::lifetimeless::SCommands, prelude::*};
use rand::distr::slice::Empty;
use crate::{
core::{
@ -10,7 +11,7 @@ use crate::{
kirby::Kirby,
life::Life,
},
map::map::{BOTTOM, LEFT, RIGHT, RIGHT_DIR, TOP, UP_DIR},
map::map::{BOTTOM, LEFT, RIGHT, TOP},
};
#[derive(Event)]
@ -44,8 +45,8 @@ impl BubbleSplash {
}
}
const BASE_MOVE_FORCE: f32 = 6000.0;
const BASE_LIFE: f32 = 20.0;
const BASE_MOVE_FORCE: f32 = 3000.0;
const BASE_LIFE: f32 = 10.0;
const NORMAL_BUBBLE: BubbleType = BubbleType {
color: Color::linear_rgb(1.0, 1.0, 1.0),
@ -60,7 +61,7 @@ const RED_BUBBLE: BubbleType = BubbleType {
};
const GREEN_BUBBLE: BubbleType = BubbleType {
color: Color::linear_rgb(0.0, 1.0, 0.0),
color: Color::linear_rgb(1.0, 0.0, 0.0),
move_force: BASE_MOVE_FORCE * 0.5,
max_life: BASE_LIFE * 2.0,
};
@ -79,24 +80,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, 100), BubbleSplash::new(NORMAL_BUBBLE, TOP, 10.0, 100)],
vec![
BubbleSplash::new(NORMAL_BUBBLE, RIGHT, 100.0, 100),
BubbleSplash::new(NORMAL_BUBBLE, TOP, 100.0, 100),
BubbleSplash::new(NORMAL_BUBBLE, RIGHT, 10.0, 100),
BubbleSplash::new(NORMAL_BUBBLE, TOP, 10.0, 100),
BubbleSplash::new(RED_BUBBLE, BOTTOM, 10.0, 20),
],
vec![
BubbleSplash::new(NORMAL_BUBBLE, RIGHT - UP_DIR * 20.0, 100.0, 200),
BubbleSplash::new(RED_BUBBLE, RIGHT + UP_DIR * 20.0, 100.0, 100),
BubbleSplash::new(RED_BUBBLE, LEFT, 100.0, 100),
],
vec![
BubbleSplash::new(NORMAL_BUBBLE, RIGHT, 100.0, 200),
BubbleSplash::new(RED_BUBBLE, RIGHT + UP_DIR * 40.0, 100.0, 100),
BubbleSplash::new(GREEN_BUBBLE, RIGHT - UP_DIR * 40.0, 100.0, 100),
],
vec![BubbleSplash::new(GREEN_BUBBLE, Vec2::ZERO, 300.0, 1000)],
vec![
BubbleSplash::new(RED_BUBBLE, Vec2::ZERO, 300.0, 1000),
BubbleSplash::new(GREEN_BUBBLE, Vec2::ZERO, 300.0, 1000),
BubbleSplash::new(NORMAL_BUBBLE, RIGHT, 10.0, 200),
BubbleSplash::new(RED_BUBBLE, RIGHT, 10.0, 100),
BubbleSplash::new(RED_BUBBLE, LEFT, 10.0, 100),
],
],
collectables: vec![
@ -104,21 +95,6 @@ fn get_bubble_waves() -> BubbleWaves {
vec![(CollectableType::NewKirby, LEFT)],
vec![(CollectableType::SpeedBoost, BOTTOM)],
vec![(CollectableType::ShieldBoost, BOTTOM)],
vec![
(CollectableType::ShieldBoost, TOP),
(CollectableType::ShieldBoost, TOP + RIGHT_DIR * 40.0),
(CollectableType::NewKirby, BOTTOM),
],
vec![(CollectableType::NewKirby, LEFT + UP_DIR * 40.0), (CollectableType::NewKirby, LEFT - UP_DIR * 40.0)],
vec![
(CollectableType::SpeedBoost, TOP),
(CollectableType::SpeedBoost, BOTTOM),
(CollectableType::SpeedBoost, TOP + RIGHT_DIR * 40.0),
(CollectableType::SpeedBoost, BOTTOM + RIGHT_DIR * 40.0),
(CollectableType::SpeedBoost, TOP - RIGHT_DIR * 40.0),
(CollectableType::SpeedBoost, BOTTOM - RIGHT_DIR * 40.0),
(CollectableType::NewKirby, RIGHT),
],
vec![],
],
current_wave: 0,

View file

@ -1,4 +1,4 @@
use crate::core::wave::BubbleWaves;
use crate::core::{game_state::DispawnOnGameOver, wave::BubbleWaves};
use bevy::prelude::*;
#[derive(Component)]

View file

@ -10,9 +10,6 @@ pub const LEFT: Vec2 = Vec2::new(-NEAR_LIMIT, 0.0);
pub const TOP: Vec2 = Vec2::new(0.0, NEAR_LIMIT);
pub const BOTTOM: Vec2 = Vec2::new(0.0, -NEAR_LIMIT);
pub const UP_DIR: Vec2 = Vec2::new(0.0, 1.0);
pub const RIGHT_DIR: Vec2 = Vec2::new(1.0, 0.0);
#[derive(Resource)]
pub struct MapBounds {
pub min: Vec2,

View file

@ -11,7 +11,7 @@ const MAX_MAP_SIZE: usize = MAX_MAP_WIDTH * 2;
const ARRAY_WIDTH: usize = MAX_MAP_SIZE / CELL_SIZE;
const GRID_ARRAY_SIZE: usize = ARRAY_WIDTH * ARRAY_WIDTH;
const DENSITY_FORCE_SCALE: f32 = 3000.0;
const DENSITY_FORCE_SCALE: f32 = 6000.0;
#[derive(Resource)]
pub struct DensityGrid {
@ -78,7 +78,7 @@ pub fn density_grid_force(
let index = get_index_from_uvec2(neighbor_cell);
let density = density_grid.grid[index];
density_gradient += offset.as_vec2().normalize_or_zero() * density as f32;
density_gradient += offset.as_vec2() * density as f32;
}
}
density_gradient += density_obj.random_offset; // To not have a "grid" thingy