Week 5 midterm progress

Concept
My midterm project is a simple car race game called “Mirror Lane Racer.” The player drives a car on a three-lane road and tries to survive by avoiding traffic cars. The main “new element” is Mirror Mode: sometimes a mirror shard pickup appears, and if the player collects it, the controls flip for a few seconds (left becomes right, right becomes left). This is meant to create a quick moment of confusion and force the player to adapt.
My reference of this work is the idea of subway surfers.subway suffers 的图像结果

The experience starts on an instruction screen and waits for the player to press SPACE (or click) before the game begins. If the player crashes, the game switches to an end screen showing the score and a clear restart option (press R) so a new run can start without refreshing the page.

Code plan
I’m planning to structure the sketch with three game states: Start, Play, and End. In the Play state, the game will repeatedly (1) spawn traffic cars and mirror shards, (2) update their positions as they move down the screen, (3) draw everything, and (4) check for collisions.

To meet the OOP requirement, I’ll use classes like: 1) PlayerCar: stores lane position and has methods to move left/right and display itself. 2) ObstacleCar: spawns in a lane, moves downward, and gets removed when off-screen. 3) PickupShard: spawns sometimes; if collected, it triggers Mirror Mode with a timer.

Traffic cars and pickups will be stored in arrays so multiple objects can exist at once. I’ll also include a `resetGame()` function that clears arrays, resets score/timers, turns off Mirror Mode, and puts the player back in the center lane for restarts.

Sound plan
The game will include at least one sound, and I’ll likely use a few short sounds: 1)An engine loop 2)A crash sound when the player hits traffic  3)A pickup sound when collecting a mirror shard

Because browsers usually require a user gesture before playing audio, I will start audio only after the player presses SPACE/clicks to begin. After that, I can trigger sounds during gameplay events (pickup/crash). I already tested that a keypress can reliably start audio, so I won’t risk the sound requirement failing at the end.

Leave a Reply