Phaser.events.onInputOut 未发货
Phaser.events.onInputOut not dispatched
我试图让精灵在鼠标悬停在它上面时移动,我希望它在鼠标不再悬停在它上面时停止。
这是我的代码:
mySprite.events.onInputOver.add(() => touchMouse = true);
mySprite.events.onInputOut.add(() => touchMouse = false);
和
update() {
if (touchMouse) {
mySprite.x += 5;
}
}
我的 sprite 正在正确移动,但如果我不将指针移出 初始 sprite 位置,则不会发送 onInputOut 信号!!这导致我的精灵离开我的指针并继续它的旅程,直到我移动我的鼠标...
这是相位错误吗?有没有人能解决这个问题?
非常感谢,祝您愉快,
西蒙
编辑:
我只是尝试使用 Phaser.InputHandler 对象,但我遇到了同样的错误。这是代码:
update() {
if (mySprite.input.pointerOver()) {
mySprite.x += 5;
}
}
有人在 html5gamedevs 论坛中回答了我的问题。
Phaser doesn't ordinarily update inputOver/inputOut events while the pointer isn't moving. You need to set pointer.dirty = true for that.
我试图让精灵在鼠标悬停在它上面时移动,我希望它在鼠标不再悬停在它上面时停止。
这是我的代码:
mySprite.events.onInputOver.add(() => touchMouse = true);
mySprite.events.onInputOut.add(() => touchMouse = false);
和
update() {
if (touchMouse) {
mySprite.x += 5;
}
}
我的 sprite 正在正确移动,但如果我不将指针移出 初始 sprite 位置,则不会发送 onInputOut 信号!!这导致我的精灵离开我的指针并继续它的旅程,直到我移动我的鼠标...
这是相位错误吗?有没有人能解决这个问题?
非常感谢,祝您愉快,
西蒙
编辑:
我只是尝试使用 Phaser.InputHandler 对象,但我遇到了同样的错误。这是代码:
update() {
if (mySprite.input.pointerOver()) {
mySprite.x += 5;
}
}
有人在 html5gamedevs 论坛中回答了我的问题。
Phaser doesn't ordinarily update inputOver/inputOut events while the pointer isn't moving. You need to set pointer.dirty = true for that.