please format code with </> button * homework policy * asking questions
The assignment is:
Create a circle of radius r initially in the center of the screen, which moves with a certain speed velX and velY.
Initialization: x = width / 2; y = height / 2;
x = x + velX; y = y + velY;
Make it bounce off the edges of the canvas:
if (x> width-r) {velX = -velX;}…
Add a function that changes the direction of the velocity when the mouse is pressed, making the velocity proportional to the distance the mouse is located and towards the mouse position.