Question
public static final int WINDOW_MAXWIDTH = 800; public static final int WINDOW_MAXHEIGHT = 650; public static void moveToCenterMakeSmallGrowChangeColor(Circles ball) puts the ball in the center
public static final int WINDOW_MAXWIDTH = 800; public static final int WINDOW_MAXHEIGHT = 650;
public static void moveToCenterMakeSmallGrowChangeColor(Circles ball) puts the ball in the center with a diameter of 50 and increases the size of the ball until it fills the entire canvas. It should change colors between green and yellow every 25 pixels. The ball should stay in the center of the canvas.
This is what I have so far ... not sure what I'm doing wrong. Any help will benefit! Thanks in advance
public static void moveToCenterMakeSmallGrowChangeColor(Circles ball) { int x = ball.getXPosition(); int y = ball.getYPosition(); do { x = ball.getXPosition(); y = ball.getYPosition(); int growBall = 25; ball.moveTo(x = 400 - ball.getDiameter(), y = 325 - ball.getDiameter()); ball.changeDiameter(50); for (int i = 0; i <= growBall; ++i) { ball.setColor("green"); ball.changeDiameter(growBall++); ball.setColor("yellow"); ball.changeDiameter(growBall++); ball.setColor("green"); ball.changeDiameter(growBall++); ball.setColor("yellow"); growBall++; } }while(x <= WINDOW_MAXWIDTH - ball.getDiameter() && y <= WINDOW_MAXHEIGHT - ball.getDiameter());
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started