Answered step by step
Verified Expert Solution
Link Copied!

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 P5js. 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 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.
Task/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 using keystroke 1, b) random
positions (reds only) using keystroke 2, c) random positions (reds and coloured
balls) using keystroke 3. This excludes the cue ball
4. Give all balls the necessary restitution (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.
Top marks will be awarded when using both mouse and key interaction. Adjust the
speed of the cue i.e. 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.
6. The cue ball is inserted (in the D zone) using human interaction as above i.e. use
the right combination of key/mouse etc. Zero points if cue ball already in place at
start of the game without user interaction or outside the D.
7. Cushions should also have the necessary physics properties for bouncing (i.e.
restitution) 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
image text in transcribed

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Structured Search For Big Data From Keywords To Key-objects

Authors: Mikhail Gilula

1st Edition

012804652X, 9780128046524

More Books

Students also viewed these Databases questions

Question

4. Think of analogies that will make ideas easier to understand.

Answered: 1 week ago