Question: Hello everybody I have a coding assignment due tomorrow and I am stuck on implementing some code. I have attached the requirements of the assignemnt

Hello everybody I have a coding assignment due tomorrow and I am stuck on implementing some code. I have attached the requirements of the assignemnt and you can find the code of the game in the comment section. Hello everybody I have a coding assignment due tomorrow and I am

2. The position of the ball is effected by the velocity parameter (xl,yl). If the ball collides with the left or right wall, we make the xl component negative If it collides with the top or bottom ball, the yl component needs to be reversed. Movement of any object is defined as position x(t+1) -x(t) x1(t) and y(t+1)-y(t) + yl(t), where x and y are position of the ball on the canvas and xl and yl are its velocity components. (a) Create a function that checks if the ball has collided with the wall and reverse the direction of ball. This creates the effect of reflec- tion/bouncing off the wall effect. 4 marks] (b) This function also sets the switch to play sound. When you detect a collision, math(soundswitch) should be set to 'Y' [1 mark] (c) Increment the count by 1 in case of collision with the walls 1 Mark] 3. The colour of the circles on the screen can be changed based on time. Each circle starts with a different colour and can be changed every 1 second in sequential order, creating a special effect (bonus question). Each colour has its own Hex code starting with the pound/hashtag symbol, for example black has a html code (070707). The website https://htmlcolorcodes.com/ gives hex values for many colours, (a) Change the default colours, using colour values from the website pro- vided. No marks will be provided if the default colours are used. 1 Mark 2. The position of the ball is effected by the velocity parameter (xl,yl). If the ball collides with the left or right wall, we make the xl component negative If it collides with the top or bottom ball, the yl component needs to be reversed. Movement of any object is defined as position x(t+1) -x(t) x1(t) and y(t+1)-y(t) + yl(t), where x and y are position of the ball on the canvas and xl and yl are its velocity components. (a) Create a function that checks if the ball has collided with the wall and reverse the direction of ball. This creates the effect of reflec- tion/bouncing off the wall effect. 4 marks] (b) This function also sets the switch to play sound. When you detect a collision, math(soundswitch) should be set to 'Y' [1 mark] (c) Increment the count by 1 in case of collision with the walls 1 Mark] 3. The colour of the circles on the screen can be changed based on time. Each circle starts with a different colour and can be changed every 1 second in sequential order, creating a special effect (bonus question). Each colour has its own Hex code starting with the pound/hashtag symbol, for example black has a html code (070707). The website https://htmlcolorcodes.com/ gives hex values for many colours, (a) Change the default colours, using colour values from the website pro- vided. No marks will be provided if the default colours are used. 1 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 Databases Questions!