camera.rotatearound(...)//I guess you rotating +90 or -90 in this game
maprotation+=... //+90 or -90 depends on side you turn.
//i ll assume rotation direction is counter clock wise.
现在你知道了旋转,所以你可以用三角法设置玩家的移动 .
在player.moveup(浮动maprotation)方法或者你编写代码移动到北方时 .
x+=MathUtils.cosDeg(90-maprotation)*speed;//90 degree for moving up
y+=MathUtils.sinDeg(90-maprotation)*speed;// - maprotation for correction
1 回答
首先你需要存储 Map 的旋转角度 . 然后当玩家移动时你需要考虑 Map 的旋转角度 .
现在你知道了旋转,所以你可以用三角法设置玩家的移动 .
在player.moveup(浮动maprotation)方法或者你编写代码移动到北方时 .
正如你所看到的那样,相机旋转时方向也会旋转 . 所以你只需要减去 Map 旋转来纠正 .