How do you have two 'if' tests for one else?
in
Programming Questions
•
8 months ago
The circle is starting on the left side. I made it go to the right side, when getting to the end, going up. How do I make the ball stop when it gets to the top? I tried using 2 if tests but I didn't know how.
This is the code without stoping at the top.
float circleX;
float circleY;
void setup() {
size(600,600);
smooth();
circleX = 100;
circleY = 300;
}
void draw() {
background(100);
ellipse(circleX,circleY,200,200);
if(circleX <= 500) {
circleX++;
} else {
circleY--;
}
}
1