I need help with a conditional! N00b here.
in
Programming Questions
•
1 year ago
Hello all.
I'd be forever thankful if one of you could help me out. I need to create a simple piece of code for class. So far I have this:
float a = 200;
void setup()
{
size(700, 480);
loop();
}
void draw()
{
background(51);
a = a - 1.5;
if (a < 0) {
a = height;
}
line(0, a, width, a);
stroke(255);
line(0, a*.5, width, a*.5);
stroke(#90102E);
line(0, a*.2, width, a*.2);
stroke(#54C8CB);
line(0,a-300, width, a-300);
stroke(0);
line(0, a*.3, width, a*.3);
stroke(#F2F7B6);
line(0,a*.1,width,a*.1);
stroke(#8D9817);
}
I'd like to set a condition so that if the line's reach the top of the canvas, they bounce back into the screen. Help?
1