godot学习函数is_action_pressed 的作用和用法
is_action_pressed(action: String, allow_echo: bool = false, exact_match: bool = false) 返回为布尔值
意思是如果给定的动作被按下,则返回 true,并且不是 InputEventKey 事件的回显事件,除非 allow_echo 是 true。与 InputEventMouseMotion 或 InputEventScreenDrag 类型的事件无关。如果 exact_match 是 false,它将忽略 InputEventKey 和 InputEventMouseButton 事件的额外输入修饰符,以及 InputEventJoypadMotion 事件的方向。
注意:由于键盘冲突,is_action_pressed() 可能会在动作的某个键按下时也返回 false。
代码示例
func _input(event):
if event.is_action_pressed("jump") :
velocity.y= -800
意思是 如果按下jump 键 就可以跳跃了