diff options
author | nathansmith117 <thenathansmithsmith@gmail.com> | 2024-05-07 01:51:17 +0000 |
---|---|---|
committer | nathansmith117 <thenathansmithsmith@gmail.com> | 2024-05-07 01:51:17 +0000 |
commit | 314b234fb1cc5a21bbcba414e7e9ffdeafd8a753 (patch) | |
tree | e646f2f54d5187d564553b9aa6f6c923e848c899 | |
parent | a5d9cd1b43c034953ec3cd60331aba6b9591c417 (diff) | |
download | PenguinYippies-314b234fb1cc5a21bbcba414e7e9ffdeafd8a753.tar.gz PenguinYippies-314b234fb1cc5a21bbcba414e7e9ffdeafd8a753.tar.bz2 PenguinYippies-314b234fb1cc5a21bbcba414e7e9ffdeafd8a753.zip |
The jump was causing issues
-rw-r--r-- | src/shooterScreen.c | 41 |
1 files changed, 1 insertions, 40 deletions
diff --git a/src/shooterScreen.c b/src/shooterScreen.c index 91e3b11..8df219b 100644 --- a/src/shooterScreen.c +++ b/src/shooterScreen.c @@ -119,12 +119,6 @@ void updateShooterScreenControls(ShooterScreen* shooterScreen, Game* game) player->velocity.x += -sin(player->cameraAngle.x + (PI / 2.0)); } - // Jump - if (IsKeyPressed(KEY_SPACE)) - { - player->jumpStage = 1; - } - // Shoot if (IsMouseButtonPressed(MOUSE_BUTTON_LEFT)) { @@ -134,38 +128,6 @@ void updateShooterScreenControls(ShooterScreen* shooterScreen, Game* game) player->velocity = Vector3Scale(player->velocity, PLAYER_SPEED); } -void updateShooterScreenJump(ShooterScreen* shooterScreen, Game* game) -{ - ShooterPlayer* player = &shooterScreen->player; - - switch (player->jumpStage) - { - case 0: // No Jumpy - break; - case 1: // Jump up - player->velocity.y = PLAYER_JUMP_SPEED * pow(((PLAYER_JUMP_HEIGHT + PLAYER_HEIGHT) - player->position.y), 2.0); - - if ((int)player->velocity.y == 0) - { - player->jumpStage = 2; - } - - break; - case 2: // Fall - player->velocity.y = -PLAYER_FALL_SPEED; - - if (player->position.y <= PLAYER_HEIGHT) - { - player->jumpStage = 0; - player->position.y = PLAYER_HEIGHT; - } - - break; - default: - break; - } -} - void updateShooterScreenPenguins(ShooterScreen* shooterScreen, Game* game) { double currentTime = GetTime(); @@ -182,7 +144,7 @@ void updateShooterScreenPenguins(ShooterScreen* shooterScreen, Game* game) } // Change velocity. - if ((int)(penguins[i].changeSpeedDelay) == 0) // Goes at you. + if (FloatEquals(penguins[i].changeSpeedDelay, 0.0)) // Goes at you. { penguins[i].velocity = Vector3Subtract(shooterScreen->player.position, penguins[i].position); penguins[i].velocity = Vector3Scale(Vector3Normalize(penguins[i].velocity), SHOOTER_PENGUIN_SPEED); @@ -284,7 +246,6 @@ void updateShooterScreen(ShooterScreen* shooterScreen, Game* game) ClearBackground(PINK); updateShooterScreenControls(shooterScreen, game); - updateShooterScreenJump(shooterScreen, game); // Apply velocity. player->position = Vector3Add( |