11.2

Bus []bus=new Bus[10];
Bus myBus;

boolean trigger= false;
void setup() {
size(780, 500);
for (int i=0;i<bus.length;i++) {
bus[i] = new Bus(color(146, 180, 250), i*10,i*90, 1, 20, 80, 2);

}
}
void draw() {
background(200);
for (int i=0;i<bus.length;i++) {
if(trigger){
bus[i].xpos=bus[i].xpos+bus[i].xspeed;
}
else{
background(125);
stroke(0);
}}
for (int i=0;i<bus.length;i++) {

bus[i].move();
bus[i].display();
bus[i].busreverse();
}
}
void mousePressed(){
for (int i=0;i<bus.length;i++) {
if (bus[i].xpos<mouseX && mouseXwidth){
}
xpos2=xspeed+xpos2;
if(xpos2>width){
}

if(xpos2>width){
}
}
void busreverse(){

if((xposwidth)){
xspeed=xspeed*-2;

}}}

Print this page
This entry was posted in Uncategorized. Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *