Counter that goes up with key presses

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By TrueSarium

so, i want to make a counter that goes up with ever press of a certain key (R).
how could i do that

:bust_in_silhouette: Reply From: andrew.s

First, you’ll need define the key you want in the InputMap: Using InputEvent — Godot Engine (stable) documentation in English

var counter: int

if Input.is_action_pressed('your_input'):
 counter += 1