/* * This is the movememnt function. It will cause us * to circle strafe the enemy (ie move back and forward, * circling the enemy. if you don't know what strafing means * play more quake. * The direction variable is global to the class. Passing a * negative number to setAhead causes the bot to go backwards */ void doMovement() { if (getTime()%20 == 0) { //every twenty 'ticks'. The % operator is a modulus. direction *= -1; //reverse direction setAhead(direction*300); //move in that direction } setTurnRightRadians(target.bearing + (PI/2)); //every turn move to circle strafe the enemy }