[Home]New getBearing() methoods

Robo Home | Changes | Preferences | AllPages

I would just copy and paste at the end of your code. Then use it as you like.

note: you have to pass it the event unlike the normall e.getBearing()

sooo, what's the difference between getBearingToGun? and getBearingToRadar?? they kinda look the same to me :-p --Dummy

Yes I did mess up a bit there, I was a bit hasty. But I made it a bit shorter, the old version is now at the bottom.



	public double getBearingTo(String part , ScannedRobotEvent e) {
		if (part.equals("Gun"))
			return(e.getBearing() - (getGunHeading() - getHeading()));
		else
			return(e.getBearing() - (getRadarHeading() - getHeading()));
	}

	public double getBearingTo(String part , HitRobotEvent e) {
		if (part.equals("Gun"))
			return(e.getBearing() - (getGunHeading() - getHeading()));
		else
			return(e.getBearing() - (getRadarHeading() - getHeading()));
	}

	public double getBearingTo(String part , HitByBulletEvent e) {
		if (part.equals("Gun"))
			return(e.getBearing() - (getGunHeading() - getHeading()));
		else
			return(e.getBearing() - (getRadarHeading() - getHeading()));
	}

	public double getRadiansBearingTo(String part , ScannedRobotEvent e) {
		if (part.equals("Gun"))
			return(e.getBearingRadians() - (getGunHeadingRadians() - getHeadingRadians()));
		else
			return(e.getBearingRadians() - (getRadarHeadingRadians() - getHeadingRadians()));
	}

	public double getRadiansBearingTo(String part , HitRobotEvent e) {
		if (part.equals("Gun"))
			return(e.getBearingRadians() - (getGunHeadingRadians() - getHeadingRadians()));
		else
			return(e.getBearingRadians() - (getRadarHeadingRadians() - getHeadingRadians()));
	}

	public double getRadiansBearingTo(String part , HitByBulletEvent e) {
		if (part.equals("Gun"))
			return(e.getBearingRadians() - (getGunHeadingRadians() - getHeadingRadians()));
		else
			return(e.getBearingRadians() - (getRadarHeadingRadians() - getHeadingRadians()));
	}

public double getBearingToGun(HitByBulletEvent e)
{
	return(e.getBearing() - (getGunHeading() - getHeading()));
}
	
public double getBearingToRadar(HitByBulletEvent e)
{
	return(e.getBearing() - (getGunHeading() - getHeading()));
}

public double getBearingToGunRadians(HitByBulletEvent e)
{
	return(e.getBearingRadians() - (getGunHeadingRadians() - getHeadingRadians()));
}
	
public double getBearingToRadarRadians(HitByBulletEvent e)
{
	return(e.getBearingRadians() - (getGunHeadingRadians() - getHeadingRadians()));

}

public double getBearingToGun(HitRobotEvent e)
{
	return(e.getBearing() - (getGunHeading() - getHeading()));	
}

public double getBearingToRadar(HitRobotEvent e)
{
	return(e.getBearing() - (getGunHeading() - getHeading()));
}

public double getBearingToGunRadians(HitRobotEvent e)
{
	return(e.getBearingRadians() - (getGunHeadingRadians() - getHeadingRadians()));
}

public double getBearingToRadarRadians(HitRobotEvent e)
{
	return(e.getBearingRadians() - (getGunHeadingRadians() - getHeadingRadians()));
}

public double getBearingToGun(ScannedRobotEvent e)
{
	return(e.getBearing() - (getGunHeading() - getHeading()));	
}
	
public double getBearingToRadar(ScannedRobotEvent e)
{
	return(e.getBearing() - (getGunHeading() - getHeading()));
}
	
public double getBearingToGunRadians(ScannedRobotEvent e)
{
	return(e.getBearingRadians() - (getGunHeadingRadians() - getHeadingRadians()));
}

public double getBearingToRadarRadians(ScannedRobotEvent e)
{
	return(e.getBearingRadians() - (getGunHeadingRadians() - getHeadingRadians()));
}

Robo Home | Changes | Preferences | AllPages
Edit text of this page | View other revisions
Last edited May 16, 2006 0:12 EST by DB (diff)
Search: