I'm trying to reduce the gravity scale of my flappy bird game for approximately 1 second at start time. I want to give the player a little time cushion before he falls more quickly.
I originally put the function in the start method (does a timer work in a non-update function?) I then put it in the update function.
Regardless, the timer doesn't seem to trigger, and the gravityscale doesnt go to normal (1).
You'll also see my comment where I was trying to lerp the gravity scale instead. Is it possible to lerp a gravity scale?
void Update()
{
Jump();
Rotation();
PlayerHalt();
}
private void PlayerHalt()
{
float gravityTimer = 0f;
gravityTimer += Time.deltaTime;
if (gravityTimer <= 1)
{
rb.gravityScale = .2f;
//rb.gravityScale = Mathf.Lerp(.2f, 1f, gravityTimer / 1f);
}
else
{
rb.gravityScale = 1f;
}
}