Learn > BGE > Python – Turtle Graphics > 2. Colour >
Boat
Task 1
Create the Python program below to draw a boat.
Code
from turtle import *
screen = getscreen()
tom = Turtle()
tom.fillcolor("brown")
# Boat
tom.begin_fill()
tom.forward(100)
tom.left(45)
tom.forward(50)
tom.left(135)
tom.forward(180)
tom.left(135)
tom.forward(50)
tom.end_fill()
# Move to top of boat
tom.left(45)
tom.forward(50)
tom.left(90)
# Sail
tom.forward(150)
tom.right(135)
tom.forward(100)
tom.right(135)
tom.forward(70)
Task 2
Add water to the scene by drawing a blue rectangle.
- Set colour to blue
- Begin fill
- Draw rectangle
- End fill
- Move to boat start position
- Set colour to brown
- Begin fill
- Draw boat
- End fill
This code would draw a blue rectangle.
tom.fillcolor("blue")
tom.begin_fill()
tom.forward(400)
tom.right(90)
tom.forward(100)
tom.right(90)
tom.forward(400)
tom.right(90)
tom.forward(100)
tom.right(90)
tom.end_fill()
Challenges
Improve the graphic by adding the following:
- Sky
- Clouds
- Flag
- Waves