19. Creating a colorful car

We most know a lot of LOGO programming so far , we know how to create shapes , and we also now how to set a background color. We will divide this lesson to few steps that will eventually create a car. We will create the windows and than we will create the wheels and than we will also define the car
Please clear the screen
Here we will use a procedure that getting parameters rams (Which we have learned on lesson "Procedure"). We will teach the LOGO turtle a new command calling window. the command will get 2 parameters , the window size (We can assume window is a square) and the filling color used by Filled
Teach the WINDO command , will get 2 parameters :size :color and use the FILLED command to create. the inner loop inside the FILLED will be repeat 4 [fd :size rt 90]]
After we have created the window , the wheel creation will be intuitive. The wheel is a circle with a color , We will create the circle using the ARC command learned in "The turtle world" lesson
Teach the turtle the wheel command getting the ARC_RADIUS parameter called "radius" and the wheel color called "color"
The command here is pretty long using a lot of pu and pd commands , what we should notice here is that .. after using the wheel and windo commands we will put the command parameters . We will set sometimes the color back to blck because it's our shield color .
Teach to Turtle the following command : to car cs pu setxy 130 -50 pd rt 90 fd 70 lt 90 fd 70 lt 90 fd 70 rt 90 fd 100 lt 90 fd 300 lt 90 fd 100 rt 90 fd 70 lt 90 fd 70 lt 90 fd 40 pu fd 30 pd wheel 30 "black fd 240 pu fd 30 pd wheel 30 "black pu setxy 30 80 pd windo 50 "yellow setcolor "black pu setx -100 pd windo 50 "yellow setcolor "black ht end
We thought the turtle what is a car so let's run it :)
Draw the car
Now we can play and fill the car body color. There are a lot of options using the FILL command. Here is an example.
write the command pu lt 180 fd 20 setcolor "red fill
TurtleAcademy learn programming for freeYour browser is not supporting canvasWe recomand you to use Chrome or Firefox browsers