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