Err hello,
i have no idea if this is the right website be i need to figure out how of make a few rectangles fall from the bottom of the screen in a consistent loop but they fall at different or random locations every time the come on screen.
take a look at my code:
//variables
float xmovement ;
float whereIsIt ;
float one = -60;
float two = -150 ;
float three = -110;
float four = -200 ;
float five = -130 ;
float six = -200 ;
float seven = -450;
float eight = -200;
float nine = -300;
int Xposition;
//setup
void setup() {
size (370, 500) ;
background (255) ;
xmovement = -20 ;
Xposition=250;
}
//rectangles
void draw () {
frameRate (100) ;
fill (0) ;
noStroke() ;
rectMode (CENTER) ;
rect (185, 250, 350, 480) ;
fill (255) ;
rect (mouseX, 460, 35, 10) ;
// falling obstackles
rect (150, xmovement, 9, 23) ;
rect (Xposition, one, 9, 23) ;
rect (250, two, 9, 23) ;
rect (100, three, 9, 23) ;
rect (270, four, 9, 23) ;
rect (300, five, 9, 23) ;
rect (90, six, 9, 23) ;
rect (40, seven, 9, 23) ;
rect (160, eight, 9, 23) ;
rect (230, nine, 9, 23) ;
// logic
xmovement = xmovement + random(1, 6) ;
one = one + 4 ;
two = two + 3 ;
three = three + 4.5;
four = four + 2;
five = five + 5 ;
six = six + 2;
seven = seven + 5;
eight = eight + 4;
nine = nine + 2.8;
}
}