【发布时间】:2022-01-21 15:29:30
【问题描述】:
在输入映射中尝试了两个键,但即使按下单个键也运行代码
if event.is_action_pressed("ui_up") && event.is_action_pressed("ui_left"): //doesn't work
if event.is_action_pressed("ui_up"): //worked
【问题讨论】:
-
上面的代码查询
event是否是ui_left和ui_up的动作并且被按下。这不会发生,因为这两个动作被分配给不同的键,并将作为单独的事件发送。当您要查询输入的全局状态时,请使用 Input 单例。在这种情况下使用Input.is_action_pressed。
标签: godot