Question: Move a circle from left to right across the screen with its edge tangential to the top of the screen. When it reaches the right



Move a circle from left to right across the screen with its edge tangential to the top of the screen. When it reaches the right edge, have it move from top to bottom with its edge tangential to the bottom of the screen. When it reaches the bottom edge, have it move from right to left across the screen with its edge tangential to the bottom of the screen. When it reaches the left edge, have it move from bottom to top with its edge tangential to the left of the screen. Repeat the loop indefinitely. The code needs to be written in Java. Pictures of my code are here. Use vectors instead to move the circle. Please add comments explaining the code. I will give a thumbs up rating
void right) ellipse(x, y, 50, 50); x speed; if (x > Rend) 30 32 x = x - speed; 36 void down ) ellipse (x, y, 50, 50); y += speed; if (y > Rend) { yy speed; 38 41 43 void left) 45 46 ellipse(x, y, 50, 50); -= speed if (x Rend) { y=y-speed; 42 43 void left) 45 46 ellipse(x, y, 50, 50); x-= speed; if (x Lend) 48 49 50 x = x + speed; 52 oid up)1 54 ellipse(x, y, 50, 50); yspeed; if (y Rend) 30 32 x = x - speed; 36 void down ) ellipse (x, y, 50, 50); y += speed; if (y > Rend) { yy speed; 38 41 43 void left) 45 46 ellipse(x, y, 50, 50); -= speed if (x Rend) { y=y-speed; 42 43 void left) 45 46 ellipse(x, y, 50, 50); x-= speed; if (x Lend) 48 49 50 x = x + speed; 52 oid up)1 54 ellipse(x, y, 50, 50); yspeed; if (y
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
