如何在移相器中添加 input.ondown 的持续时间?
How to add duration for input.ondown in phaser?
我如何在 Phaser 中为 this.input.onDown()
事件添加持续时间,以便如果用户点击说 10 毫秒操作 "A" 应该发生,如果点击时间延长则操作 "B" 应该发生吗?
if (this.input.activePointer.duration > 10 && this.input.activePointer.duration < 25) {
// do action "A"
}
else if (this.input.activePointer.duration > 25) {
// do action "B"
}
将其放入 update()
或将其包装在您从那里调用的函数中。
如果您有多个(例如在移动设备上),它应该适用于最后一个活动指针。
我如何在 Phaser 中为 this.input.onDown()
事件添加持续时间,以便如果用户点击说 10 毫秒操作 "A" 应该发生,如果点击时间延长则操作 "B" 应该发生吗?
if (this.input.activePointer.duration > 10 && this.input.activePointer.duration < 25) {
// do action "A"
}
else if (this.input.activePointer.duration > 25) {
// do action "B"
}
将其放入 update()
或将其包装在您从那里调用的函数中。
如果您有多个(例如在移动设备上),它应该适用于最后一个活动指针。