Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/383.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
在屏幕、Javascript画布、等轴测游戏开发人员上移动时显示正确的精灵帧时出现问题_Javascript_Game Development_Isometric - Fatal编程技术网

在屏幕、Javascript画布、等轴测游戏开发人员上移动时显示正确的精灵帧时出现问题

在屏幕、Javascript画布、等轴测游戏开发人员上移动时显示正确的精灵帧时出现问题,javascript,game-development,isometric,Javascript,Game Development,Isometric,我的等轴测世界倾斜26.565度。我的精灵是72帧精灵。在地图上移动时,精灵显示的帧不正确,相差1-2-3帧。在计算移动量时,应该对三角形的对边或相邻边做一些数学调整。这是什么 eThis is how I calculate my coords: 玩家[i].detail.contract=players[i].detail.targetY-players[i].coor.y; 玩家[i].detail.nextant=玩家[i].detail.targetX-玩家[i].coor.x 这就

我的等轴测世界倾斜26.565度。我的精灵是72帧精灵。在地图上移动时,精灵显示的帧不正确,相差1-2-3帧。在计算移动量时,应该对三角形的对边或相邻边做一些数学调整。这是什么

eThis is how I calculate my coords:
玩家[i].detail.contract=players[i].detail.targetY-players[i].coor.y; 玩家[i].detail.nextant=玩家[i].detail.targetX-玩家[i].coor.x

这就是我如何计算精灵的正确帧的方法(注意:我的精灵从-90度开始(从坐标表的左侧开始,而不是从顶部开始)

我怀疑,一些数学修正必须引入到另一边,但我不确定。尝试了我可能尝试的一切,因此问题

players[i].detail.newLocationFrame = Math.round(  (Math.atan2(players[i].detail.opposite,players[i].detail.adjacent)*(180/Math.PI)+180)/5)*players[i].detail.frameHeight;