From d3464f09192084c0d1359be3cd7b7be5074661bd Mon Sep 17 00:00:00 2001 From: Evan Pratten Date: Sat, 2 Oct 2021 20:38:40 -0400 Subject: [PATCH] fix player render height --- game/src/character/collisions.rs | 6 +++--- game/src/character/mod.rs | 6 +++--- game/src/character/render.rs | 4 +++- 3 files changed, 9 insertions(+), 7 deletions(-) diff --git a/game/src/character/collisions.rs b/game/src/character/collisions.rs index 13ce222..7c499ea 100644 --- a/game/src/character/collisions.rs +++ b/game/src/character/collisions.rs @@ -66,9 +66,9 @@ pub fn modify_player_based_on_forces( } // Check sideways collisions - if player.velocity.y == 0.0 && check_player_colliding_with_colliders(){ - return Err(()); - } + // if player.velocity.y == 0.0 && check_player_colliding_with_colliders(){ + // return Err(()); + // } // Finally apply the velocity to the player player.position += player.velocity; diff --git a/game/src/character/mod.rs b/game/src/character/mod.rs index c32b7f0..5f2fd09 100644 --- a/game/src/character/mod.rs +++ b/game/src/character/mod.rs @@ -40,7 +40,7 @@ impl MainCharacter { movement_force: Vector2::zero(), velocity: Vector2::zero(), base_velocity: Vector2::new(0.0, GRAVITY_PPS), - size: Vector2::new(80.0, 100.0), + size: Vector2::new(60.0, 100.0), sprite_sheet: AnimatedSpriteSheet::new( sprite_sheet, Vector2::new(300.0, 300.0), @@ -69,8 +69,8 @@ impl MainCharacter { // Handle extra external forces based on the character state self.movement_force = match state { - CharacterState::Running => Vector2::new(12.0, 0.0), - CharacterState::Jumping => Vector2::new(12.0, -30.0), + CharacterState::Running => Vector2::new(10.0, 0.0), + CharacterState::Jumping => Vector2::new(10.0, -30.0), CharacterState::Dashing => Vector2::new(30.0, -20.0), }; } diff --git a/game/src/character/render.rs b/game/src/character/render.rs index d98e509..5103551 100644 --- a/game/src/character/render.rs +++ b/game/src/character/render.rs @@ -33,7 +33,9 @@ pub fn render_character_in_camera_space( ); player.sprite_sheet.render( raylib, - player.position.sub(player.size.div(2.0)), + player + .position + .sub(Vector2::new(player.size.y, player.size.y).div(4.0)), Some(Vector2::new(player.size.y, player.size.y)), Some(frame_id), );