Greetings,
I am expirimenting with making a platformer in godot, in order to learn the engine. I have run into an issue where the plyer character doesn't fall parabolically, and they fall slowly, I have fiddled with the numbers for gravity ad jump speed and the problem seems to remain constant or invert.
Many Thanks,
[(https://github.com/Antiatics-Co/THEELEMENTALIISTS-ELEMENTSFORTHEWORLD)]
{
float direction = (Input.GetActionStrength("right") - Input.GetActionStrength("left"));
Vector2 vel = Velocity;
vel.X = direction * speed;
if(!IsOnFloor())
vel.Y += gravity * (float)delta;
Velocity = vel;
bool isFalling = Velocity.Y > 0 && !IsOnFloor();
bool isJumping = Input.IsActionJustPressed("up") && IsOnFloor();
bool isDoubleJumping = Input.IsActionJustPressed("up") && isFalling;
bool isJumpCancelled = Input.IsActionJustReleased("up") && Velocity.Y < 0;
bool isIdle = IsOnFloor() && Mathf.IsZeroApprox(vel.X);
bool isRunning = !Mathf.IsZeroApprox(vel.X) && IsOnFloor();
if (isJumping && jumpCount < MaxJumps)
{
jumpAnim();
move.FlipH = vel.X < 0;
vel.Y += -JumpSpeed;
jumpCount++;
GD.Print("Jumping, jump count: ", jumpCount);
}
else if (isDoubleJumping && jumpCount < MaxJumps)
{
jumpAnim();
vel.Y += -DoubleJumpSpeed;
jumpCount++;
}
else if (isJumpCancelled)
{
vel.Y = vel.Y * 0.75f;
jumpAnim();
}
else if (wasOnFloor && IsOnFloor())
{
jumpCount = 0;
if (isIdle)
{
move.Play("idle");
}
else if (isRunning)
{
move.Play("runRight");
move.FlipH = vel.X < 0;
}
}
wasOnFloor = IsOnFloor();
Velocity = vel;
MoveAndSlide();
}```