I have created a simple C++ "game" in godot. Lacking any good documentation, I based my work off examples on the internet, and for input I have this:
const Input* i = Input::get_singleton();
double delta_v = 0;
if (i->is_action_pressed("ui_up"))
delta_v += acceleration * delta;
if (i->is_action_pressed("ui_down"))
delta_v -= acceleration * delta;
if (i->is_action_pressed("ui_left"))
angular_velocity -= angular_acceleration * delta;
if (i->is_action_pressed("ui_right"))
angular_velocity += angular_acceleration * delta;
Based on that, I wanted to add a new action triggered by space. So I tried this:
const Input* i = Input::get_singleton();
if (i->is_action_pressed("game_shoot"))
{
}
I then added this action in the project key mapping:
But I am getting an error:
The InputMap action "game_shoot" doesn't exist.
Curiously, it works from a script like this:
func _input(event):
if event.is_action_pressed("game_shoot"):
print("game_shoot occurred!")
game_shoot
does not seem to work. I am still getting the same error when I try to query it from the C++ side. \$\endgroup\$