Raptisha Posted February 17, 2017 Share Posted February 17, 2017 Hello people! I ran into when issue when I was developing my new game. It is a game where arrows show up on the screen and you have to swipe in the direction that the top arrow is pointing to. You have to swipe when the arrow is within a certain area on the screen (check the screenshot), represented by a faded arrow in the circle. That arrow in the circle rotates to the direction that the closes moving arrow is pointing to. I use tween for the rotation animation. Here is the problem. When the arrow in the circle is pointed to the left (angle = -180) and the incoming arrow point down (angle = 90), the arrow in the circle is animated clockwise, meaning it goes through top, right and then finally down, not straight down as I want. I have set up an if statement to switch arrow's in the circle angle to 180, but it does not work. Changing it to 179 works as expected. Why can't I change it to 180 in the first place? Link to comment Share on other sites More sharing options...
scheffgames Posted February 17, 2017 Share Posted February 17, 2017 You could try Phaser.Math.getShortestAngle or take a look at an older thread discussing the same issue. Link to comment Share on other sites More sharing options...
samme Posted February 17, 2017 Share Posted February 17, 2017 14 hours ago, Goehybrid said: Why can't I change it to 180 in the first place? 180° is wrapped to -180°. Link to comment Share on other sites More sharing options...
Recommended Posts