ios - ios上的godot角色移动
问题描述
我正在使用 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 上我必须长按我使用的 touchScreenButton,所以角色 mocve 有一种方法可以像在 android 上一样在触摸上工作
我将 (input_devices/pointing/ios/touch_delay) 中的延迟降低到 0.005,但没有任何变化。我仍然必须按下按钮而不是触摸它,我使用触摸屏按钮但在 ios 中我必须按下它才能移动角色,这与我必须触摸按钮才能移动角色的 android 不同
解决方案
默认情况下,iOS 上的触摸有 150 毫秒的延迟(但在 Android 上没有)。这是由操作系统出于各种原因强加的,但您可以在项目设置( )中减小此值input_devices/pointing/ios/touch_delay
并再次将项目导出到 iOS。
更多解释可以在这个 GitHub issue中找到。
推荐阅读
- java - 通过在运行时传入“配置文件”来动态构造 bean
- amazon-ecs - 使用 Fargate 为 ECS 中的服务配置 ALB
- ios - 将调整大小的图像从 Core Data 插入 UICollectionView 的最简单方法是什么?
- php - 使用 php 查找和解析自定义标签
- c# - 使用自定义类型、文件和指针所需的 DLLImport 方法签名进行 C++ 调用
- html - 推特克隆 - 试图在推文索引上的推文旁边显示用户用户名 - 设计
- sql - Laravel 迁移表是 MyISAM 表格式
- javascript - 使用表单输入中的值来确定它们是否超过特定年龄
- ruby-on-rails - 使用 Rails 5 升级了解 gem 的版本兼容性
- popupwindow - 如何在 conversejs 中添加按钮聊天框标题部分?