ios上的godot角色移动



am使用godot构建游戏。

这是我的角色移动代码

func Movement():
if Input.is_action_pressed("Right") and not Input.is_action_pressed("Left"):
velocity.x = min(velocity.x + ACCELERATION , MAX_SPEED)
flip = "Right"
if get_node("Hand").position.x < 0: 
flip()
get_node("Camera2D").offset_h = 1 
elif Input.is_action_pressed("Left") and not Input.is_action_pressed("Right"):
velocity.x = max(velocity.x - ACCELERATION , -MAX_SPEED)
flip = "Left"
if get_node("Hand").position.x > 0: 
flip()
get_node("Camera2D").offset_h = -1 
else:
velocity.x = 0

它在android上运行良好,但在ios上我必须长按我使用的触摸屏按钮,所以字符mocve有没有一种方法可以像在安卓上一样在触摸上工作

我将延迟降低到0.005英寸(input_devices/pointing/ios/touch_delay(,但没有任何变化。我仍然需要按下按钮而不是触摸它,我使用了触摸屏按钮,但在ios中我必须按下它,这样角色才能移动,不像安卓系统那样我必须触摸按钮,这样角色才会移动

默认情况下,iOS上的触摸延迟为150毫秒(但Android上没有(。这是操作系统出于各种原因强加的,但您可以在项目设置(input_devices/pointing/ios/touch_delay(中减小此值,然后再次将项目导出到iOS。

更多的解释可以在这个GitHub问题中找到。

最新更新