Nuevo funcionamiento TALANES
This commit is contained in:
1 parent
95a1231c63
commit
92daf86379
2 files changed
+602
-50
No files matched your search
@@ -12,7 +12,7 @@ float playerPitch = 0.0f;
|
||||
float weaponBobTime = 0.0f;
|
||||
float weaponShootTime = 0.0f;
|
||||
|
||||
const float moveSpeed = 7.0f;
|
||||
const float moveSpeed = 11.0f;
|
||||
const float jumpForce = 9.0f;
|
||||
const float gravity = 20.0f;
|
||||
|
||||
@@ -50,22 +50,17 @@ Camera3D GetPlayerCamera()
|
||||
|
||||
static void MovePlayer(Vector3 movement)
|
||||
{
|
||||
// X separado de Z para poder deslizarse por las paredes.
|
||||
Vector3 nextX = playerPosition;
|
||||
nextX.x += movement.x;
|
||||
|
||||
if (!IsSolidAt(nextX, PLAYER_RADIUS))
|
||||
{
|
||||
playerPosition.x = nextX.x;
|
||||
}
|
||||
|
||||
Vector3 nextZ = playerPosition;
|
||||
nextZ.z += movement.z;
|
||||
|
||||
if (!IsSolidAt(nextZ, PLAYER_RADIUS))
|
||||
{
|
||||
playerPosition.z = nextZ.z;
|
||||
}
|
||||
}
|
||||
|
||||
void UpdatePlayer(float deltaTime)
|
||||
@@ -150,9 +145,7 @@ void UpdatePlayer(float deltaTime)
|
||||
verticalVelocity = 0.0f;
|
||||
|
||||
if (IsKeyPressed(KEY_SPACE))
|
||||
{
|
||||
verticalVelocity = jumpForce;
|
||||
}
|
||||
}
|
||||
|
||||
verticalVelocity -= gravity * deltaTime;
|
||||
@@ -166,7 +159,6 @@ void UpdatePlayer(float deltaTime)
|
||||
verticalVelocity = 0.0f;
|
||||
}
|
||||
|
||||
// Colisión con el techo.
|
||||
if (playerPosition.y + PLAYER_HEAD_Y > CEILING_Y)
|
||||
{
|
||||
playerPosition.y =
|
||||
|
||||
Reference in new issue
Block a user