Hello, so I have made this program where my planet rotates around the sun.
final int SUN_SIZE=50;
final int planetSize=SUN_SIZE/2;
final int X_RADIUS=150;
final int Y_RADIUS=35;
float angle=0;
final float SPEED=0.03;
void setup()
{
size(500,500);
}
void draw()
{
background(0);
fill(255,255,0);
ellipse(width/2,height/2,SUN_SIZE,SUN_SIZE);
fill(200);
ellipse(width/2+X_RADIUS*cos(angle),height/2+Y_RADIUS*sin(angle),planetSize,planetSize);
angle+=SPEED;
}
What I now need to do is to make the diameter of the planet change, depending on angle, using a sin or cos function. If the planet is straight down from the sun, the diameter of the planet should be increased by 10. If the planet is straight up from the sun, decrease its diameter by 10. It should grow and shrink smoothly as it goes around its orbit.
I know I can use the if condition but I want to do without it. Is there any way to do the above?
What code? You should put your current code in every post so we know which code you are talking about.
What is it doing wrong? How do you want it to work? Keep in mind that I am BRAND NEW to this discussion, and so if you make it SUPER EASY for me to read your last post, see the code, and know what the remaining problems are, I can jump right in and help. But you haven’t made it easy for me, so now to help I would have to read the entire discussion so far.
And that’s not fun for me. Try telling which code you mean and what is wrong in a concise, current post, and maybe you will get more helpful replies.