Week 7 – Midterm Documentation:
My Concept:
For my midterm project, I wanted to create something that was connected to my own experience at NYU Abu Dhabi, rather than making a game that could be set anywhere. One thing I noticed since starting university is how many people use scooters to get around campuses like NYUAD, AUS, UAEU and many other campuses around the world. I usually hear a lot about scooter incidents, and how sometimes people end up almost crashing into each other, bushes, or other things along the way. I thought it would be funny to turn this into a game, especially because it is something that other students would probably recognize, and maybe learn to be more aware of.
My initial idea was pretty simple. The player would control a scooter and try to avoid obstacles while moving through campus. However, as I started developing it, I wanted to make the game a bit more interesting than just surviving for as long as possible. I remembered that when I first discussed my idea with Professor Mang, he suggested that crashing into a professor could actually give the player extra points. I really liked this idea because it made the game more unexpected, and it also meant that the player would have to decide which characters to avoid and which ones to aim for. Eventually, I also decided to add Professor himself as a rare character who gives the player an even bigger bonus.
My Game
How My Game Works
The game has four main screens: the start screen, instructions screen, gameplay screen, and game over screen. I used a variable called gameState to keep track of which screen the player is currently on. The draw() function checks the value of this variable and displays the corresponding screen. I also added both keyboard and mouse controls so that the player can move through the different screens, start the game, and restart after crashing without having to reload the entire sketch.
During the game, the player controls a purple scooter using the left and right arrow keys. The goal is to survive for as long as possible while avoiding students, backpacks, and traffic cones. The score gradually increases the longer the player survives. However, unlike the other obstacles, professors give bonus points when the player collides with them. A regular professor gives 100 points, while Professor Mang gives 500 points. I also added a high-score system so that players can try to beat their previous score.
One of the main things I wanted to achieve was making the game feel like the player was actually moving through campus, even though the scooter itself stays towards the bottom of the screen. To do this, I used a campus background image and displayed it twice, with one copy placed above the other. Both images move down continuously, and once they reach a certain point, their position resets. This creates the illusion of an endless moving background.
// moving campus background
function drawMovingBackground() {
backgroundY += backgroundSpeed;
if (backgroundY >= height) {
backgroundY -= height;
}
image(campusImg, 0, backgroundY, width, height);
image(campusImg, 0, backgroundY - height, width, height);
}
Another important part of the game was using object-oriented programming. I created an Obstacle class to manage the different characters and objects that appear throughout the game. Each obstacle has its own type, position, and speed, along with functions that control how it moves, appears, and resets. I stored these obstacles in an array so that I could use a loop to update and display them instead of having to write separate movement code for every character.
I also used the dist() function for collision detection. It calculates the distance between the scooter and an obstacle, and if that distance becomes small enough, the game checks what type of obstacle the player collided with. Depending on the obstacle, the player either receives bonus points or the game ends
// collision detection
checkCollision() {
let x = this.getX();
let obstacleDistance = dist(
scooterX,
height - 120,
x,
this.y
);
return obstacleDistance < 42;
}
}
What I’m Proud Of:
One of the parts I’m happiest with is how the game becomes more challenging as the playerm progresses. At first, the game starts with fewer obstacles and a slower background. However, once the player reaches certain scores, the difficulty level increases. This changes the speed of the background and obstacles, while also increasing the number of obstacles appearing on the screen. I wanted the game to become more difficult gradually, rather than having the same level of difficulty throughout, because otherwise I felt that it would become repetitive.
// difficulty increases with score
function updateDifficulty() {
if (score >= 5000) {
difficulty = 4;
} else if (score >= 2500) {
difficulty = 3;
} else if (score >= 1000) {
difficulty = 2;
} else {
difficulty = 1;
}
I’m also proud of the different characters I created using p5.js shapes rather than relying on images for everything. I used rectangles, ellipses, lines, and other shapes to draw the students, professors, and Professor Mang. I also experimented with using sin() and frameCount to animate the characters’ legs and arms so that they look like they are walking or running. I think these small details helped make the game feel more alive.
Another part of the game that I’m really proud of is the professors. Instead of making every character an obstacle that the player has to avoid, I decided to make professors give bonus points when the player crashes into them. Regular professors give 100 points, while Professor Mang is a rarer character who gives 500 points. I also added a purple aura around the professors to make them stand out from the other characters. I liked how this made the game a bit more interesting because players have to pay attention to who they’re approaching rather than just avoiding everyone. I also added different sound effects for crashing into students, hitting other obstacles, collecting bonuses, and clicking through the screens, as well as background music. I think these small details helped make the game feel more complete and fun to play.
Problems I Ran Into and Areas for Improvement
I ran into quite a few problems while making this project, especially because this was my first time creating a game with this many different elements. One of the biggest challenges was making sure that everything worked together properly. For example, I had to figure out how to make the obstacles move, reset their positions, and detect collisions without interfering with the rest of the game. I also spent time adjusting the spawn rate and difficulty because I wanted the game to be challenging but still playable. Another issue was getting the background music to work consistently. At one point, the sound effects were working but the music wasn’t playing, so I had to go back and review how I was loading and playing the audio files.
I also had some problems with the visual design, particularly when trying to make the score and level easy to read during gameplay. I experimented with different fonts and layouts, but some of them ended up being difficult to read or distracting from the game itself. Eventually, I decided to keep the score and level together in a simple box in the corner. If I were to continue developing this project, I would like to improve the way obstacles spawn so that they don’t appear too close together, and maybe add more recognizable NYUAD locations or characters. I also think it would be interesting to introduce different power-ups or special events as the player reaches higher levels.
Overall, I’m happy with how the game turned out, especially because I originally started with a much simpler idea. This project helped me understand how the different concepts we learned in class, such as arrays, classes, conditionals, and functions, can work together to create something interactive. It also made me realize how much time goes into testing and making small adjustments, even when the final game might seem relatively simple to play.
References and Use of AI
I used the lecture notes and p5.js examples from class to revisit concepts such as arrays, object-oriented programming, functions, and collision detection.
I also used ChatGPT throughout the development process to help me troubleshoot errors, understand unfamiliar parts of the code, and explore ways to implement features such as increasing difficulty, sound effects, and different game states. I used it to help develop and revise the code for the game, as well as simplify certain sections so I could better understand how they worked. I also used AI assistance when developing the visual assets for the different game screens.
Other resources:

