help on my code qucicly please!!!
in
Programming Questions
•
2 years ago
I have a code that makes little spheres appear at the top of the screen and then they shake as they fall down. I want to change the code so that the balls appear one at a time and once one ball reaches the bottom the next one comes up.
final int maxAsteroid=20;
int[] xAsteroid = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0};
int[] yAsteroid = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0};
int[] tempAsteroid = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0};
int a;
boolean[] AsteroidActive = {true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true};
int[] xAsteroid = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0};
int[] yAsteroid = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0};
int[] tempAsteroid = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0};
int a;
boolean[] AsteroidActive = {true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true};
void setup(){
size(750,300);
noStroke();
smooth();
for (int i=0; i<maxAsteroid; i++){
xAsteroid[i]=int(random(10,740));
AsteroidActive[i]=(random(2)<1);
}
}
void draw(){
background(150);
for (int i=0; i<maxAsteroid; i++){
for(int ii=0; AsteroidActive[ii] == true; ii++ ){
ellipse(xAsteroid[i],yAsteroid[i],15,15);
if(yAsteroid[i]<250){
yAsteroid[i]=yAsteroid[i]+1;
xAsteroid[i]=xAsteroid[i]+int(random(0,5))-int(random(0,5));
}
}
}
}
background(150);
for (int i=0; i<maxAsteroid; i++){
for(int ii=0; AsteroidActive[ii] == true; ii++ ){
ellipse(xAsteroid[i],yAsteroid[i],15,15);
if(yAsteroid[i]<250){
yAsteroid[i]=yAsteroid[i]+1;
xAsteroid[i]=xAsteroid[i]+int(random(0,5))-int(random(0,5));
}
}
}
}
1