Hi im'a newbie,
I'm developing a top-down shooter game in Godot, and I currently have a working function within my Player class that enables shooting every 0.5 seconds. While the current implementation functions well, I'm curious about the potential disadvantages of using async and await. Is there a better way to achieve this without resorting to the use of a timer node?

private async void Shoot(){
canShoot = false;
Area2D bulletInstance = (Area2D)bullet.Instantiate();
AddChild(bulletInstance);
bulletInstance.GlobalPosition = GetNode<Marker2D>("./Muzzle").GlobalPosition;
await ToSignal(GetTree().CreateTimer(.35), "timeout");
canShoot = true;
}

  • xyz replied to this.

    zteplez Yes. Use a timeout signal handler instead of await. If you are a newbie, stay clear of awaits for the time being.