diff --git a/src/game/runtime.rs b/src/game/runtime.rs index 1c2878b..81b1ddf 100644 --- a/src/game/runtime.rs +++ b/src/game/runtime.rs @@ -1,6 +1,7 @@ use avian2d::prelude::*; use bevy::{ input::mouse::{AccumulatedMouseScroll, MouseScrollUnit}, + math::curve::EaseFunction::SmoothStep, prelude::*, }; @@ -14,19 +15,19 @@ pub fn move_player( ) -> Result { let acceleration = 500.0; - let delta_time = time.delta_secs(); + let delta_v = acceleration * time.delta_secs(); if keyboard_input.any_pressed([KeyCode::KeyW, KeyCode::ArrowUp]) { - velocity.y += acceleration * delta_time; + velocity.y += delta_v; } if keyboard_input.any_pressed([KeyCode::KeyS, KeyCode::ArrowDown]) { - velocity.y -= acceleration * delta_time; + velocity.y -= delta_v; } if keyboard_input.any_pressed([KeyCode::KeyA, KeyCode::ArrowLeft]) { - velocity.x -= acceleration * delta_time; + velocity.x -= delta_v; } if keyboard_input.any_pressed([KeyCode::KeyD, KeyCode::ArrowRight]) { - velocity.x += acceleration * delta_time; + velocity.x += delta_v; } Ok(()) @@ -39,10 +40,14 @@ pub fn quit(mut exit: EventWriter) { /// Follow the player character with the camera pub fn move_camera( + time: Res