Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Graphic programming we have developed a number of graphics applications using P 5 js . For this assignment you are tasked with developing a snooker
Graphic programming
we have developed a number of graphics applications using Pjs For this assignment you are tasked with developing a snooker app. You have to draw the snooker table with pockets, lines etc., add the balls and the cue. A standard full size snooker table measures ft times ft Here you choose the size of table in pixels, but you should maintain the ratio ie length of table width of table
Tasksteps
Define your variables for the table, balls and the cue. Store the balls in appropriate
arrays
Draw the snooker table in the middle of the canvas using the correct colours,
pockets and lines as described above
Draw the balls in three modes a starting positions using keystroke b random
positions reds only using keystroke c random positions reds and coloured
balls using keystroke This excludes the cue ball
Give all balls the necessary restitution for bouncing and friction for slowing
down You are expected to use matter.js
Draw the cue. Here you have a few options: use the mouse, keyboard or a
combination of them to draw and manipulate the cue so you can hit the cue ball.
Top marks will be awarded when using both mouse and key interaction. Adjust the
speed of the cue ie you dont want your cue to hit very hard and through the balls
outside the table. Zero points if cue is acting as an elastic band.
The cue ball is inserted in the D zone using human interaction as above ie use
the right combination of keymouse etc. Zero points if cue ball already in place at
start of the game without user interaction or outside the D
Cushions should also have the necessary physics properties for bouncing ie
restitution the balls different from the ones the balls have You are expected to
use matter.js
When a red ball is in the pocket it should be removed from the array
Define a function for collision detection to prompt the user of the type of impact
eg cuered, cuecolour, cuecushion. The function should work only for collisions
of the cue ball
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started