Three minutes of setup
This is your first time writing code in a real editor instead of a web page. VS Code runs exactly what you typed — nothing more, nothing less. That is the whole point, and it is also why the first run usually fails for a small reason. That is normal. Everyone here will hit at least one error today.
- Make a folder. On your Desktop, make a new folder called
turtle_arcade. Underscore, no spaces. - Open the folder in VS Code. File → Open Folder → pick that folder → Open. Open the folder, not a file.
- Install the Python extension. Click the Extensions icon (four squares) on the left, search Python, install the one by Microsoft. If it already says "Installed," skip this.
- Pick your Python. Press
Ctrl+Shift+P(Mac:Cmd+Shift+P), type Select Interpreter, press Enter, and choose anything starting with Python 3. - Make your file. In the left panel, click the new-file icon next to your folder name.
Name it
turtle_arcade.pyexactly.
turtle.py. Python would load your file instead of the real turtle
library and give you AttributeError: module 'turtle' has no attribute 'Turtle'.
It looks like the library is broken, but it is just the name. Use
turtle_arcade.py.
✅ Step 0 — prove it works
Type these three lines into turtle_arcade.py and press the
▶ Run button in the top-right corner.
A window should open and an arrow should draw a line across it. That is it. If that works, your laptop is ready and everything else today is just more lines.
Once the line draws, delete those three lines and start Level 1 on a clean file.
A game someone can actually play
It asks the player their name, draws a target, and then waits. Every time the player clicks, it measures how close they got to the middle and adds up points.
That measuring step is the reason this task exists. A click comes in with an x and a y, you check the distance to the centre, and you turn that distance into points. That is hit detection. Every game you have played does some version of it.
You already know most of this
input()andint()— Activity 1.1.2circle()— the Arc Labfillcolor/begin_fill/end_fillpenup,pendown,goto
Three rings and a score. Your colours can be whatever you want.
🎯 Scoring rings
| Ring | Radius | Colour | Points |
|---|---|---|---|
| Bullseye | 40 | gold | 10 |
| Middle | 80 | red | 5 |
| Outer | 120 | white | 1 |
| Anywhere else | — | — | 0 |
How today is graded
Levels 1 to 4 are the assignment. Finish those and you are done — you will have a working, clickable game. The Stretch tab is extra, for anyone who gets there.
Run your program after every level. Four small errors you catch one at a time are easy. Forty lines of untested code is not.
Open the window
Type this at the top of your empty file. The grey lines starting with #
are comments — Python ignores them, so you can skip them if you are short on time.
turtle.done() is what keeps the window open —
it always stays the last line of your program. Everything you add goes above it.object.method(value).
pen is the object you made, .write is the
action, and what is in the brackets tells it how. That is the sentence you labelled in the review game.Ask the player who they are
Add these lines above turtle.done().
input()
until you type in the terminal at the bottom. Click down there first.
str(shots)? int() turned the answer
into a number, and Python will not glue a number onto text. str() turns it
back into text just for writing on screen. Leave it out and you get
TypeError — the exact error from the Do Now.
Draw the target
Three filled circles, biggest first. Here is the first ring, complete. Add it above
turtle.done().
Now copy those seven lines twice more and change only the numbers and colours:
goto(0, -120) and not (0, 0)?
The centre of a turtle circle sits one radius to the turtle's left. Facing east at
(0, -120), left is straight up — so the centre lands on
(0, 0). Same rule as the Arc Lab.
Make it clickable
Everything so far ran once, top to bottom. Now you write a block that waits and runs every time the player clicks.
def shoot(x, y): creates one named shoot.
The x and y get filled in with wherever the
player clicked. The last line hands your function to the screen — with no brackets after
shoot, because you are handing it over, not running it.
Type this exactly. The indents matter — every line inside
shoot is pushed in four spaces.
global score does: without it, Python makes a brand-new
score inside the function every click and throws it away. That line says
"use the real one out there."
Finished Levels 1 to 4?
- Take a screenshot of your game window with some points on the board.
- Go to the Pre-Flight tab, paste your whole program, and run the check.
- Submit the screenshot and your
turtle_arcade.pyfile.
Time left over? The Stretch tab adds an arena wall and a shot limit.
Only if Levels 1–4 already run
These are extras. Do not start one until your game works and you have saved a copy you are happy with.
Build an arena wall
Ask the player how many walls, then draw a polygon around the target using the third number
in circle() — the one from the Arc Lab.
Make the shots run out
You already asked for shots in Level 2. Now use it. Add a counter
next to score = 0:
Then change your function: add shots_left to the global line, put a
guard at the very top, and count down before you write the score.
return means "stop running this function right now."
Without that guard the player could keep firing forever. Every game has a version of it.Then make the score line show a different message when the shots are gone:
Your own ideas
- Let the player pick the bullseye colour with another
input(). - Move the target somewhere new after every hit. Look up
import randomandrandom.randint. - Two players taking turns, each with their own score.
- Make a miss flash a message instead of silently scoring 0.
Find your error message here
Read the last line of the red text in the terminal. That line names the problem. Match it below.
| What it says | What it means | Fix |
|---|---|---|
| ModuleNotFoundError: No module named 'turtle' | VS Code has no Python selected. | Ctrl+Shift+P → "Python: Select Interpreter" → pick Python 3. |
| AttributeError: module 'turtle' has no attribute 'Turtle' | Your file is named turtle.py. |
Rename it turtle_arcade.py and delete any __pycache__ folder. |
| SyntaxError: invalid character | Curly quotes, from copying out of Docs or a website. | Delete the quotes and retype them in VS Code. |
| IndentationError | A line is pushed in when it should not be, or you mixed tabs and spaces. | Use 4 spaces for every line inside def shoot, and nothing else. |
| TypeError: can only concatenate str | You joined a number onto text. | Wrap the number: str(score), str(shots). |
| NameError: name '...' is not defined | Typo, or you used something before you made it. | Check the spelling, and check it appears above the line that uses it. |
| SyntaxError: unexpected EOF / invalid syntax | Usually a missing ) or a missing :. |
Look at the line above the one Python names. Count your brackets. |
| The window opens and vanishes | The program ended. | turtle.done() must be the last line. |
| Nothing happens, no error | It is waiting for your input. | Click the terminal at the bottom, type your answer, press Enter. |
| Clicking does nothing | onscreenclick is missing, or has brackets after shoot. |
It must read screen.onscreenclick(shoot) — no () after shoot — and sit above turtle.done(). |
✅ Quick self-check
Tick these off as you go. If a level will not run, the answer is almost always on this list.
Pre-Flight Check
Paste your whole program below. The check reads your code the way Python does, so comments and text inside quotes do not count.
It checks the pieces are there. It cannot tell you whether the game is fun — run it and play it before you submit.