From 4f5b98a35f087467058b8278fe9c6916a222517e Mon Sep 17 00:00:00 2001 From: Franklin Date: Wed, 13 Sep 2023 14:31:36 -0400 Subject: [PATCH] Tweaked values, learned how to add parents and children. --- Readme.md | 11 ++++++++- src/constants/player_values.rs | 10 +++++++- src/logic/core/player/camera_player_sync.rs | 27 +++++++++------------ src/logic/core/player/player_movement.rs | 8 ++++++ src/logic/core/player/spawn_player.rs | 21 ++++++++++------ src/scenes/scene1/init.rs | 6 +++-- 6 files changed, 56 insertions(+), 27 deletions(-) diff --git a/Readme.md b/Readme.md index 55c6e0e..07d3cc6 100644 --- a/Readme.md +++ b/Readme.md @@ -11,7 +11,16 @@ - [ ] Feature: Subtle Headbob, FOV change on movement (Distinguish between sprinting and walking). - [ ] Feature: Basic ESC UI, FPS counter, stamina bar -- [ ] Discussion: PvP vs PvE +- [ ] Discussion: PvP vs PvE + PvE First, after the initial game loop is done, then PvP. - [ ] Discussion: Realism vs arcade + Realism First, arcade last. - [ ] Discussion: Gameplay loop + - [ ] Discussion: Is this a survival game? A Shooter? A Sandbox? All? + End goal is all. But at first this should be a sandbox where you spawn with a gun. + + +## Focus: +Making a game that you can leverage when you realize what's possible and what's not. +Movement system, gun handling, shooting, modding, inventory, hitreg, etc... diff --git a/src/constants/player_values.rs b/src/constants/player_values.rs index 60554ab..e95a951 100644 --- a/src/constants/player_values.rs +++ b/src/constants/player_values.rs @@ -3,7 +3,7 @@ pub const PLAYER_ACCELERATION: f32 = 20.0; pub const PLAYER_JUMP_FORCE: f32 = 900.0; /// Time in ms that player must be grounded in order to jump again pub const PLAYER_JUMP_COOLDOWN_MS: u128 = 75; -pub const PLAYER_SPRINT_SPEED_MULTIPLIER: f32 = 2.0; +pub const PLAYER_SPRINT_SPEED_MULTIPLIER: f32 = 2.5; pub const PLAYER_CROUCH_SPEED_MULTIPLIER: f32 = 0.25; pub const PLAYER_INITIAL_WEIGHT: f32 = 75.0; pub const PLAYER_GRAVITY_SCALE: f32 = 4.0; @@ -20,3 +20,11 @@ pub const PLAYER_LATERAL_ACCELERATION_WHILE_SPRINTING_MULTIPLIER: f32 = 0.2; pub const PLAYER_LATERAL_ACCELERATION_MULTIPLIER: f32 = 1.0; pub const PLAYER_LINEAR_DAMPING_TIME_OFFSET_AFTER_JUMP_IN_MS: u128 = 20; + + +/* +pub const PLAYER_CAMERA_HEADBOB_Y_POS: f32 = 0.2; +pub const PLAYER_CAMERA_HEADBOB_Y_NEG: f32 = -0.2; +pub const PLAYER_CAMERA_HEADBOB_X_POS: f32 = 0.2; +pub const PLAYER_CAMERA_HEADBOB_X_NEG: f32 = -0.2; +*/ \ No newline at end of file diff --git a/src/logic/core/player/camera_player_sync.rs b/src/logic/core/player/camera_player_sync.rs index 8482380..eeb7b68 100644 --- a/src/logic/core/player/camera_player_sync.rs +++ b/src/logic/core/player/camera_player_sync.rs @@ -24,32 +24,27 @@ impl Default for MouseMovementSettings { } } -/// Synchronizes camera's translation & rotation (only 1 axis) to player. -pub fn sync_camera_to_player( +/// Synchronizes camera's translation to player. +pub fn update_camera_vertical_position( mut player: Query<(&mut Transform, &PlayerLinearXZState), (With, Without)>, mut camera: Query<&mut Transform, (With, Without)>, time: Res