Posted By

Message

ZiXiao
Registered 29/07/2002
Points 537

16th March, 2008 at 21:35:51 
Another math related question.... So I've got this soldier that can look in 360 degrees. The soldier's ANGLE is based on the soldier and the player. BUT, I only want to soldier to fire in 8 directions minus straight up and straight down, so really only 6 directions. The bullets the soldier fires uses angles.
So the problem seems to be that I need to go from 360 directions (which is the angle between the soldier and the player) down to 8 directions (because the soldier can only fire in these directions).
This seems like a simple problem but it wouldn't surprise me if it was more complex than I realize.
n/a

alastair john jack BANNED
Registered 01/10/2004
Points 294

17th March, 2008 at 00:27:29 
Can't you just divide the angle by 45?
lol

Cecilectomy noPE
Registered 19/03/2005
Points 305

17th March, 2008 at 02:04:48 
um. learn your unit circle.
0  pi/4  pi/2  3pi/4  pi  5pi/4  3pi/2  7pi/4  2pi
those are the eight calculated angles in radians that you will need shoot.
in degrees its
0  45  90  135  180  225  270  310
just run a few events that checks to see which one its closest to and shoot it at the appropriate angle/direction
n/a


