Assignment 1: Breakout
- 💯 Worth: 6%
- 📅 Due: See due date on Moodle.
- 🚫 Penalty: Late submissions lose 10% per day to a maximum of 3 days. Nothing is accepted after 3 days and a grade of 0% will be given.
🎯 Objectives
Section titled “🎯 Objectives”- Read and understand all of the Breakout notes and source code.
- Add a multi-ball power-up to the game that spawns two extra balls.
- Grow and shrink the paddle when the player gains enough points or loses a life.
- Add a locked brick that will only open when the player collects a key power-up.
- The key should only spawn when a locked brick exists.
🔨 Setup
Section titled “🔨 Setup”- Fork (do not download as a zip) the starter repository from GitHub. Make sure you use the link from Moodle to fork the proper repository for this assignment.
- Start Live Server in VSC by right-clicking on
index.html
and selecting Open with Live Server. This will open a new tab in your browser with the game running.
🔍 Context
Section titled “🔍 Context”To complete this assignment, you should read and understand all of the Breakout notes and source code and be familiar with the following concepts and theories:
- States: Understanding how to transition between different states in the game.
- Sprites: How to load and render sprites on the screen.
- Collision Detection: Detecting when two objects collide with each other.
Welcome to your second assignment! By now, we’ve gotten our feet wet with states, randomization, and much more; this time, we’ll be diving in further and adding some new features. Your task is to implement two of the three following features:
- Grow and shrink the paddle when the player gains enough points or loses a life, respectively.
- Add a multi-ball power-up to the game that spawns two extra balls.
- Add a locked brick that will only open when the player collects a key power-up. The key should only spawn when a locked brick exists.
✅ Requirements
Section titled “✅ Requirements”💗 Paddle Size (45%)
Section titled “💗 Paddle Size (45%)”Grow and shrink the paddle such that it’s no longer just one fixed size for the entire game.
-
The paddle should shrink (no smaller than the smallest paddle sprite) if the player loses a life.
-
The paddle should grow (no larger than the largest paddle sprite) if the player exceeds a certain amount of score.
- The paddle should grow from size 0 to size 1 after the player accumulates 50 points.
- The paddle should grow from size 1 to size 2 after the player accumulates 100 points.
- The paddle should grow from size 2 to size 3 after the player accumulates 200 points.
-
Here’s how it should work:
// Paddle Size 0 -> 1: +50 points// Paddle Size 1 -> 2: +100 points// Paddle Size 2 -> 3: +200 pointsPaddle = 1;Life = 3;Score = 0; // Game startPaddle = 2;Life = 3;Score = 100; // Score +100, paddle size 1 -> 2Paddle = 1;Life = 2;Score = 100; // Life -1, paddle size 2 -> 1Paddle = 0;Life = 1;Score = 100; // Life -1, paddle size 1 -> 0Paddle = 1;Life = 1;Score = 150; // Score +50, paddle size 0 -> 1Paddle = 2;Life = 1;Score = 250; // Score +100, paddle size 1 -> 2Paddle = 3;Life = 1;Score = 450; // Score +200, paddle size 2 -> 3
Deduction | Criteria | Details |
---|---|---|
(-0) | Correct | |
(-3) | Paddle does not grow when a certain score delta is hit. | For example, if score is 500 and the paddle size is the smallest, you should only need 50 points to grow. The counting shouldn’t only work starting from zero. |
(-3) | Paddle does not shrink when a life is lost. | |
(-X) | Other reason detailed in comments. | |
(-6) | N/A |
🤹🏽♀️ Multi-Ball (45%)
Section titled “🤹🏽♀️ Multi-Ball (45%)”Add a multi-ball PowerUp
class to the game that spawns a power-up (sprites located at the bottom of the sprite sheet).
- This power-up should spawn randomly at the location of the brick when the ball hits a brick, and should gradually descend down the screen so that the player can “pick it up” with the paddle.
- If the power-up collides with the paddle, the power-up should despawn and two more balls should spawn (at whatever location you choose) and behave identically to the original, including all collision detection and scoring points. There must only be a maximum of 3 balls in play at any time.
- If there is 1 ball in play, 2 new balls should spawn.
- If there are 2 balls in play, 1 new ball should spawn.
- If there are already 3 balls in play, no new balls should spawn.
- You should only lose a life and transition to the
ServeState
when the last of the balls falls below the screen.- Once the last ball falls, reset the number of balls back to 1 and number of power-ups back to 0.
- Once the player wins and proceeds to the
VictoryState
for their current level, reset the number of balls back to 1 for the new level.
Deduction | Criteria | Details |
---|---|---|
(-0) | Correct | |
(-2) | Power-up does not spawn randomly when a brick is hit. | It should not spawn every time a brick is hit. |
(-2) | Power-up does not despawn when hit by the paddle. | |
(-1) | Power-up falls through the paddle sometimes. | |
(-2) | Power-up does not spawn 2 additional balls when consumed. | The location of spawning does not matter. |
(-2) | More than three balls can be spawned at any given moment. | Get 2 multi-ball power-ups and verify that there are only 3 balls total. |
(-1) | Additional balls cannot be hit by the paddle. | |
(-1) | Power-up does not work consistently. | If a bug happens but you can’t reliably recreate it, don’t worry about it. |
(-1) | Life is lost and state transition is made before the last ball falls. | |
(-1) | Balls and/or power-ups are not reset when transitioning states. | |
(-X) | Other reason detailed in comments. | |
(-6) | N/A |
🔐 Locked Brick (45%)
Section titled “🔐 Locked Brick (45%)”Add a locked brick (located in the sprite sheet) to the level spawning, as well as a key power-up (also in the sprite sheet).
- The locked brick should not be breakable by the ball normally, unless the player obtained the key power-up.
- The key power-up should spawn randomly (just like the multi-ball power-up) when hitting a brick and descend toward the bottom of the screen where the paddle can collide with it and pick it up.
- No keys should spawn if there are no locked bricks in play.
- You’ll need to take a look at the
LevelMaker
class to see how you can implement the locked brick into the level generation.- To make it easier to test, ensure that every level has at least 1 locked brick.
- There is a chance for the player to get “soft locked” meaning that it’s possible to have a scenario where the player breaks all the regular bricks and now there are only locked bricks left. Since keys can only spawn from regular bricks, the player is now stuck. For this assignment, this is okay, you do not have to account for this edge case. However, if you like an extra challenge, try implementing your own solution for this soft lock!
Deduction | Criteria | Details |
---|---|---|
(-0) | Correct | |
(-2) | Locked bricks are breakable without a key. | |
(-2) | Power-up does not spawn randomly when a brick is hit. | It should not spawn every time a brick is hit. |
(-2) | Power-up does not despawn when hit by the paddle. | |
(-1) | Power-up falls through the paddle sometimes. | |
(-2) | Locked blocks do notbecome breakable after obtaining a key. | |
(-1) | Power-up does not work consistently. | If a bug happens but you can’t reliably recreate it, don’t worry about it. |
(-X) | Other reason detailed in comments. | |
(-6) | N/A |
📝 Dev Log (5%)
Section titled “📝 Dev Log (5%)”You’ll find a .devlog.md
file in the project root. This file is your design diary. It’s where you document how you approached the assignment, what decisions you made, what challenges you encountered, and how you worked through them, including how you used any AI tools.
This is not a summary of your final product (that’s what your code and commit messages show). Instead, it’s a reflection of your process and thinking.
What to write:
- What approach you chose and why
- Any bugs or roadblocks you encountered and how you solved them
- How you tested and verified your implementation
- If you used AI tools (e.g. ChatGPT, Claude, Copilot), describe:
- What you asked
- What it returned
- What you kept or changed
- Include links to relevant chat logs when possible
What makes a good devlog:
- Specific technical insights (e.g. “I struggled with connecting the AI paddle’s movement to the ball’s position. I solved this by…”)
- Honest reflection on what you understood and what confused you
- Commentary on any AI output you received, what was useful, what wasn’t
What makes a weak devlog:
- Restating the assignment prompt
- Only describing what the final code does, without process
- Hiding or omitting AI tool usage
- Generic statements with no technical substance
Be concise. Bullet points are fine.
Criteria | Standard |
---|---|
Process Reflection | Clear explanation of approach, design decisions, and problem-solving steps |
Technical Detail | Specifics about code structure, logic, or bugs encountered and fixed |
AI Usage Disclosure | Clearly explains how AI was used, what was kept/changed, with reasoning |
Insight & Critical Thinking | Thoughtful reflection on what was learned, understood, or found challenging |
Clarity & Format | Concise, readable, well-structured with bullet points or short paragraphs |
🤖 AI Involvement Category
Section titled “🤖 AI Involvement Category”At the top of your .devlog.md
, you must declare your AI involvement category by selecting the option that best describes how you used AI during the assignment:
Category | Description |
---|---|
No Use | You did not use any AI tools at any point. |
Tutor | You used AI to explain code, concepts, or errors. No code was generated by AI. |
Assistant | You asked AI for code suggestions or snippets and integrated them with understanding. |
Reviewer | You wrote the code yourself, then used AI to review, critique, or suggest improvements. |
💬 Peer Assessment (5%)
Section titled “💬 Peer Assessment (5%)”You’ll use the Moodle Workshop feature to give feedback on 3 of your peers’ submissions. Peer assessment is a core developer skill. Reading others’ code and giving constructive feedback is something you’ll do constantly in real software teams. It also helps you improve your own work by seeing how others solved the same problem.
💻 Code Walkthrough
Section titled “💻 Code Walkthrough”For each assignment, I will randomly select a few students for a short (10-15 minute) one-on-one code walkthrough. You’ll be asked to explain your implementation, reflect on your design decisions, and answer a few questions. This helps ensure understanding, promotes academic integrity, and prepares you to communicate your work which is an essential skill for every developer. You can be selected for any assignment, so always be ready to walk me through your code.
We will be using GitHub and Gradescope to submit in this course. You can use either the Git CLI or you can also use VSC’s built-in Git GUI client.
Visual Studio Code (GUI) | Command Line (CLI) | |
---|---|---|
1 | Click the Source Control icon (third down on the left sidebar) | git status - View changed files |
2 | Click + to stage all changes, or + next to individual files | git add . or git add <filename> - Stage changes |
3 | Type a commit message in the text box, then click the ✔ to commit | git commit -m "Your message" - Commit staged changes |
4 | Click ... and choose Push to upload your commit to GitHub | git push - Push commits to GitHub |
Commit frequently. It’s good practice, and it also creates a traceable history of your progress.
📥 Submission
Section titled “📥 Submission”💡 Note that the grading criteria can be found on Gradescope, but only after you’ve submitted. You’re able to submit infinitely, so it’s be a good idea to submit a blank repo first in order to reference the grading criteria while working on this assignment.
Once you’ve made your final git push
to GitHub, here’s what you have to do to submit:
- Go to Gradescope, click the link for this assignment, select the correct repository and branch from the dropdown menus, and click
Upload
. - Go to Moodle and click the link for this assignment in the calendar.
- Click the blue
Add Submission
button at the top of the workshop page.- Title: A1 Breakout Submission.
- Submission content: Describe which features you implemented in the description of the workshop submission along with anything your reviewers should know about your game/code.
- Zip your assignment folder and attach it as a file. To ensure anonymity:
- DO NOT include your name in any of the files or folders
- DO NOT include the
.git
folder before zipping
- Click the
Save changes
button at the bottom. - Assess your peers starting the day after the three day late submission deadline.