When I use vectorToAngle formula it returns a degree of 0 to 180degrees or -180 to 0 degrees. Is there any way to only make it return positive anlges 0 to 360degrees? For instance have it return 270degrees instead of -90degrees
Stick %360 at the end of your equation or attribute.
Yup that checks out, thanks a ton!
Vector to angle measures the location between two sets of coordinates, so the way it currently works (0 to 180 and 0 to -180) is right for its context.
If it returned 0-360 I can imagine all sorts of weirdness . . . Imagine you had an actor on screen and a second actor 600 pixels to the right of the first actor, if V2A returned 0-360 then for this set up the angle of actor 2 from actor 1's perspective would be 0°, now if actor 2 moved down just a single pixel the angle produced by V2A would suddenly leap to ~359.99 . . . . which would be weird.
Well I need v2a 0-360 because im building a non grid like pathfinding system. I want enemies to move towards the player, but using 4 directional d-pad. So I have the enemys move in direction 90*self.direction. And then have the self.direction constrained to: floor((((vectorToAngle((game.playerx-self.x), (game.playery-self.y))+45)%360)/90). Which will return a value between 0-3, so far is working just great!