Godot Version
v4.2.2.stable.official [15073afe3]
_on_body_entered
is called only in the frame, when the body is entered.
Input.is_action_just_pressed
evaluates, if in the current frame the action ui_accept
was just pressed.
So print(food)
is only printed in frames, where the following conditions are true:
ui_accept
is pressed andui_accept
was not pressed in the previous frameSo you would have to press ui_accept
down exactly at the same time as the body is entered, for print(food)
to be executed.
This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.