Question: 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

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 fullsize snooker table measures 12 ft \times 6 ft. Here you choose the size of table in pixels, but
you should maintain the ratio i.e., length of table = width of table /2.
The ball size is approximately 2 inches in diameter so you could use the formula below
ball diameter = table width /36Task/steps
1. Define your variables for the table, balls and the cue. Store the balls in appropriate
arrays
2. Draw the snooker table in the middle of the canvas using the correct colours,
pockets and lines as described above
3. Draw the balls in three modes a) starting positions, b) random positions (reds only),
c) random positions (reds and coloured balls). This excludes the cue ball
4. Give all balls the necessary physics (for bouncing) and friction (for slowing down).
You are expected to use matter.js
5. 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.
Adjust the speed of the cue i.e. you dont want your cue to hit very hard and through
the balls outside the table
6. The cue ball is also inserted using human interaction as above i.e. use the right
combination of key/mouse etc
7. Cushions should also have the necessary physics properties for bouncing the balls
(different from the ones the balls have). You are expected to use matter.js
8. When a red ball is in the pocket it should be removed from the array
9. Define a function for collision detection to prompt the user of the type of impact
e.g. cue-red, cue-colour, cue-cushion. The function should work only for collisions
of the cue ball
Gaming aspects
1. When the cue ball is in the pocket it should be given back to the player (run step 6
again)
2. If a colour ball falls in the pocket it should be returned to its original location
3. If two consecutive coloured balls fall in the pocket then notify the user of this
mistakeCoding style
1. Code presentation: use appropriate syntax, comments, consistent indentation and
redundant code
2. Code competency: use of object orientation, code reusability, use of functions,
variables global vs local
Extension
Since this is a creative module, we would like to give more marks for implementing further
ideas. Also, you should write some words about it in the commentary (see next
paragraph). Please note that we will award marks for the uniqueness of your extension
and how technically challenging it appears to have been. Please note that we will not
award any marks if you decide to develop the snooker app with scoring as this is not a
unique extension. Try something novel or innovative that has not been seen in snooker
gaming before. The extension is worth 20% of your mark.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!