From 0c79d55a8444ee9c33da1f9af3f767dece4464f3 Mon Sep 17 00:00:00 2001 From: Jonathan Trottier Date: Sat, 16 Sep 2023 20:34:28 -0400 Subject: [PATCH] =?UTF-8?q?escalade=20de=20bloc=20=C3=A0=20=C3=A9valuer?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit l'escalade de bloc est fonctionnelle, mais le jump se fait parfois humainement, d'autre, où le jump se fait plus horizontalement que verticalement --- SQCSim2021/player.cpp | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/SQCSim2021/player.cpp b/SQCSim2021/player.cpp index 11fba10..f0e00c2 100644 --- a/SQCSim2021/player.cpp +++ b/SQCSim2021/player.cpp @@ -103,7 +103,14 @@ void Player::ApplyPhysics(Vector3f input, World* world, float elapsedTime, Audio bt1 = world->BlockAt(GetPosition().x + input.x, GetPosition().y, GetPosition().z); bt2 = world->BlockAt(GetPosition().x + input.x, GetPosition().y - 0.9f, GetPosition().z); bt3 = world->BlockAt(GetPosition().x + input.x, GetPosition().y - 1.7f, GetPosition().z); - if (bt1 != BTYPE_AIR || bt2 != BTYPE_AIR || bt3 != BTYPE_AIR) { + if (bt1 == BTYPE_AIR && bt2 != BTYPE_AIR && bt3 != BTYPE_AIR) { + if (input.x > 0) + input.x = m_velocity.x = 0.5f; + else + input.x = m_velocity.x = -0.5f; + m_velocity.y = 0.3; + m_velocity.z *= .5f; + } else if (bt1 != BTYPE_AIR || bt2 != BTYPE_AIR || bt3 != BTYPE_AIR) { input.x = m_velocity.x = 0; m_velocity.z *= .5f; } @@ -111,7 +118,14 @@ void Player::ApplyPhysics(Vector3f input, World* world, float elapsedTime, Audio bt1 = world->BlockAt(GetPosition().x, GetPosition().y, GetPosition().z + input.z); bt2 = world->BlockAt(GetPosition().x, GetPosition().y - 0.9f, GetPosition().z + input.z); bt3 = world->BlockAt(GetPosition().x, GetPosition().y - 1.7f, GetPosition().z + input.z); - if (bt1 != BTYPE_AIR || bt2 != BTYPE_AIR || bt3 != BTYPE_AIR) { + if (bt1 == BTYPE_AIR && bt2 != BTYPE_AIR && bt3 != BTYPE_AIR) { + if (input.z > 0) + input.z = m_velocity.z = 0.5f; + else + input.z = m_velocity.z = -0.5f; + m_velocity.y = 0.3; + m_velocity.x *= .5f; + } else if (bt1 != BTYPE_AIR || bt2 != BTYPE_AIR || bt3 != BTYPE_AIR) { input.z = m_velocity.z = 0; m_velocity.x *= .5f; }