Godot Version
Godot v4.3
Question
I’m attempting to make a skating game where the player has to hold forward(w) while alternating between pressing left(a) and right(d) in order to gain speed. I’ve been able to make the inputs work close enough, but I’m at a complete loss as to how to increase the players speed with each button press. Any help with this matter would be greatly appreciated. I have included my most successful code thus far. And yes, I am aware that this code would not require the player to alternate button presses, as they could just hold left or right to go fast (if I knew how to make them go fast).
public override void _PhysicsProcess(double delta)
{
if (Input.IsActionPressed("forward"))
{
if (Input.IsActionPressed("left"))
{
GD.Print("left pressed!");
//increase player speed by an amount
}
if (Input.IsActionPressed("right"))
{
GD.Print("right pressed!");
//increase player speed by an amount
}
}
}