Skip to main content

Stage 1: Build the Ship Screen

Course progressStage 1 of 10
~40 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

a Turtle screen, named boundaries, and a simple ship room

Learn

how coordinates give every game object a place

Ship

a spaceship map ready for characters and tasks

The big idea

Games need a map before they need controls. Python Turtle gives us a coordinate grid, and named edges make the grid readable.

New words
coordinate
an x/y pair that names a point on the screen
variable
a name that stores a value the program uses later
screen
the Turtle window where the game appears
boundary
an edge the player should not cross
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

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.

Python code task
Write this part

main.py

Add this to your current Trinket file.

#!/bin/python3
import turtle

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

map_pen = turtle.Turtle()
map_pen.hideturtle()
map_pen.penup()
map_pen.color("cyan")
map_pen.setposition(LEFT + 40, BOTTOM + 60)
map_pen.pendown()
for side in [RIGHT - LEFT - 80, TOP - BOTTOM - 120, RIGHT - LEFT - 80, TOP - BOTTOM - 120]:
    map_pen.forward(side)
    map_pen.left(90)

turtle.done()
Trace it

Trace the idea

  1. `LEFT`, `RIGHT`, `TOP`, and `BOTTOM` are calculated from the Trinket window.
  2. The map pen travels around the room and draws the border.
  3. Later, player movement will compare positions to these boundaries.

Try this

Learning beat

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

  • The screen opens.
  • The background is dark.
  • A cyan room border appears.
  • The four edge variables are named in all caps.