Talk:Linear Targeting/Buggy Implementations

From Robowiki
Jump to navigation Jump to search

These code snippets should be modified to not have super long lines. Also, there's no reason for the last one to be indented across the whole snippet. --Voidious 19:43, 14 November 2007 (UTC)

		double absBearing=e.getBearingRadians()+getHeadingRadians();

		double eX=getX() + e.getDistance() * Math.sin(absBearing);

		double eY=getY() + e.getDistance() * Math.cos(absBearing);



		oldX=getX() + e.getDistance() * Math.sin(absBearing);

		oldY=getY() + e.getDistance() * Math.cos(absBearing);

		double enemyLocation=robocode.util.Utils.normalAbsoluteAngle(Math.atan2((eX-getX())+eXChange,(eY-getY())+eYChange));



I'm trying to make a gun that makes use of code similar to this, but for some reason this doesn't work exactly right... Does anyone know if this is a math problem or a programming problem?--CrazyBassoonist 22:43, 9 April 2009 (UTC)