PDA

View Full Version : CODERALLY - hitting opponent with tires




neelvaka
Oct 27, 2007, 12:42 AM
yup yup fnny i no

but those familiar to coderally
im trying to hit cars with the most efficient way and the rite angle and direction the car is in when an opponent gets an x ammount away from me.

i have this so far:

if (getDistanceTo(getNearestOpponent()) <= 100) {
throwSpareTire();
}
...
...
...
...

IObject getNearestOpponent() {
double minDistance = 1000000, distance;
IObject theNearestOneO = null;
for (int f = 0; f < Opponents.length; f++) {
distance = getDistanceTo(Opponents[f]);
if (distance < minDistance) {
minDistance = distance;
theNearestOneO = Opponents[f];
}
}
return theNearestOneO;
}

help?