/// <summary> /// Get the direction to aim that bullet /// </summary> /// <returns>angle to target the bullet</returns> public virtual float GetAimDir() { //get the player position so we can aim at that little f****r Debug.Assert(null != MyBulletManager); Vector2 shipPos = MyBulletManager.PlayerPosition(this); //get our position Vector2 pos = new Vector2(X, Y); //get the angle at that dude return((shipPos - pos).Angle()); }
/// <summary> /// Get the direction to aim that bullet /// </summary> /// <returns>angle to target the bullet</returns> public float GetAimDir() { //get the player position so we can aim at that little f****r Debug.Assert(null != MyBulletManager); Vector2 shipPos = MyBulletManager.PlayerPosition(this); //TODO: this function doesn't seem to work... bullets sometimes just spin around in circles? //get the angle at that dude float val = (float)Math.Atan2((shipPos.X - X), -(shipPos.Y - Y)); return(val); }