[]键盘事件监听时间间隔问题
您好,发现一个问题,我想通过玩家按住方向健控制玩家移动,比如按住“向右键”玩家一直向右走,移动速度根据Event.KEY_DOWN事件回调向前移动,但刚开始按住方向健的第一次和第二次或前几次的回调间隔时间很长,如下是按住某个健的回调时间,第一次和第二次时间间隔相差很大,后面间隔就正常,这是什么问题要如何解决呢?谢谢!
Laya.stage.on(Event.KEY_DOWN, this, this.onKeyDown);
// 回调时间时隔
move right1: characterX: 200, currTime: 1486458463.82
move right1: characterX: 204, currTime: 1486458464.338
move right1: characterX: 208, currTime: 1486458464.357
move right1: characterX: 212, currTime: 1486458464.404
move right1: characterX: 216, currTime: 1486458464.427
move right1: characterX: 220, currTime: 1486458464.463
move right1: characterX: 224, currTime: 1486458464.489
move right1: characterX: 228, currTime: 1486458464.525
move right1: characterX: 232, currTime: 1486458464.571
move right1: characterX: 236, currTime: 1486458464.587
move right1: characterX: 240, currTime: 1486458464.621
move right1: characterX: 244, currTime: 1486458464.672
move right1: characterX: 248, currTime: 1486458464.687
move right1: characterX: 252, currTime: 1486458464.738
Laya.stage.on(Event.KEY_DOWN, this, this.onKeyDown);
// 回调时间时隔
move right1: characterX: 200, currTime: 1486458463.82
move right1: characterX: 204, currTime: 1486458464.338
move right1: characterX: 208, currTime: 1486458464.357
move right1: characterX: 212, currTime: 1486458464.404
move right1: characterX: 216, currTime: 1486458464.427
move right1: characterX: 220, currTime: 1486458464.463
move right1: characterX: 224, currTime: 1486458464.489
move right1: characterX: 228, currTime: 1486458464.525
move right1: characterX: 232, currTime: 1486458464.571
move right1: characterX: 236, currTime: 1486458464.587
move right1: characterX: 240, currTime: 1486458464.621
move right1: characterX: 244, currTime: 1486458464.672
move right1: characterX: 248, currTime: 1486458464.687
move right1: characterX: 252, currTime: 1486458464.738
没有找到相关结果
已邀请:
要回复问题请先登录
1 个回复
Laya_XS
赞同来自: