package RCX4; import josx.platform.rcx.*; import josx.robotics.*; /** *Guides the robot over a black line. */ public class FollowTheBlackLine implements Behavior{ boolean goOrNo = true; /** *Makes the robot follow the line. */ public void action() { while (goOrNo){ while (PrettyBoy.lightFlag){ Pilot.turnInPlace(true, 2); } Pilot.forward(75); while (!PrettyBoy.lightFlag){ Pilot.turnInPlace(false, 2); } Pilot.forward(75); } } public void suppress() { goOrNo = false; Pilot.stopAll(); } public boolean takeControl() { if (!PrettyBoy.b2.detected){ return true; }else{ return false; } } //run }//FollowTheBlackLine