0% found this document useful (0 votes)
5 views15 pages

11 SE Pygame Support Guide 2026

This guide outlines the process for Year 11 students to develop a game using Pygame and Object-Oriented Programming (OOP) principles. It includes a milestone schedule for task completion, installation instructions for Pygame, and essential coding concepts such as event handling, sprite management, collision detection, and sound integration. The document emphasizes the importance of applying OOP principles like encapsulation and inheritance in game development.

Uploaded by

sheepycllips
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
5 views15 pages

11 SE Pygame Support Guide 2026

This guide outlines the process for Year 11 students to develop a game using Pygame and Object-Oriented Programming (OOP) principles. It includes a milestone schedule for task completion, installation instructions for Pygame, and essential coding concepts such as event handling, sprite management, collision detection, and sound integration. The document emphasizes the importance of applying OOP principles like encapsulation and inheritance in game development.

Uploaded by

sheepycllips
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

Year 11 Software Engineering

Student Support Guide


Pygame & OOP Game Development
OOP Assessment Task 2026

Using this guide


Use this guide as a reference alongside the task. The code examples illustrate structure and syntax only
— they are not model answers. Apply the patterns to your own game and consult your teacher where
needed.

1. Milestone Guide
Use the schedule below to manage progress across the four weeks of this task.

Due Milestone What to have done


Term 2, Week 5 Game concept & class diagram Submit a brief (1 paragraph) describing your game theme
(Task released) and main mechanic, plus a UML class diagram showing
your 4+ classes with attributes, methods and
relationships.

Term 2, Week 5– Requirements & basic game Functional and non-functional requirements documented.
6 loop A runnable Python/Pygame window with a player that
responds to keyboard input — just the skeleton.

Term 2, Week 6 Core mechanics implemented NPC interactions, inventory, and win/loss conditions
working. OOP structure (encapsulation, inheritance,
polymorphism) visible in your code.

Term 2, Week 7 Graphics, sound & map Sprites, background images, sound effects and music
complete integrated. Map or environment navigable.

Term 2, Week 7– Code explanation video (Part 3) Record a 3–5 minute screen recording walking through
8 your OOP code. Explain where each principle appears
and why you wrote it that way.

Term 2, Week 8 FINAL SUBMISSION Canvas: ZIP of game files + developer report PDF/Word
(Fri 12 June) (Part 2) + video file or link (Part 3).
2. Getting Started with Pygame
What is Pygame?
Pygame is a Python library for building 2D games. It manages screen rendering, keyboard and mouse input,
audio and game timing, allowing the developer to focus on game logic.

Step 1 — Check your Python version first


Pygame must be installed against the correct Python version. Before proceeding, confirm which version is
active on the machine.

Run the following in a terminal:

python --version
# If that gives an error, try:
python3 --version

Note
Record the Python version returned (e.g. 3.11.2). This will be useful for troubleshooting.

Step 2 — Install Pygame


Install Pygame via pip. If the first command fails, try each alternative in sequence:

pip install pygame

# If that doesn't work, try:


pip3 install pygame

# If that doesn't work, try:


python -m pip install pygame

# Or:
python3 -m pip install pygame

Verify the installation with:

python -m pygame --version

Expected output
A version number confirms a successful installation, e.g. pygame 2.5.2 (SDL 2.28.3, Python 3.11.2).
Setting up in VS Code
VS Code must be configured to use the same Python interpreter against which Pygame was installed.

1. Open VS Code and press Ctrl+Shift+P (Windows) or Cmd+Shift+P (Mac) to open the Command
Palette.
2. Type 'Python: Select Interpreter' and press Enter.
3. A list of Python versions installed on your laptop will appear. Select the one that matches the version
you saw in Step 1.
4. Open a new terminal inside VS Code (Terminal menu → New Terminal) and run python -m pygame -
-version again to confirm it works from inside VS Code.

Common issue
If Pygame works in a terminal but not in VS Code, the wrong interpreter is selected. Return to the
Command Palette and select the correct Python version.

Setting up in Sublime Text


Sublime Text runs Python files via a build system rather than an integrated terminal. A custom build system
must be configured to target the correct Python installation.

5. Install Pygame from a regular terminal first (as above in Step 2). Make a note of the full path to your
Python — to find it, run: where python (Windows) or which python3 (Mac).
6. In Sublime Text, go to Tools → Build System → New Build System.
7. Replace the contents with the code below, swapping in your actual Python path:

{
"cmd": ["C:/Users/YourName/AppData/Local/Programs/Python/Python311/[Link]", "-
u", "$file"],
"file_regex": "^[ ]*File \"(...*?)\", line ([0-9]*)",
"selector": "[Link]"
}

8. Save the file with a name like [Link]-build.


9. Go to Tools → Build System and select MyPython. Now press Ctrl+B to run your file.

Mac path example


On a Mac your path will look like: /usr/local/bin/python3 or
/Library/Frameworks/[Link]/Versions/3.11/bin/python3. Use the output of 'which python3' to
find yours.
Common Installation Problems

Problem What to try


pip is not recognised / pip not found Try pip3 instead of pip, or use python -m pip install pygame. If still
nothing, Python may not be added to your system PATH — ask your
teacher.

ModuleNotFoundError: No module Pygame is installed on a different Python version than the one running
named 'pygame' your file. Check your interpreter in VS Code (Python: Select Interpreter) or
check which Python Sublime Text is using.

pip install works but import pygame VS Code is using a different Python than where pip installed Pygame.
fails in VS Code Open the Command Palette, run Python: Select Interpreter, and pick the
correct version.

No module named 'pygame' on Mac On Mac you may need: pip3 install pygame. Also check if you have
multiple Python versions installed via Homebrew — run which python3
and which pip3 to confirm they point to the same location.

pygame installed but game window This is usually a code issue rather than an installation issue. Check that
doesn't open [Link]() is called before any other pygame function, and that your
game loop is structured correctly (see Section 3).

Permission error when running pip Try adding --user to the command: pip install pygame --user. This installs
Pygame just for your user account rather than system-wide, which avoids
permission issues on school laptops.

Your First Pygame Window


The following is the minimum viable Pygame window. All Pygame games share this foundational structure.

import pygame

[Link]() # Start Pygame

SCREEN_WIDTH = 800
SCREEN_HEIGHT = 600
screen = [Link].set_mode((SCREEN_WIDTH, SCREEN_HEIGHT))
[Link].set_caption('My RPG Game')

clock = [Link]() # Controls game speed


running = True

while running: # GAME LOOP


# 1. Handle events
for event in [Link]():
if [Link] == [Link]:
running = False

# 2. Update game state (your logic goes here)

# 3. Draw everything
[Link]((0, 0, 0)) # Fill screen black
[Link]() # Show the frame

[Link](60) # Run at 60 frames/second

[Link]()
3. Event Handling
Pygame processes events each frame — key presses, mouse input, window closure and similar. These are
handled inside the game loop.

Keyboard Input
Two methods are available for reading keyboard input:

Option 1 — [Link]() detects a single key press, firing once at the moment the key is pressed:

for event in [Link]():


if [Link] == [Link]:
if [Link] == pygame.K_SPACE:
# do something once when SPACE is pressed
pass

Option 2 — [Link].get_pressed() returns the current state of all keys, checked each frame:

keys = [Link].get_pressed()
if keys[pygame.K_LEFT]:
# do something every frame while LEFT is held
pass
if keys[pygame.K_RIGHT]:
# do something every frame while RIGHT is held
pass

Consider
Continuous movement suits get_pressed(). Single actions such as attacks or menu selections suit
[Link](). Most games require both.
4. Sprites
A sprite is a game object with an image and a screen position. Pygame provides [Link] as a
base class. Inheriting from it is one of the more direct opportunities to demonstrate OOP inheritance within
this task.

The Sprite Class Structure


Every sprite class requires three elements in __init__: an image, a rect and a call to super().__init__().
Further attributes and methods are determined by the object's function in the game.

import pygame

class MySprite([Link]): # Replace with your class name


def __init__(self, x, y):
super().__init__() # Always required
[Link] = [Link]((40, 60))
[Link]((200, 200, 200)) # Placeholder colour — swap for real image
[Link] = [Link].get_rect()
[Link].x = x
[Link].y = y
# Add your own attributes here ...

def update(self): # Called every frame by sprite groups


# Add your own per-frame logic here ...
pass

Consider
Each class will hold different data depending on its function. Define only the attributes that object
genuinely requires, rather than copying a generic structure.

Loading an Image for Your Sprite


To use an image file in place of a coloured surface, use [Link](). The path must reference the
correct file location.

[Link] = [Link]('assets/[Link]').convert_alpha()
[Link] = [Link]([Link], (40, 60)) # Resize if needed
[Link] = [Link].get_rect()

File format
.png files support transparent backgrounds; .convert_alpha() enables this. Store all image assets in a
dedicated assets folder within the project directory.
Sprite Groups
Sprite groups allow draw() and update() to be called once across a collection rather than on each sprite
individually. Multiple groups can be maintained to separate object types where needed.

all_sprites = [Link]()
my_group = [Link]() # A group for a specific type

obj = MySprite(100, 200) # Create a sprite


all_sprites.add(obj) # Add to groups as needed
my_group.add(obj)

# In the game loop:


all_sprites.update() # Calls update() on every sprite in group
all_sprites.draw(screen) # Draws every sprite in group

5. Collision Detection
Pygame includes built-in collision detection, removing the need to calculate overlap geometry manually.

Sprite vs Group Collision


spritecollide() tests one sprite against a group and returns a list of any overlapping sprites. An empty list
indicates no collision.

hits = [Link](sprite_a, group_b, False)


# hits is a list of sprites from group_b that overlapped sprite_a
# Third argument: False = keep the collided sprites, True = remove them

for hit in hits:


# Decide what happens when sprite_a touches something in group_b
pass

Rectangle Collision
For a direct check between two objects:

if sprite_a.[Link](sprite_b.rect):
# The two sprites are overlapping — decide what should happen
pass

Consider
Identify every object pairing that must respond to contact. Each pairing is likely to require a different
response.
6. Game States
Most games include distinct modes — menu, active play, pause, game over. A state variable determines
which logic runs at any given time, keeping the game loop manageable.

The Pattern
States are defined as constants. The game loop branches based on the current state value, which is
updated when a trigger condition is met.

# Define your states — use names that make sense for your game
STATE_ONE = 'state_one'
STATE_TWO = 'state_two'
# ... add as many as your game needs

current_state = STATE_ONE # Starting state

while running:
for event in [Link]():
if [Link] == [Link]:
running = False
# Check for events that should trigger a state change ...

# Run different logic depending on the current state


if current_state == STATE_ONE:
# ... code for state one
pass
elif current_state == STATE_TWO:
# ... code for state two
pass

# Check conditions that might change state


# e.g. if some condition is met: current_state = STATE_TWO

[Link]()
[Link](60)

Consider
Identify the modes required before writing code. Determine the trigger for each state transition and
sketch a brief diagram to confirm the logic.
7. Sound and Music
Pygame treats background music and sound effects separately. Music is streamed from file, suited to longer
tracks; sound effects are loaded into memory, suited to short clips.

Background Music
[Link]() # Initialise the mixer

[Link]('assets/bgm.mp3') # Load the music file


[Link].set_volume(0.5) # 0.0 (silent) to 1.0 (full)
[Link](-1) # -1 = loop forever

Sound Effects
attack_sound = [Link]('assets/[Link]')
attack_sound.set_volume(0.7)

# Play it when the player attacks:


attack_sound.play()

Compatible formats
.wav or .ogg for sound effects; .mp3 or .ogg for music. .mp3 is not recommended for short clips as
latency issues can occur on some systems.

8. Drawing Text and UI


Text is rendered as a surface via a Font object and drawn to the screen with blit(). This is used for scores,
labels, status messages and other on-screen information.

font = [Link](None, 36) # None = default font, 36 = size in points

# Render turns a string into a drawable surface:


text_surface = [Link]('Your text here', True, (255, 255, 255))
# Arguments: the string, anti-aliasing (True = smoother edges), colour as RGB

# Draw the surface onto the screen at a position:


[Link](text_surface, (10, 10)) # (10, 10) = top-left corner position

Consider
Determine which values need to be visible to the player and their screen position. UI elements are
typically rendered after sprites so they appear above the game layer.
9. Connecting OOP to Your Game
This section provides structural examples for each OOP principle. Abstract class names are used
deliberately. Applying these patterns to a specific game design is the student's own work.

Encapsulation
Encapsulation groups an object's data and its related methods within a single class. Access to sensitive
attributes is controlled through defined methods rather than direct external assignment, which limits the
points at which data can be changed incorrectly.
The structure below shows private data exposed only through methods. Any logic governing how the data
changes is contained within the class.

class Thing:
def __init__(self):
self.__value = 100 # Private — not accessed directly from outside
[Link] = 'something' # Public — fine to access directly

def reduce(self, amount): # The only way to change __value


self.__value -= amount
# Any rules about __value live here, not scattered around your code

def get_value(self): # Controlled read access


return self.__value

Consider
Which values in each class should only change under defined conditions? Those are candidates for
private attributes accessed through controlled methods.

Inheritance
Inheritance allows shared behaviour to be defined once in a parent class and specialised in child classes.
Child classes inherit all parent attributes and methods and may add their own. The [Link]
base class from Section 4 is an example of inheritance already in use.
The example below defines a parent class with shared attributes and two child classes that extend it. Each
child initialises the parent before defining its own properties.

class Base([Link]): # Parent class — shared behaviour goes here


def __init__(self, x, y):
super().__init__()
[Link] = [Link](x, y, 40, 60)
# shared attributes ...

def shared_method(self):
pass # Logic that ALL child classes can use

class TypeA(Base): # Child class — inherits everything above


def __init__(self, x, y):
super().__init__(x, y) # Set up the parent first
# unique attributes for TypeA ...

class TypeB(Base): # Another child — same parent, different purpose


def __init__(self, x, y):
super().__init__(x, y)
# unique attributes for TypeB ...
Consider
Identify attributes and behaviours common to multiple object types. These belong in the parent class.
What differentiates each type belongs in the respective child class.

Polymorphism
Polymorphism allows different classes to share a method name while each providing their own
implementation. The calling code does not need to distinguish between types.
In the example below, two classes each implement action() differently. The loop calls the method on both
without type-specific logic.

class TypeA(Base):
def action(self): # TypeA's version of action
# ... TypeA does it this way
pass

class TypeB(Base):
def action(self): # TypeB's version — same name, different behaviour
# ... TypeB does it differently
pass

# Polymorphism in action — the loop doesn't need to know which type each is:
objects = [TypeA(...), TypeB(...), TypeA(...)]
for obj in objects:
[Link]() # Each one runs its own version

Consider
Where the same conceptual action occurs across different object types but behaves differently in each,
a shared method name with distinct implementations is the correct approach.
10. Suggested Project Structure
Separating code by class into distinct files improves readability and project navigation. A recommended
layout is shown below.

my_rpg_game/
├── [Link] # Game loop, state machine, startup
├── [Link] # Player class
├── [Link] # Enemy and BossEnemy classes
├── [Link] # Item and Inventory classes
├── [Link] # Map / level class
├── [Link] # Constants (screen size, colours, speeds)
└── assets/
├── [Link]
├── [Link]
├── bgm.mp3
└── [Link]

Classes defined in separate files are imported at the top of any file that requires them:

# In [Link]:
from player import Player
from enemy import Enemy

11. Common Errors and How to Fix Them

Error What it means & how to fix it


[Link]: No video mode has You called [Link] functions before [Link](). Make sure
been set [Link]() is the very first Pygame call.
FileNotFoundError: The file path is wrong or the file doesn't exist. Check spelling and that the
assets/[Link] file is in the assets folder.
AttributeError: 'NoneType' A sprite variable is None — the object wasn't created successfully. Check
object has no attribute 'rect' your __init__ method.
Screen is black / nothing draws Check that [Link]() and [Link]() are both inside your
game loop, and that sprites are being added to a group and drawn.
Game runs too fast or too slow Make sure [Link](60) is at the bottom of your game loop. Adjust the
number to change target FPS.
super().__init__() causes an If inheriting from [Link], super().__init__() must be called
error before setting [Link] or [Link].
12. Ethical and Transparent Use of AI Tools
Artificial Intelligence (AI) tools such as ChatGPT, GitHub Copilot, Claude, Gemini, and similar systems may
be used to support your learning and development process in this project. However, AI must assist your
thinking - not replace it.

The purpose of this project is to demonstrate your understanding of software engineering, problem-solving,
and development practices. Any code, documentation, or decisions you submit must still reflect your own
understanding and ability to explain your work.

AI Use Expectations

You are responsible for:


• Understanding every line of code included in your project.

• Being able to explain all AI-assisted work in your assessment task.

• Checking AI-generated content for errors, security issues, and inaccuracies.

• Declaring any meaningful AI assistance honestly in your development journal.

Note: Using AI does not remove your responsibility as the developer.

Acceptable Use of AI

AI may be used to support learning, planning, debugging, and improvement. Examples of acceptable use
include:
• Asking AI to explain programming concepts or error messages.

• Brainstorming project ideas or interface layouts.

• Generating starter examples to learn from.

• Receiving feedback on validation, security, or usability.

• Debugging small sections of code.

• Improving readability or structure of your own writing.

• Learning how specific code, functions, libraries, or APIs work.

• Generating practice test data or sample content.

You must still:

• Review the output carefully.

• Modify and adapt it appropriately.

• Ensure it fits your project requirements.

• Be able to explain why it was used.


Unacceptable Use of AI

The following uses are considered academic misconduct or poor professional practice:

• Submitting AI-generated code you cannot explain.

• Copying large sections of code directly into your project without understanding them.

• Generating your entire journal or reflections using AI.

• Using AI to complete large section/s of the project with minimal personal contribution

• Asking AI to bypass security requirements or generate unsafe code intentionally.

• Presenting AI-generated ideas, writing, or code as entirely your own work.

• Hiding or refusing to acknowledge significant AI assistance.

Declaring AI Use in Your Journal

If you use AI tools in a meaningful way, you must declare this honestly in your submission. This does not
necessarily reduce your marks. Transparent and responsible use is encouraged.

Your declaration should include:

• The AI tool used.

• What it helped you with.

• How you changed, checked, or applied the output.

• What you learned from the interaction.

Example AI Declaration

“ChatGPT was used during Week 3 to help explain sessionStorage and improve login validation. The
generated example was modified to suit my application and tested manually. I reviewed the code
carefully and can explain how it works.”

Another Example

“GitHub Copilot suggested a regex pattern for email validation. I tested and adjusted the pattern to
better match my application's requirements.”
AI & The Developer Review

During the Developer Review, your teacher may:

• Ask you to explain specific sections of code.

• Ask why certain security decisions were made.

• Ask what changes you personally implemented.

• Ask how AI assisted your development process.

If you cannot explain how your code works, it may affect your marks for:

• Code Quality

• Documentation

• Overall authenticity of the submission

Final Notes

Use AI like a junior assistant - not as the developer.


Good developers:

• Verify information,

• Test code carefully,

• Think critically and

• Take responsibility for what they build.

13. Useful Resources


• Official Pygame documentation: [Link]/docs
• Free game assets (sprites, tiles, music): [Link]/game-assets/free
• Free sound effects: [Link]
• Free background music (royalty-free): [Link]
• Python class / OOP revision: [Link]/3/tutorial/[Link]

Academic integrity
Any asset or code snippet sourced externally must be acknowledged with a comment in the code. This
includes images, audio files and code from online sources. Referencing is a component of the
assessment criteria.

You might also like