Hello, I´m a beginner at Godot and to English. I have a project where I have a pigeon that flaps to right and to left. I want the pigeon to flap once, and not constantly when the left/right key is pressed. How can I achieve that?
Here is my script:
extends RigidBody2D
func ready():
setprocess_input(true)
pass
func input(event):
if event is InputEventKey and event.pressed:
if event.scancode == KEYRIGHT || event.scancode == KEYD:
applyimpulse(Vector2(20, -20), Vector2(20, -20))
if event is InputEventKey and event.pressed:
if event.scancode == KEY_LEFT || event.scancode == KEY_A:
apply_impulse(Vector2(-20, -20), Vector2(-20, -20))
I´v tried different tutorials and posts, but what I want to do doesn´t show up anywhere, so that´s why I post this. (Sorryif it´s an obious solution, I´m new to Godot and GDscript).
Thanks in advance.
X