xxxxxxxxxx
//Kendrick Hayman
//Inspired by code I found that was a more soffisticated way of doing things I had done in a more complex way.
void setup(){
size(800,400);
}
float a=100;
float b=80;
float c=60;
float d=40;
float e=20;
void draw(){
strokeWeight(2);
rectMode(CENTER);
background(255);
fill(255,0,200,100);
rect(400,40,600,80);
line(120,80,120,380);
line(0,400,800,400);
line(700,80,700,380);
line(100,380,120,380);
line(100,80,100,380);
line(120,140,800,140);
line(120,195,800,195);
line(120,255,800,255);
line(120,325,800,325);
line(120,380,800,380);
//Participants
Racer(a,100);
Racer(b,160);
Racer(c,220);
Racer(d,285);
Racer(e,350);
float s1=random(-3,10);
float s2=random(-1,7);
float s3=random(-2,9);
float s4=random(-2,10);
float s5=random(-3,10);
a = a +s1;
b = b +s2;
c = c +s3;
d = d +s4;
e = e +s5;
if (a > 765){
noLoop();
textSize(32);
text("1 WINS", (width/2)-25, 30); ;
}
if (b > 765){
noLoop();
textSize(32);
text("2 WINS", (width/2)-25, 30); ;
}
if (c > 765){
noLoop();
textSize(32);
text("3 WINS", (width/2)-25, 30); ;
}
if (d > 765){
noLoop();
textSize(32);
text("4 WINS", (width/2)-25, 30); ;
}
if (e > 765){
noLoop();
textSize(32);
text("5 WINS", (width/2)-25, 30); ;
}
translate(-20,0);
rotate(-.15);
textSize(30);
text("START !!", 20, 200);
}
void Racer( float x, float y){
stroke(3);
fill(random(255),random(255),random(255), 100);
triangle(x,y,x+20,y+40,x+40,y+0);
}