Stage 2: Draw the Crewmate
Course progressStage 2 of 10
One game, one Trinket
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.
Build
a player character drawn with Turtle code
Learn
how functions package drawing steps
Ship
a colorful crewmate-style player on the ship
The big idea
We are not importing a character. We are building one with code so students understand every shape on the screen.
- function
- a named block of code you can run whenever you need it
- stamp
- a copy of the Turtle's current shape left on the screen
- penup
- move without drawing a line
- parameter
- a value you pass into a function
Tasks 2/4Score 80
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
Read the code aloud before you run it. The goal is to understand what changed in the game.
Need a hint?
Add the new code to the same Trinket project. Keep previous stage code unless the stage says to replace a function.
Write this part
main.py
Add this to your current Trinket file.
player = turtle.Turtle()
player.penup()
player.speed(0)
player.color("tomato")
player.shape("circle")
player.setposition(0, 0)
def draw_crewmate():
player.clear()
player.turtlesize(2.2, 1.5)
player.stamp()
player.sety(player.ycor() + 20)
player.color("light cyan")
player.turtlesize(0.7, 1.1)
player.stamp()
player.color("tomato")
player.sety(player.ycor() - 20)
draw_crewmate()Trace the idea
- One Turtle draws several stamped shapes.
- `draw_crewmate()` can be called again after the player moves.
- Changing `player.color()` changes the suit.
Try this
Try this
Three short experiments. Predict before you run, then test your guess.
Predict first
Before running, predict which line will visibly change the screen first.
Compare
Change one number, run, then change it back. Which version feels more playable?
Connect
How does this stage make the final game more like a real project?
Test your stage
- A player appears near the center.
- The body and visor are different colors.
- The drawing code is inside a function.