Assignment 3: Mario
- 💯 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 Mario notes and source code.
- Extend an existing codebase by reading its conventions and building new features that fit into them.
- Use state machines to model entity behaviour (e.g. growing, shrinking, throwing, dying) and transition between game states (e.g. play to game over).
- Write custom physics for game objects: gravity, bouncing, and movement that responds to tile collisions.
- Detect and resolve collisions between entities, and between entities and tiles, including one-way platforms.
- Drive animations, effects, and time-based behaviour with sprite animations, tweens, and timers.
- Give the player feedback through sound effects, music, and visual effects like flickering, particles, and screen fades.
🔨 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.
- Follow the environment setup instructions if you haven’t already done so from a previous assignment.
- Start Live Server in VSC by right-clicking on
index.htmland selecting Open with Live Server. This will open a new tab in your browser with the game running.
Edit the Tilemap (Optional)
Section titled “Edit the Tilemap (Optional)”The map is already laid out in a way that you can test any feature you choose to implement, so you don’t have to edit. However, if you’re interested and want to make your own, here’s what to do:
- Download the Tiled map editor from here.
- Open
assets/maps/tilemap.tmxin Tiled to see the map data. You can add tiles by clicking the sprite in the lower right corner and then clicking on the map to place them. You can remove tiles by using the eraser tool. Save once you’re done. - Open
assets/maps/tilemap.tmxin VS Code, copy the array of numbers, and replace the array of number insrc/config/map.js. That’s it! You can call yourself a cartographer now.
🔍 Context
Section titled “🔍 Context”To complete this assignment, you should read and understand all of the Mario tutorial lessons, and be familiar with the following concepts and references:
- Sprite Animation: Understanding how to animate sprites.
- Tile Collision: Understanding how to detect and respond to collisions with tiles.
- 2D Physics: Understanding how to move and interact with objects in a 2D space.
Welcome to your fourth assignment! There was a lot to learn with cameras, tilemaps, entities, and game objects, but our game is still lacking in a few areas. By extending its functionality, we’ll have something even closer to famous titles like Super Mario Bros.!
Map Markers
Section titled “Map Markers”The map already contains a marker tile everywhere a feature’s object should spawn. These are the IDs you’ll see in Tile.js and in Map.js (zero-based indexes into tiles.png, i.e. the number in map.js minus 1):
| Tile ID | Marker |
|---|---|
| 3, 4 | ⬆️ Platform |
| 5 | 🪙 Free-floating coin |
| 14 | ⭐ Star block |
| 19 | ⬜ Blank (solid, invisible), under blocks |
| 21 | 🪙 Regular ? block (coin block) |
| 23 | 😈 Goomba (already handled) |
| 24 | 🍄 Mushroom block |
| 25 | 🌸 Fire flower block |
Until you handle a marker in Map.js, it’s drawn as a plain solid tile, so you’ll bump into coins and items like walls. Follow how initializeSpecialTiles() already replaces blocks and Goombas with their game objects.
✅ Pick 2/3 Minor Features (40%)
Section titled “✅ Pick 2/3 Minor Features (40%)”Each feature’s table lists everything it’s graded on. Each row is worth 2 points: 2 if it works fully, 1 if it partially works, and 0 if it doesn’t work or wasn’t attempted. Only the first two minor and first two major features listed in your README are graded, so if you implement all three of either kind, list the two you want graded first. Additional deductions may be given for other issues, which will be detailed in comments.
🪙 Coin Collection
Section titled “🪙 Coin Collection”Coins float around the level waiting to be collected, and pop out of blocks when the player hits them from below. If you choose this feature, the regular ? block that’s already in the starter (tile 21, Block.js) becomes the coin block and hitting it should now release a coin instead of only bumping.
| Requirement | How it’s tested |
|---|---|
| Free-floating coins play a spinning animation. | Watch any coin on the map. |
| The player collects free-floating coins by touching them. | Collect several coins in a row and update a counter displayed at the top of the screen. |
Collecting a free-floating coin plays coin.wav. |
Listen while collecting. |
| Hitting a coin block pops out a coin that visibly rises and falls before disappearing. | Hit a coin block from below. |
Hitting a coin block plays coin.wav. |
Listen while hitting the block. |
| Collected coins are removed from the map and can’t be collected again. | Walk back over where the collected coins were. |
⬆️ Platforms
Section titled “⬆️ Platforms”One-way platforms let the player jump up through them from below or the side and land on them from above. Platform tiles are the ones with sprite indices 3 and 4 in the sprite sheet.
| Requirement | How it’s tested |
|---|---|
| The player can jump up through a platform from below. | Jump into a platform from directly underneath. |
| The player can pass through a platform from the side. | Walk or jump into the side of a platform. |
| The player lands on a platform when falling onto it from above. | Jump over a platform and fall onto it. |
| The player can walk and run along a platform without falling through or stuttering. | Walk and run back and forth on a platform. |
| The player can jump while standing on a platform. | Jump from on top of a platform. |
| Ground tiles and blocks are still solid from every direction. | Bump the ground, walls, and blocks from below, the side, and above. |
😵 Game Over
Section titled “😵 Game Over”When the player dies, they play a death animation and the game ends with a Game Over screen. Goombas get their own death animation when stomped.
| Requirement | How it’s tested |
|---|---|
| The player plays a death animation when hit by a Goomba. | Walk into a Goomba. |
| The player plays a death animation when falling off the bottom of the map. | Fall into a pit. |
| A stomped Goomba plays a death animation, and the player bounces a small amount off of it. | Jump on a Goomba. |
player-down.mp3 plays when the player dies, and stomp.wav plays when a Goomba is stomped. |
Listen during both of the above. |
Once player-down.mp3 finishes, the screen fades to black and transitions to a Game Over state. |
Die and wait for the music to end. |
The Game Over state fades in from black, plays game-over.mp3, and returns to the title screen once the music ends. |
Wait on the Game Over screen. |
✅ Pick 2/3 Major Features (50%)
Section titled “✅ Pick 2/3 Major Features (50%)”🍄 Mushroom
Section titled “🍄 Mushroom”Hitting a mushroom block sprouts a mushroom that slides along the ground. Collecting it makes the player big, and getting hit while big shrinks them back down instead of killing them.
| Requirement | How it’s tested |
|---|---|
Hitting a mushroom block makes a mushroom appear on top of it and plays sprout-item.wav. |
Hit the mushroom block from below. |
| The mushroom slides off the block, falls, and lands on the ground. | Watch the mushroom after it appears. |
| The mushroom moves in a straight line along the ground and turns around when it hits a wall. | Follow the mushroom until it reaches a wall. |
| Collecting the mushroom plays the grow animation and the player becomes big. | Collect the mushroom while small. |
Collecting the mushroom plays powerup.wav. |
Listen while collecting. |
| While big, the player uses the big sprites for every action. | Walk, run, jump, and duck while big. |
| Getting hit by an enemy while big plays the shrinking animation and the player becomes small. | Walk into a Goomba while big. |
Shrinking plays pipe.wav. |
Listen while shrinking. |
| After shrinking, the player flickers and can’t be hurt for a short time. | Stay in contact with a Goomba right after shrinking. |
| Getting hit while small still kills the player. | Walk into a Goomba after the flicker ends. |
| An uncollected mushroom flickers for a while and then disappears. | Wait without collecting the mushroom. |
| A mushroom that has disappeared can’t be collected. | Stand where the mushroom disappeared. |
⭐ Star
Section titled “⭐ Star”Hitting a star block releases a star that bounces around the level. Collecting it makes the player invincible for a while, killing any enemy they touch.
| Requirement | How it’s tested |
|---|---|
Hitting a star block makes a star bounce out of it and plays sprout-item.wav. |
Hit the star block from below. |
| The star keeps bouncing along the ground. | Follow the star. |
| The star bounces off walls and ceilings instead of passing through them. | Follow the star into a wall and under a low ceiling. |
Collecting the star makes the player invincible and plays invincible.mp3. |
Collect the star. |
| While invincible, sparkles appear randomly around the player and trail behind them. | Move around while invincible. |
| While invincible, touching an enemy from any direction kills it. | Walk into Goombas from the side and from below. |
Killing an enemy while invincible plays stomp.wav. |
Listen while killing a Goomba. |
When invincibility ends, starman-low.wav plays. |
Wait for invincibility to run out. |
| Sparkles stop appearing when invincibility ends. | Watch the player after invincibility runs out. |
| After invincibility ends, enemies hurt the player normally again. | Walk into a Goomba after invincibility runs out. |
| An uncollected star flickers for a while and then disappears. | Wait without collecting the star. |
| A star that has disappeared can’t be collected. | Stand where the star disappeared. |
🌸 Fire Flower
Section titled “🌸 Fire Flower”Hitting a fire flower block grows a fire flower out of it. Collecting it turns the player into fire Mario, who can throw bouncing fireballs that kill enemies.
| Requirement | How it’s tested |
|---|---|
Hitting a fire flower block makes a flashing fire flower rise out of it and plays sprout-item.wav. |
Hit the fire flower block from below. |
| Collecting the fire flower while small plays the grow animation using the fire sprites, turning the player into fire Mario. | Collect the fire flower while small. |
Collecting the fire flower plays powerup.wav. |
Listen while collecting. |
| As fire Mario, the player uses the fire sprites for every action. | Walk, run, jump, and duck as fire Mario. |
Pressing Shift as fire Mario throws a fireball in the direction the player is facing, but holding Shift to run doesn’t keep throwing. |
Press Shift facing both ways, then hold it while running. |
Throwing briefly shows a throw pose, with a different pose on the ground and in the air, and plays fireball.wav. |
Throw while standing and jumping. |
| Fireballs bounce along the ground. | Throw a fireball across flat ground. |
| Fireballs burst into smoke when they hit a wall or a Goomba. | Throw fireballs at a wall and at a Goomba. |
| A fireball that hits a Goomba kills it. | Throw a fireball at a Goomba. |
| No more than 2 fireballs can be on screen at once. | Spam Shift. |
| Fireballs that leave the screen are removed, freeing up a throw. | Throw 2 fireballs off screen, then throw again. |
| Getting hit by an enemy as fire Mario shrinks the player to small Mario, who can no longer throw. | Walk into a Goomba as fire Mario, then press Shift. |
📝 Assignment Policies (10%)
Section titled “📝 Assignment Policies (10%)”Read the assignment policies and make sure you include a proper .devlog.md file (5%). There will be a peer evaluation component (5%) to this assignment as well as a chance to be randomly selected to do a code walkthrough at my discretion.
📥 Submission
Section titled “📥 Submission”- Inside README.md, list the 2 minor and 2 major features you want graded, in that order, then any known bugs to look out for, anything you want your peer evaluators to know, then do your final
git pushto GitHub. - Go to Gradescope, click the link for this assignment, select the correct repository and branch from the dropdown menus, and click
Upload. - Assess your peers starting the day after the three day late submission deadline.