snooker-web-game-graphics-programming-midterm-thumbnail

Academic

Snooker Web Game (Graphics Programming Midterm)

2024 ยท 4 weeks

Grade ยท 77.14/100

About this project

A physics-based snooker web game built with p5.js and Matter.js for the Graphics Programming Midterm (University of London). Realistic ball physics, interactive cue stick, and four game modes including a unique wrap-around twist. Features: ๐ŸŽฑ Realistic ball-to-ball physics via Matter.js (zero-gravity table, momentum transfer, cushion/pocket collisions) ๐ŸŽฏ Four game modes: Normal, Random Reds, Full Random, and Table Wrap (balls teleport to opposite cushion) ๐Ÿ–ฑ๏ธ Mouse-aimed cue stick with up/down arrow power control and Enter-to-shoot ๐ŸŸข D-line cue ball placement with colour-coded validity feedback ๐Ÿ† Auto-scoring: reds removed on pocket, colours return to spot ๐Ÿ“‹ Real-time collision-type logging (cue-red, cue-color, cue-cushion) Going beyond the spec: - Table Wrap Mode โ€” balls crossing a cushion teleport to the opposite side, impossible on a real table - No-overlap random placement algorithm for the free-placement modes - Clean OOP split across `Table`, `Ball`, `CueStick` classes with composed physics and rendering

Tech stack

  • p5.js
  • Matter.js
  • JavaScript
  • HTML5 Canvas