tracking?

Started by
0 comments, last by ViPeR007 24 years, 1 month ago
Does anyone know a good way of having an object (like a turret) track another and adjust its frames accordingly. Like right now I have it working but its a really long and annoying way. Its just: if(PlayerX > (EnemyX - 50) && PlayerX < (EnemyX + 50)) Enemy = SetFrame(4); And so on and it gets really long when you do it for 16 frames. Is there a better way of doing this? Thanx, ViPeR
Advertisement
Asign a angle range to each frame (i.e the range of angles that a frame can be used for), and use cos and sin look-up tables to calculate the relative angle of the player, and then search for the appropiate frame.

WARNING!!! WARNING!!! WARNING!!!


This may not be better or more efficient!!!

WARNING!!! WARNING!!! WARNING!!!


This topic is closed to new replies.

Advertisement