Skip to main content

Stage 6: Spawn the Chaser

Course progressStage 6 of 10
~50 min
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

an impostor-style chaser character

Learn

how a second Turtle can become a game actor

Ship

a danger character waiting on the ship

Before you start

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.

New words
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

Trace it

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.

Think first

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.

Finished game target
Tasks 2/4Score 80
Crewmate playerTask stationShadow chaser

The player moves through the ship, collects tasks, and avoids the chaser. All playable shapes are drawn with Python Turtle code.

Build it

Think first

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.

Your turn

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.

Your turn

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.

Your turn

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.

Your turn

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

Your turn

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
Answer check
Debug compare only

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")
Python code task
Full stage code

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 it

Trace the idea

  1. The chaser uses the same drawing pattern as the player.
  2. A different color tells players it has a different role.
  3. It starts away from the player so the game is fair.

Understand it

Trace 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

Trace it

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

Learning beat

Try this

Three short experiments. Predict before you run, then test your guess.

Predict first
Change the chaser spawn x from `220` to `-220`. Predict where the danger starts.
Compare
Try purple, red, and black for the chaser. Which reads as danger fastest?
Connect
What other games use color to tell players which objects are safe or unsafe?

Test your stage

  • The chaser appears.
  • The chaser is visually different from the player.
  • The chaser starts at x 220.