For this assignment you are tasked with developing a snooker app. You have to draw the snooker
No answer yet for this question.
Ask a Tutor
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 and the cue. A standard fullsize 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
The ball size is approximately inches in diameter so you could use the formula below
ball diameter table width 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, b random positions reds only
c random positions reds and coloured balls This excludes the cue ball
Give all balls the necessary physics 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.
Adjust the speed of the cue ie you dont want your cue to hit very hard and through
the balls outside the table
The cue ball is also inserted using human interaction as above ie use the right
combination of keymouse etc
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
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
Gaming aspects
When the cue ball is in the pocket it should be given back to the player run step
again
If a colour ball falls in the pocket it should be returned to its original location
If two consecutive coloured balls fall in the pocket then notify the user of this
mistakeCoding style
Code presentation: use appropriate syntax, comments, consistent indentation and
redundant code
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 of your mark.
Related Book For
Posted Date: