int numVehicles = 5; // how many vehicles we will have Vehicle [] v = new Vehicle[numVehicles]; void setup() { size( 400,400 ); // sets the size of the environment frameRate(10); // sets the number of draw loops per second noStroke(); // sets the stroke on ellipses to none // this type of loop lets us perform some action to each vehicle for( int i = 0; i 400 || xPos < 0 ) { direction += 90; } yPos = yPos - speed * sin( radians(direction) ); if( yPos > 400 || yPos < 0 ) { direction += 90; } } }