xxxxxxxxxx
/*-----------------------------
Horse Race
Makes a horse race for you to bet on
02/10/2017
Austin DiLorenzo
dilorenzo.14@osu.edu
01/13/2017
Austin DiLorenzo
-----------------------------*/
float moveA = 0;
float moveB = 0;
float moveC = 0;
float moveD = 0;
float moveE = 0;
float moveF = 0;
void setup(){
frameRate(45);
size(2040,420);
}
void draw(){
background(100);
for(int i = width; i > 0; i = i - 8){
int x = i;
int y = i/8;
BG(x, y);
}
int J = 55;
int K = 255;
int I = 0;
float x = 50 + moveA;
float y = 50 + moveB;
float z = 50 + moveC;
float a = 50 + moveD;
float b = 50 + moveE;
float c = 50 + moveF;
int H = 60;
lol(x,H,K,I,I);
lol(y,H*2,K,J*2,I);
lol(z,H*3,K,K,J);
lol(a,H*4,I,K,I);
lol(b,H*5,I,J,K);
lol(c,H*6,K,J,J*4);
moveA = moveA + random(10);
moveB = moveB + random(-5,15);
moveC = moveC + random(-5,15);
moveD = moveD + random(-5,15);
moveE = moveE + random(10);
moveF = moveF + random(-5,15);
if(x >= 1935){
noLoop();
fill(0,0,0,30);
rect(0,0, width,height);
fill(255);
textMode(CENTER);
text("RED WINS", width/2,height/2);
}
if(y >= 1935){
noLoop();
fill(0,0,0,30);
rect(0,0, width,height);
fill(255);
textMode(CENTER);
text("ORANGE WINS", width/2,height/2);
}
if(z >= 1935){
noLoop();
fill(0,0,0,30);
rect(0,0, width,height);
fill(255);
textMode(CENTER);
text("YELLOW WINS", width/2,height/2);
}
if(a >= 1935){
noLoop();
fill(0,0,0,30);
rect(0,0, width,height);
fill(255);
textMode(CENTER);
text("GREEN WINS", width/2,height/2);
}
if(b >= 1935){
noLoop();
fill(0,0,0,30);
rect(0,0, width,height);
fill(255);
textMode(CENTER);
text("BLUE WINS", width/2,height/2);
}
if(c >= 1935){
noLoop();
fill(0,0,0,30);
rect(0,0, width,height);
fill(255);
textMode(CENTER);
text("PURPLE WINS", width/2,height/2);
}
}
void BG(int x, int y){
noStroke();
fill(y);
rect(0,0, x,height);
strokeWeight(8);
stroke(0);
line(1990,0, 1990,height);
}
void lol(float x, int H, int R, int G, int B){
strokeWeight(4);
stroke(0);
line(x+25,H+5, x+30,H+10);
line(x+30,H+10, x+20,H+20);
line(x-5,H+10, x-15,H+20);
fill(R,G,B);
stroke(0);
strokeWeight(2);
ellipse(x,H, 50,25);
ellipse(x+40,H-35, 7,14);
strokeWeight(4);
line(x+15,H+5, x+20,H+10);
line(x+20,H+10, x+10,H+20);
line(x-15,H+10, x-25,H+20);
line(x+20,H-10, x+30,H-20);
line(x-25,H, x-35,H);
line(x+29,H-24, x+24,H-29);
line(x+25,H-20, x+20,H-25);
line(x+21,H-16, x+16,H-21);
line(x+17,H-12, x+12,H-17);
fill(R,G,B);
stroke(0);
strokeWeight(2);
ellipse(x+40,H-20, 25,20);
ellipse(x+35,H-35, 7,14);
}
void keyPressed(){
noLoop();
fill(0,0,0,30);
rect(0,0, width,height);
fill(255);
textMode(CENTER);
text("PLACE YOUR BETS", width/2,height/2);
}
void keyReleased(){
loop();
}