Stage 10: Polish and Demo
Keep building in the workspace on the right.
This stage is part of the same Crewmate Task Dash project you started in Setup. Type each new code block into the Trinket rail and keep building on the last stage.
instructions, final messages, and a demo script
how to make a project playable by someone else
a parent-demo-ready Python Turtle game
The big idea
The final stage is about communication. The game should teach controls, show progress, end clearly, and give the student code they can explain.
- polish
- small improvements that make a project feel finished
- onboarding
- helping a new player understand what to do
- demo script
- a short explanation of what you built and how it works
- refactor
- improve code organization without changing the goal
The player moves through the ship, collects tasks, and avoids the chaser. All playable shapes are drawn with Python Turtle code.
Build it
Type, run, test
Need a hint?
Add the new code to the same Trinket project. Keep previous stage code unless the stage says to replace a function.
main.py
Add this to your current Trinket file.
instruction_writer = turtle.Turtle()
instruction_writer.hideturtle()
instruction_writer.penup()
instruction_writer.color("white")
instruction_writer.setposition(0, BOTTOM + 15)
instruction_writer.write("Arrow keys move | Finish every task | Avoid the chaser",
align="center",
font=("Arial", 12, "normal"))
# Demo script:
# 1. I used coordinates to place rooms and tasks.
# 2. I used functions to draw and move the player.
# 3. I used a loop to move the chaser.
# 4. I used conditions to decide win or lose.Trace the idea
- Instructions are for the next player, not the programmer.
- The demo script points to real code systems.
- The final game should run from green flag to ending without coach help.
Try this
Try this
Three short experiments. Predict before you run, then test your guess.
Test your stage
- Instructions appear on screen.
- The game has a clear win and lose message.
- The student can explain one function and one condition.
- The project is saved in Trinket.
Stuck? Compare carefully
main.py
Use this complete version only after building the stages yourself.
#!/bin/python3
import turtle
import random
import math
screen = turtle.Screen()
screen.bgcolor("midnight blue")
screen.title("Crewmate Task Dash")
LEFT = -screen.window_width() / 2
RIGHT = screen.window_width() / 2
TOP = screen.window_height() / 2
BOTTOM = -screen.window_height() / 2
player = turtle.Turtle()
player.penup()
player.speed(0)
player.color("tomato")
player.shape("circle")
player.setposition(0, 0)
tasks = [(-190, 120), (190, 120), (-170, -120), (170, -120)]
tasks_done = 0
score = 0
game_on = True
hud = turtle.Turtle()
hud.hideturtle()
hud.penup()
hud.color("white")
chaser = turtle.Turtle()
chaser.penup()
chaser.speed(0)
chaser.color("purple")
chaser.shape("circle")
chaser.setposition(220, 0)
def update_hud():
hud.clear()
hud.setposition(0, TOP - 45)
hud.write(f"Tasks: {tasks_done}/{len(tasks)} Score: {score}", align="center", font=("Arial", 16, "bold"))
def draw_tasks():
task_pen = turtle.Turtle()
task_pen.hideturtle()
task_pen.penup()
task_pen.color("gold")
for x, y in tasks:
task_pen.setposition(x, y)
task_pen.dot(24)
def move_player(dx, dy):
if not game_on:
return
new_x = player.xcor() + dx
new_y = player.ycor() + dy
if LEFT + 30 < new_x < RIGHT - 30 and BOTTOM + 30 < new_y < TOP - 70:
player.setposition(new_x, new_y)
def up():
move_player(0, 20)
def down():
move_player(0, -20)
def left():
move_player(-20, 0)
def right():
move_player(20, 0)
def check_tasks():
global tasks_done, score, tasks
remaining = []
for task in tasks:
if player.distance(task) < 28:
tasks_done += 1
score += 50
else:
remaining.append(task)
tasks = remaining
update_hud()
def move_chaser():
if not game_on:
return
chaser.setheading(chaser.towards(player))
chaser.forward(4)
def end_game(message):
global game_on
game_on = False
hud.setposition(0, 0)
hud.write(message, align="center", font=("Arial", 24, "bold"))
def game_loop():
check_tasks()
move_chaser()
if chaser.distance(player) < 28:
end_game("Captured! Try again.")
return
if tasks_done == 4:
end_game("All tasks complete! You win!")
return
screen.ontimer(game_loop, 80)
screen.listen()
screen.onkey(up, "Up")
screen.onkey(down, "Down")
screen.onkey(left, "Left")
screen.onkey(right, "Right")
draw_tasks()
update_hud()
game_loop()
turtle.done()