微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

Phaser 可滚动文本框教程不适用于移动设备

如何解决Phaser 可滚动文本框教程不适用于移动设备

我在我的游戏中重新创建了 scrolling text box tutorial。但是,它在移动设备上运行时有点问题。例如,如果我向上滑动,文本首先向下移动一秒钟,然后跟随我的手指向上移动。如果您在移动设备上打开教程,就会看到问题。有什么想法吗?我复制了下面的代码

var graphics = scene.make.graphics();

graphics.fillRect(x,y + 10,width,height - 20);

var mask = new Phaser.display.Masks.GeometryMask(scene,graphics);

var text = scene.add.text(x + 20,y + 20,content,{ 

  fontFamily: 'Assistant',fontSize: '28px',color: '#000000',wordWrap: { width: width - 20 } 

}).setorigin(0);

text.setMask(mask);

var minY = height - text.height - 20;

if (text.height <= height - 20) {

  minY = y + 20;

}

//  The rectangle they can 'drag' within

var zone = scene.add.zone(x,y - 3,height + 6).setorigin(0).setInteractive({useHandCursor: true});

zone.on('pointermove',function (pointer) {

  if (pointer.isDown) {

    text.y += (pointer.veLocity.y / 10);

    text.y = Phaser.Math.Clamp(text.y,minY,y + 20);

  }

});

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。