Skip to content

Assignment 2: Match 3

  • 💯 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.
  • Read and understand all of the Match 3 notes and source code.
  • Extend an existing codebase by reading its conventions and building new features that fit into them.
  • Use timers to track time and schedule time-based behaviour.
  • Use tweens to smoothly animate objects and visual effects within a given timeframe.
  • Handle player input from both the keyboard and the mouse.
  • Give the player feedback through sound effects and animated visual cues.
  1. 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.
  2. Follow the environment setup instructions if you haven’t already done so from a previous assignment.
  3. 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.

To complete this assignment, you should read and understand all of the Match-3 tutorial lessons, and be familiar with the following concepts and references:

  • Tweening: Understanding how to smoothly animate objects on the screen within a given timeframe.
  • Timer: Understanding how to create a timer that can be used to track time.
  • Input: Understanding how to handle user input via the keyboard or mouse.
  • Game: Understanding the shared services object and the frame update/render pipeline.
  • State Machine: Understanding how the game selects, updates, and renders one active state.
  • State: Understanding state lifecycle methods and how states receive shared services and transition data.

Welcome to your third assignment! There was a lot to learn with timers & tweens, but our game is still lacking in a few areas. By extending its functionality, we’ll have something even closer to famous titles such as Bejeweled and Candy Crush!

Each feature’s table lists everything it’s graded on. Each row is worth 2 points: 2 if it’s complete, 1 if it’s partially complete, and 0 if it’s incomplete or wasn’t attempted. Only the first two minor features listed in your README are graded, so if you implement more than two, list the two you want graded first. Additional deductions may be given for other issues, which will be detailed in comments.

Implement time addition on matches, such that scoring a match extends the timer. You decide how much time is appropriate to reward the player with on each match.

Requirement How it’s tested
A swap that results in a match adds time. Make a match and watch the timer.
A swap that doesn’t result in a match adds no time. Make an invalid swap and verify that no additional time is given.
The time added is consistent. Make several matches and check that the time added is consistent each time.

Ensure level 1 starts just with simple flat tiles (the first of each colour in the sprite sheet), with later levels generating the tiles with patterns, one new pattern per level. These should be worth more points, at your discretion.

  • Level 1: Flat, Star (See star tile in next section)
  • Level 2: Flat, Cross, Star
  • Level 3: Flat, Cross, Circle, Star
  • So on and so forth.
  • To detect a match, you’ll still only have to check the colour of the tile; the patterned tiles only change the amount of points gained.
  • For example, a flat tile (🟩) could be worth 10 points and a cross tile (❎) could be worth 20. A match that was 🟩❎🟩 (all the same colour of course) would be worth 40 points.
  • Patterned tiles should spawn just like flat tiles as the game is played. Meaning, don’t only generate patterned tiles at the start of the level.
Requirement How it’s tested
Level 1 only has flat tiles (and the occasional star tile). Start a new game and look at the board.
Each later level adds one new pattern. Beat a few levels and look at the tiles on each new board.
Patterned tiles are worth more points the more complex they are. Compare scores after matches, or check the code, since it’s easier than playing multiple levels: flat < cross < circle, etc.

Only allow swapping when it results in a match. The way you let the player know it’s an invalid move is up to you, but you should have both a visual and audio cue.

Requirement How it’s tested
A swap that doesn’t result in a match isn’t allowed. Try several swaps that don’t create a match and ensure none are accepted.
An invalid swap plays a sound. Listen while attempting an invalid swap.
An invalid swap shows a visual cue. Watch for a visual cue (e.g., shaking tiles) while attempting an invalid swap.

Allow the player to play with their mouse instead of the keyboard.

  • When the player moves their mouse over the board, the tile underneath the mouse should be outlined, the same as when the players presses w/a/s/d.
  • When the player clicks on a tile, the tile should be selected, the same as when the player presses the Enter key.
  • When the player clicks on a tile adjacent to the selected tile, the two tiles should swap, the same as when the player presses the Enter key on a second tile.
Requirement How it’s tested
The board cursor follows the mouse. Move the mouse over the board and ensure the cursor aligns with the correct tile.
Clicking selects the tile underneath the mouse. Click on a tile and confirm that the correct tile is selected.
Clicking an adjacent tile after selecting one swaps them. Select a tile, then click a neighbouring tile to swap them.

The star tile (the last of each colour in the sprite sheet) should be a rare tile that will destroy an entire row or column on a match (depending on the match direction), granting points for each tile in the row or column.

  • For example, if you have a match in a column of 3 orange tiles, one of the tiles in the match being an orange star tile, then that entire column should be removed and points should be awarded for every tile in that column, regardless of if they’re orange or not.
  • There should be an audio and visual cue when the row/column gets destroyed. The audio can be the provided laser.wav sound effect or your own custom sound you choose to add. I chose to visually represent the star blast as a white rectangle whose opacity value gets tweened from 0 -> 1 -> 0 very quickly to resemble a laser flash. You can copy this, or get creative and think of your own animation. Whatever you decide to do, it must involve a tween of some sort.
  • Star tiles should spawn just like other tiles as the game is played. Meaning, don’t only generate star tiles at the start of the level.
Requirement How it’s tested
A horizontal match containing a star tile removes the whole row. Make a horizontal match with a star tile.
A vertical match containing a star tile removes the whole column. Make a vertical match with a star tile.
A star blast plays a sound. Listen while triggering a star blast.
A star blast shows a tweened visual effect. Watch while triggering a star blast.
Star tiles are rare and keep spawning as the board refills. Play for a while and watch for new star tiles falling in.

Show the player a hint when they press the h key. A hint is showing the player 2 tiles they can swap which will result in a match. The way you display the hint is up to you, however, it must be animated using timers and/or tweens. Like with the star blast, you can either copy what I’ve done below (i.e. pulsing white rectangle outline) or come up with your own creative indicator.

The player only gets a limited number of hints per level (you decide how many), and the number of hints they have left should be displayed on screen.

Requirement How it’s tested
Pressing h reveals two tiles that can be swapped for a match. Press h, then swap the indicated tiles to confirm they match.
The hint is animated with timers and/or tweens. Watch the hint after pressing h.
The player has a limited number of hints per level. Keep pressing h until hints run out.
The number of hints left is displayed and updates when a hint is used. Watch the hint count while using hints.
The hint disappears after a match is made. Use a hint, make a match, and check if the indicator is still there.

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.

  1. Inside README.md, list the 2 minor 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 push to GitHub.
  2. Go to Gradescope, click the link for this assignment, select the correct repository and branch from the dropdown menus, and click Upload.
  3. Assess your peers starting the day after the three day late submission deadline.