Calibrando el salto. Aun no está perfeccionado del todo

This commit is contained in:
2022-07-10 19:05:30 +02:00
parent 64ebf24408
commit bade27edc4
2 changed files with 8 additions and 5 deletions

View File

@@ -194,14 +194,14 @@ void Player::setStatus(int value)
if ((value == STATUS_JUMPING) && (status == STATUS_STANDING))
{
status = STATUS_JUMPING;
sprite->setVelY(-2.0f);
sprite->setVelY(-MAX_VY);
}
// Modifica el estado a 'cayendo'
if (value == STATUS_FALLING)
{
status = STATUS_FALLING;
sprite->setVelY(0.5f);
sprite->setVelY(MAX_VY);
sprite->setVelX(0);
}
@@ -224,10 +224,10 @@ void Player::applyGravity()
{
if (status == STATUS_JUMPING)
{
sprite->setVelY(sprite->getVelY() + 0.1f);
if (sprite->getVelY() > 0.5f)
sprite->setVelY(sprite->getVelY() + GRAVITY);
if (sprite->getVelY() > MAX_VY)
{
sprite->setVelY(0.5f);
sprite->setVelY(MAX_VY);
// status = STATUS_FALLING;
}
}