ID:1736695
 
(See the best response by Mightymo.)


Problem description:Simple I have used mouseentered, and get dir and all that good stuff. Basically I'm trying to have my overlay change more than the basi 8 directions that dm only allows you to do. So instead, i want it to change the icon_state of the overlay everytime the mouse reaches a certain point on the screen. for example in between north east and north. how would I define that with my mouse and of course adding a new iconstate to that dir. And Yes I'm just as confused as you are by reading this

basically your icon moves in 8 different dir. north,east,south,west, and ne,nw,se,sw. I'm trying to make my own in between each one of those so a nee a nww a sww and a see. in which every 12 dir has it's own icon_state. (trying to do a near perfect 360 spin on the mob)
Best response
You need arctan2 to calculate an angle, passing in the deltas.

arctan2(x,y) -> (y>=0)?(arccos(x/sqrt(x*x+y*y))):(-arccos(x/sqrt(x*x+y*y)))

You'll want to round this based on the number of states you have, and translate it accordingly.