Skip to content

Commit

Permalink
Less friction during rain
Browse files Browse the repository at this point in the history
  • Loading branch information
lucasmerlin committed Dec 10, 2023
1 parent 3c8bba7 commit 4c29f88
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/base.rs
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ pub fn setup_base(mut commands: Commands, mut assets: ResMut<AssetServer>, mut l
),
RigidBody::KinematicVelocityBased,
Collider::cuboid(width / 2.0, height / 2.0),
Friction::coefficient(0.5),
Friction::coefficient(level.friction),
Velocity::linear(Vec2::new(0.0, 0.0)),
CollisionGroups {
filters: Group::ALL,
Expand Down
5 changes: 3 additions & 2 deletions src/block.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ use rand::Rng;

use crate::effect::EffectType;
use crate::floor::Floor;
use crate::level::LevelLifecycle;
use crate::level::{Level, LevelLifecycle};
use crate::state::LevelState;
use crate::throw::TargetIndicator;

Expand Down Expand Up @@ -273,6 +273,7 @@ impl Block {
block_type: BlockType,
position: Vec2,
assets: &mut AssetServer,
level: &Level,
) -> Entity {
let block = Block::new(block_type);
let width = block_type.width();
Expand All @@ -295,7 +296,7 @@ impl Block {
ActiveEvents::COLLISION_EVENTS,
//ColliderMassProperties::Mass(1.0),
ReadMassProperties::default(),
//Friction::coefficient(0.2),
Friction::coefficient(level.friction),
Aiming,
Velocity::linear(Vec2::new(0.0, -0.0)),
Sensor,
Expand Down
5 changes: 4 additions & 1 deletion src/level.rs
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ pub struct Level {
pub effect_likelihood: f32,
pub intro_text: &'static str,
pub rain: Option<usize>,
pub friction: f32,
}

pub const DEFAULT_EFFECTS: [(EffectType, f32); 2] =
Expand All @@ -106,6 +107,7 @@ pub const DEFAULT_LEVEL: Level = Level {
effect_likelihood: 0.05,
intro_text: "Welcome to the game!",
rain: None,
friction: 0.5,
};

#[derive(Debug, Clone)]
Expand Down Expand Up @@ -146,6 +148,7 @@ pub static LEVELS: [Level; 6] = [
..default_level_base()
}],
rain: Some(10),
friction: 0.2,
..DEFAULT_LEVEL
},
Level {
Expand Down Expand Up @@ -234,7 +237,7 @@ pub fn check_current_block_stats(
let mut block_count = 0;

for (transform, velocity) in query.iter() {
if velocity.linvel.length() < 1.0 {
if velocity.linvel.length() < 0.1 {
block_count += 1;
if transform.translation.y > max_height {
max_height = transform.translation.y;
Expand Down
4 changes: 3 additions & 1 deletion src/throw.rs
Original file line number Diff line number Diff line change
Expand Up @@ -266,6 +266,7 @@ pub fn create_aiming_block(
mut assets: ResMut<AssetServer>,
mut camera_movement: ResMut<CameraMovement>,
mut launch_platform_query: Query<&Transform, With<LaunchPlatform>>,
level: Res<Level>,
) {
if query.iter().count() == 0 {
if let Some((block_type, effect_type)) = throw_queue.queue.pop() {
Expand All @@ -279,6 +280,7 @@ pub fn create_aiming_block(
launch_platform_transform.translation.y + 0.0,
),
&mut assets,
&*level,
);
}
}
Expand Down Expand Up @@ -392,7 +394,7 @@ pub fn update_aim_from_mouse_position_system(
direct_aim,
);
if shot.is_none() {
min_force += 0.002;
min_force += 0.006;
} else {
break;
}
Expand Down

0 comments on commit 4c29f88

Please sign in to comment.