« Return to Thread: Help understanding a bot!!

Re: Help understanding a bot!!

by Eggplant :: Rate this Message:

Reply to Author | View in Thread


if ((getHeading() - getGunHeading() + e.getBearing()) < 180) {
                          turnGunRight(getHeading() - getGunHeading() + e.getBearing())
}

That basically means if when the event (which shortens to e) happens, if the direction of your bot - the directon of your gun + the direction of the event is less than 180, than the bot will turn its turret right an equivalent amount to the direction of the bot - the direction of the gun + the direction of the event, which would point the gun in the direction of the event.

 « Return to Thread: Help understanding a bot!!