如何在 Godot 中检查 Mobile Touch and Hold 事件?

问题描述 投票:0回答:0

我想在 Godot 游戏中检查触摸是否被按下并处于“保持”状态。

从字面上去了#BingAI和它的聊天解决方案,并将那里的部分和我的一些逻辑混合在一起,我得到:

func _input(event):
  if event is InputEventScreenDrag:
    var touch_index = event.get_index()
    if event.is_pressed():
      var touch = event.position
      if (touch.x > 1 and touch.x < 9) and (touch.y > 71 and touch.y < 79):
        $Player.position.x += -0.5

结果,我得到了一些工作......但它只有在你的手指移动时才有效并且尝试使用

InputEventScreenTouch
时,每次点击它只工作一次......

mobile touch godot gdscript
© www.soinside.com 2019 - 2024. All rights reserved.