Line-following robot
Advanced · Build a track with the robot tileset and program a robot with two color sensors.
Interactive tutorial: the editor checks each step by itself.
- Add the "Game world" extension.
- In the World category, click "Open the map editor", then "Start with a robot track" and save.
- Add the "Robot and sensors" extension.
- Choose a sprite and click "Open the robot editor" (Robot category). Save the "Line follower" robot.
- Drag "when green flag clicked" with a "forever" below.
- Inside the "forever", put "if … then else" (Control) with "sensor left color sees black?" (Robot) as the condition.
- In "then", put "motors: left -20 % right 60 %"; in "else", "motors: left 60 % right -20 %".
- Move the robot onto the black line, point it up and click the flag!
- Challenge: use "when I pass start gate" and "last split time" to time the laps. (challenge)