I am detecting angles in my code (in degrees) but when i have ege of 359 and 0 it will not work. I have minimum and maximum angle and angle of object. If you can help me i will thank you.
Spoiler
Spoiler
Spoiler
Spoiler
Spoiler
Spoiler
Spoiler
Spoiler
Spoiler
Spoiler
Spoiler
Spoiler
P.S. This is for stealth map.
Quote from: FluroM on November 07, 2017, 09:37:38 AM
I am detecting angles in my code (in degrees) but when i have ege of 359 and 0 it will not work. I have minimum and maximum angle and angle of object. If you can help me i will thank you.Spoiler
P.S. This is for stealth map.
Well, if this isn't just cruel joke, PM that code to me? It's working way to not give code away to allbody. :D
Indeed. We can't help if we don't have the code. If it's a strategy-spoiler, you've warned of it already.
#angle is angle of enemy
#playerangle is angle between enemy and player
#everything is in degress and from 0 to 360
<-angle 45 add ->maxangle
<-angle 45 sub ->minangle
if(and(<-playerangle <-minangle gte <-playerangle <-maxangle lte))
Self "main" 0 255 0 255 SetImageColor #For debuging
endif
This is everything
So, you want to know when a an angle is within "tolerance" of "angle".
#Using radians
:InSector
->Tolerance ->AngleB ->AngleA
<-AngleB <-AngleA ShortestAngle abs <-Tolerance lt
ShortestAngle requires the angles to be measured in radians. However, it is the easiest (and most efficient) solution to your problem.
<-angle <-playerangle PI 2 div @InSector if
#Code
endif