Stage 6: Spawn the Chaser
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.
an impostor-style chaser character
how a second Turtle can become a game actor
a danger character waiting on the ship
Make sure you finished Stage 5: Track Score and Progress. Your Trinket project should already have a HUD that updates the task count and score whenever the player collects a task. Open the same file you used last stage and keep building from there.
The big idea
The chaser is another Turtle with its own position, color, and behavior. That is enough to create stakes.
- actor
- a game object that can move or affect gameplay
- spawn
- place a game object into the world
- state
- the current condition of a game object or round
- danger
- something the player has to avoid
Python concept
Objects
What it means: An object is a thing in code that has its own data and actions.
Tiny Python example:
player = turtle.Turtle()
chaser = turtle.Turtle()
In this game: `player`, `chaser`, and `hud` are Turtle objects. Each one has its own position, color, and job.
Why it matters: Objects let the game keep actors separate. Moving the chaser should not accidentally move the player.
Check: Objects
Why do we need both `player` and `chaser` variables?
Check your thinking
They refer to different Turtle objects with different positions and roles.
The player moves through the ship, collects tasks, and avoids the chaser. All playable shapes are drawn with Python Turtle code.
Build it
Same pattern, different role
Which values should change between the player and the chaser: the drawing commands, the colors, or the role?
Check your thinking
The drawing pattern can stay similar, but the colors and role should clearly change.
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.
Step 1 - Create a second actor
The chaser is a separate Turtle from the player. It needs its own variable so it can have its own position, its own color, and its own future movement. Sharing the player variable here would mean the chaser literally is the player, and that breaks everything.
chaser = turtle.Turtle()
chaser.penup()
chaser.speed(0)
chaser.color("purple")
You should see — the new Turtle exists, but it has not been drawn yet. It is a purple circle waiting in code, ready for `draw_chaser()` to stamp it onto the screen in Step 3.
Need a hint?
Type and run one step at a time. If this step breaks, fix it before adding the next one.
Step 2 - Spawn it away from the player
`setposition(220, 0)` starts the chaser on the right side of the ship. A fair game gives the player a moment to register the threat before it closes the distance, so spawning the chaser far away is a deliberate design choice.
You should see — when `draw_chaser()` runs in Step 3, a purple character appears on the right side of the room. The player is still at the center, so there is open space between them — that gap is the first second of the round.
Step 3 - Reuse the drawing pattern
The chaser's drawing code is intentionally similar to the player's. Reusing the pattern makes new code easier to read because you already understand the shape, and easier to debug because there is only one drawing idea to keep track of.
You should see — a purple character with a light-cyan visor appears, shaped like a darker twin of the crewmate. Same body, same visor pattern, different color — the visual contrast is what tells a player which one is dangerous.
Active coding checkpoint
Create another Turtle object
Create a second Turtle named `helper` with its own color. This should not reuse the `player` variable.
helper = turtle.________()
helper.penup()
helper.color("________")
Need a hint?
Try this before opening the solution. Type the starter code, then fill in or fix the missing part yourself.
Stuck? Compare carefully
main.py
`helper` is a separate object, so changing its color or position will not change the player.
helper = turtle.Turtle()
helper.penup()
helper.color("gold")
main.py
Use this as the stage target after you understand the smaller steps. Add it to your current Trinket file.
chaser = turtle.Turtle()
chaser.penup()
chaser.speed(0)
chaser.color("purple")
chaser.shape("circle")
chaser.setposition(220, 0)
def draw_chaser():
chaser.clear()
chaser.turtlesize(2, 1.4)
chaser.stamp()
chaser.sety(chaser.ycor() + 18)
chaser.color("light cyan")
chaser.turtlesize(0.6, 1)
chaser.stamp()
chaser.color("purple")
chaser.sety(chaser.ycor() - 18)
draw_chaser()
Trace the idea
- The chaser uses the same drawing pattern as the player.
- A different color tells players it has a different role.
- It starts away from the player so the game is fair.
Understand it
Why this code works
- A game actor is any object that can matter to gameplay. The player matters because it moves; the chaser matters because it threatens the player.
- Using a separate variable name is what lets future code ask for `player.distance(chaser)`.
- Visual contrast is part of programming here. If students cannot read the danger quickly, the game logic feels unfair.
If it breaks
Troubleshooting wisdom
If the chaser appears where the player used to be and the player vanishes, the same variable name is being reused for both. The line should read `chaser = turtle.Turtle()`, not `player = turtle.Turtle()`. Each Turtle needs its own variable name so they can exist side by side on the screen.
If the chaser and player look identical, the chaser is being drawn in the player's colors. `chaser.color('purple')` has to run before `chaser.stamp()` — `stamp` takes a snapshot of whatever the Turtle currently looks like, so set the color first, then stamp.
If the chaser is stacked directly on top of the player at the center, the spawn coordinate is `(0, 0)`. Change `chaser.setposition(...)` to something like `(220, 0)` so the chaser starts on the right side and the round opens with a fair gap between them.
Try this
Try this
Three short experiments. Predict before you run, then test your guess.
Test your stage
- The chaser appears.
- The chaser is visually different from the player.
- The chaser starts at x 220.