INTERNET ART: networks, performative programming, and web as context

Games Project: Laws

1 Comment

screen-shot-2016-10-20-at-6-01-29-pm//Wall Variables
float wX = 600;
float wY = 600;
float wH = 20;
float wW = 20;

//goal variables
float gX = 580;
float gY = 200;
float gH = 20;
float gW = 20;
float gC1 = random(255);
float gC2 = random(255);
float gC3 = random(255);

//Player Variables
float pX = 0;
float pY = 0;
float pH = 20;
float pW = 20;
float pSpeed = 1;
float pArrows = 20;
float pMove = 0;

float x1 = 0;
float y1 = 0;
//colors
color blue = color(0,0,255);
color red = color(255,0,0);
color green = color(0,255,0);
color black = color(0);
color white = color(255);
color pink = #FF9DF5;
color gray =#BFC1C1;
color gold =#FFE708;

//time variables
float tX = 300;
float tY = 20;

//text variables
float textX = 300;
float textY = 40;
//black squares variables////////////////////////////////////
//black square 1
float bX1 = 0;
float bY1 = 580;
//black square 2
float bX2 = 120;
float bY2 = 300;
//black square 3
float bX3 = 200;
float bY3 = 400;
//black square 4
float bX4 = 280;
float bY4 = 20;
//black square 5
float bX5 = 320;
float bY5 =200;
//black square 6
float bX6 = 420;
float bY6 = 80;
//black square 7
float bX7 = 440;
float bY7 = 80;
//black squares quad in 4th collumb
float bX8 = 240;
float bY8 = 400;
float bX9 = 260;
float bY9 = 380;
float bX10 = 280;
float bY10 = 340;
float bX11 = 260;
float bY11 = 320;
//black square 12 in 2nd to last collumn
float bX12 = 540;
float bY12 = 560;
//shared variables
float bW = 20;
float bH = 20;

//The Real Goal box settings
float wX13 =480;
float wY13 =40;
float wW1 =60;
float wH1 =20;

float rgX = 500;
float rgY = 20;
float rgW = 20;
float rgH = 20;

float bEnd =1; // makes black squares till it ends
//Score
float Score = 1000;
float bs = 50; //black saved
String saved = “+50″;
float sX=500;
float sY=20;
//PlayButton Variables
boolean PlayButtonPressed = false;
boolean PlayButtonPressed2 = false;

float playX = 200;
float playY = 500;
float playH = 80;
float playW = 150;

float play2X = 200;
float play2Y = 500;
float play2H = 80;
float play2W = 150;

float pButtonX = 200;
float pButtonY = 500;
float pButtonH = 80;
float pButtonW= 150;

float pButton2X = 200;
float pButton2Y = 500;
float pButton2H = 80;
float pButton2W= 150;

String p =”Play”;

//This variable controls the screens
int gamescreen = 0;

///Game Over Stats
String go = “Game Over”;
float goX = 300;
float goY = 100;
//Black Score Variables
String bt = “Blacks Trusted =”;
float btX =100;
float btY = 200;
int btScore =0;
float btScoreX = 220;
float btScoreY = 200;
//Time Score Variables
String t = “Time = “;
float time=millis()/1000;

float timeX = 100;
float timeY = 180;
int tScore = ((millis()/1000)*100);
float tScoreX = 220;
float tScoreY = 180;
String p2 = “Play again?”;
//Total Score Variables
String totalscore = “Total Score =”;
float totalscoreX = 100;
float totalscoreY = 400;
String om = “Open Minded”;
String sheep = “Sheep!”;

/////////////////////////////Republican Variables/////////////////////////////
float repW = 80;
float repH = 80;
float repX = 100;
float repY = 30;
String rIntro = “‘Hi, I’m President Red!'”;
float rIntroX = 10;
float rIntroY =20;

String rRules = “‘Here are some laws to help”;
float rRulesX = 10;
float rRulesY = 130;
String rRules1 = “you!'”;
float rRulesX1 =10;
float rRulesY1 =150;
//Blacks Text
String Blacks1 = “‘ are dangerous!'”;
String Blacks2 = “‘They will rob you of your”;
String Blacks3 = “points so be careful!'”;

//Walls Text
String rWalls1 = “‘Don’t try to jump the walls!'”;
String rWalls2 = “‘They are electrified!'”;
String rWalls3 = “‘You will die!'”;

//Female Text
String rFem1 = “‘ are Pointdiggers!'”;
String rFem2 = “‘That is fat!”;
String rFem3 = “‘Trust me!'”;
String rGoal1 = “‘ is the goal!'”;
String rGoal2 = “‘Get to as fast as possible!'”;
//Black Text Variables
float blacks1X = 10;
float blacks1Y = 200;
float blacks2X = 10;
float blacks2Y = 250;
float blacks3X = 10;
float blacks3Y = 270;

//Wall Text Variables
float rWalls1X = 10;
float rWalls1Y = 310;
float rWalls2X = 10;
float rWalls2Y = 330;
float rWalls3X = 10;
float rWalls3Y = 350;

//Female Variables (LEft off here. Continue tomorrow. You got this Kyle!!!)

float rFem1X = 10;
float rFem1Y = 390;
float rFem2X = 10;
float rFem2Y = 410;
float rFem3X = 10;
float rFem3Y = 430;
float rGoal1X = 10;
float rGoal1Y = 470;
float rGoal2X = 10;
float rGoal2Y = 490;

/////////////////////////////////Democrat Variables////////////////////////////////////
//MAKE SURE TO CHANGE ALL X VARIABLES TO 310 OR YOU WILL FEEL STUPID KYLE!!!!

float demW = 80;
float demH = 80;
float demX = 400;
float demY = 30;
String dIntro = “‘Hi, I’m President Blue!'”;
float dIntroX = 450;
float dIntroY =20;

String dRules = “‘Here are some laws to help “;
float dRulesX = 450;
float dRulesY = 130;
String dRules1 = “you!'”;
float dRulesX1 =450;
float dRulesY1 =150;
//Blacks Text
String demBlacks1 = “‘ are dangerous!'”;
String demBlacks2 = “‘They oppress and kill”;
String demBlacks3 = “all other colors!'”;

//Walls Text
String dWalls1 = “‘Don’t try to jump the walls!'”;
String dWalls2 = “‘Trust me!'”;
String dWalls3 = “‘I know what’s best for you!'”;

//Female Text
String dFem1 = “‘Avoid the !'”;
String dFem2 = “‘I am a ! That’s why”;
String dFem3 = “you should trust me!”;

///Goal Text
String dGoal1 = “‘ is the goal!'”;
String dGoal2 = “‘Get to as fast as possible!'”;
//Black Text Variables
float demblacks1X = 450;
float demblacks1Y = 200;
float demblacks2X = 450;
float demblacks2Y = 250;
float demblacks3X = 450;
float demblacks3Y = 270;

//Wall Text Variables
float dWalls1X = 450;
float dWalls1Y = 310;
float dWalls2X = 450;
float dWalls2Y = 330;
float dWalls3X = 450;
float dWalls3Y = 350;

//Female Variables (LEft off here. Continue tomorrow. You got this Kyle!!!)

float dFem1X = 450;
float dFem1Y = 390;
float dFem2X = 450;
float dFem2Y = 410;
float dFem3X = 450;
float dFem3Y = 430;
float dGoal1X = 450;
float dGoal1Y = 470;
float dGoal2X = 450;
float dGoal2Y = 490;

/////Welcome Screen Variables
String keys = “Up, Down, Left, and Right Arrows”;

void setup(){
size(600,600);
}
void draw(){
background(green);
loop();
GameOverScreen();
Level1();
PlayButton2();
HowToPlayScreen();
PlayButton();
//noLoop()
Screens();
loop();
}

//This operates the three different screens
void Screens(){
if (gamescreen == 0){
HowToPlayScreen();
} else if (gamescreen ==1){
Level1();

} else if (gamescreen ==2){
GameOverScreen();
} else{
HowToPlayScreen();
}
}

void HowToPlayScreen(){

background(255);
fill(white);
//rect(0,300,300,600);
//fill(white);
//rect(10,20, 280,100);
textSize(20);
textAlign(LEFT);
////Republican Trump

fill(red);
rect(repX, repY, repW, repH);

//Trump speaking
fill(black);
rect(blacks1X+10, blacks1Y-20, bW, bH);
text(rIntro, rIntroX, rIntroY); //First line
text(rRules, rRulesX, rRulesY); //Second Line Rules
text(rRules1,rRulesX1, rRulesY1); //Rest of text

text(Blacks1,blacks1X,blacks1Y);
text(Blacks2, blacks2X, blacks2Y);
text(Blacks3, blacks3X, blacks3Y);

text(rWalls1, rWalls1X, rWalls1Y);
text(rWalls2, rWalls2X, rWalls2Y);
text(rWalls3, rWalls3X, rWalls3Y);

text(rFem1, rFem1X, rFem1Y);
text(rFem2, rFem2X, rFem2Y);
text(rFem3, rFem3X, rFem3Y);
fill(pink);
rect(rFem1X+10, rFem1Y-20, bW, bH);
rect(rFem2X+60, rFem2Y-15, bW, bH);

fill(black);
text(rGoal1, rGoal1X, rGoal1Y);
text(rGoal2, rGoal2X, rGoal2Y);

fill(gold);
rect(rGoal1X+10, rGoal1Y-20, bW, bH);
rect(rGoal2X+70, rGoal2Y-20, bW, bH);
//Democratic Hillary
//text(
fill(black);
rect(300,0, 300, 600);

textAlign(CENTER);
////Republican Trump

fill(blue);
rect(demX, demY, demW, demH);

//Hillary speaking
//divider for black half
fill(white);
rect(blacks1X+350, blacks1Y-20, bW, bH);
///////////////////////////Hillary Speech////////////////
text(dIntro, dIntroX, dIntroY); //First line
text(dRules, dRulesX, dRulesY); //Second Line Rules
text(dRules1,dRulesX1,dRulesY1); //Rest of text

text(demBlacks1,demblacks1X,demblacks1Y);
text(demBlacks2, demblacks2X, demblacks2Y);
text(demBlacks3, demblacks3X, demblacks3Y);

text(dWalls1, dWalls1X, dWalls1Y);
text(dWalls2, dWalls2X, dWalls2Y);
text(dWalls3, dWalls3X, dWalls3Y);

text(dFem1, dFem1X, dFem1Y);
text(dFem2, dFem2X, dFem2Y);
text(dFem3, dFem3X, dFem3Y);
fill(pink);
rect(dFem1X+30, dFem1Y-20, bW, bH);
rect(dFem2X-30, dFem2Y-15, bW, bH);

fill(white);
text(dGoal1, dGoal1X-60, dGoal1Y);
text(dGoal2, dGoal2X, dGoal2Y);
fill(gold);
rect(dGoal1X-130, dGoal1Y-20, bW, bH);
rect(dGoal2X-70, dGoal2Y-20, bW, bH);
//PlayButton Location and Variables
fill(green);
rect(pButtonX,pButtonY,pButtonW, pButtonH);
fill(0);
text(p, pButtonX+60,pButtonY+50);

}

void PlayButton(){
if (gamescreen == 0 && mouseX > playX && mouseX < (playX+playW) && mouseY > playY && mouseY < (playY+playH) && mousePressed){
PlayButtonPressed = true;
} else{
PlayButtonPressed =false;
}

if (PlayButtonPressed){
gamescreen = 1;
// PlayButtonPressed = false;

///////////////This resets all the squares!!!////////////////////
pX =0;
pY =0;
//black squares variables////////////////////////////////////
//black square 1
bX1 = 0;
bY1 = 580;
//black square 2
bX2 = 120;
bY2 = 300;
//black square 3
bX3 = 200;
bY3 = 400;
//black square 4
bX4 = 280;
bY4 = 20;
//black square 5
bX5 = 320;
bY5 =200;
//black square 6
bX6 = 420;
bY6 = 80;
//black square 7
bX7 = 440;
bY7 = 80;
//black squares quad in 4th collumb
bX8 = 240;
bY8 = 400;
bX9 = 260;
bY9 = 380;
bX10 = 280;
bY10 = 340;
bX11 = 260;
bY11 = 320;
//black square 12 in 2nd to last collumn
bX12 = 540;
bY12 = 560;

Score = 1000;
btScore = 0;
}
////////////////////////////End of Resetting Squares////////////////////

if (gamescreen > 0){
PlayButtonPressed =false;
}
}

void PlayButton2(){
if ( mouseX > play2X && mouseX < (play2X+play2W) && mouseY > play2Y && mouseY < (play2Y+play2H) && mousePressed){
PlayButtonPressed2 = true;
//PlayButtonPressed =false;

///////////////This resets all the squares!!!////////////////////
pX =0;
pY =0;
//black squares variables////////////////////////////////////
//black square 1
bX1 = 0;
bY1 = 580;
//black square 2
bX2 = 120;
bY2 = 300;
//black square 3
bX3 = 200;
bY3 = 400;
//black square 4
bX4 = 280;
bY4 = 20;
//black square 5
bX5 = 320;
bY5 =200;
//black square 6
bX6 = 420;
bY6 = 80;
//black square 7
bX7 = 440;
bY7 = 80;
//black squares quad in 4th collumb
bX8 = 240;
bY8 = 400;
bX9 = 260;
bY9 = 380;
bX10 = 280;
bY10 = 340;
bX11 = 260;
bY11 = 320;
//black square 12 in 2nd to last collumn
bX12 = 540;
bY12 = 560;

Score = 0;
btScore = 1000;
} else{
PlayButtonPressed2 =false;

}

if (PlayButtonPressed2){
gamescreen = 0;
}

if (gamescreen<2){
PlayButtonPressed2 = false;
}

}

///////////////////////LEVEL 1/////////////////////////////
void Level1(){
background(green);
player();
Walls();
Collision();
ScoreTime();
bSquares();
PlayerTouchesBlack();
goal();
PlayerTouchesFakeGoal();
RealGoal();
PlayerTouchesRealGoal();
}
//the player’s character
void player(){
fill(255);
rect(pX, pY, pW, pH);
}
void Walls(){
//noStroke();
//noFill();

fill(gray);
//left wall (keep minus 80 for wX to make large enough spaces
rect(wX-540, wY-600, wW, wH+560);
//left wall 2
rect(wX-460, wY-580, wW, wH+560);
//left wall 3 top
rect(wX-380, wY-600, wW, wH+400);
//left wall 3 bottom
rect(wX-380, wY-160, wW, wH+160);
//left wall 4 top
rect(wX-300, wY-600, wW, wH+300);
//left wall 4 bottom
rect(wX-300,wY-260, wW, wH+260);
//left wall 5 top
rect(wX-220, wY-600, wW, wH+520);
//left wall 5 bottom
rect(wX-220, wY-40, wW, wH+520);
//left wall 6 top
rect(wX-140, wY-600, wW, wH+40);
//left wall 6 bottom
rect(wX-140, wY-520, wW, wH+600);
//left wall 7 top
rect(wX-60, wY-600, wW, wH+540);
//left wall 8 bottom
rect(wX-60, wY-20, wW, wH+540);
rect(wX13, wY13, wW1, wH1);
}

void bSquares(){
//black square 1 location
rect(bX1, bY1, bW, bH);
//black square 2 location
rect(bX2, bY2, bW, bH);
//black square 3 location
rect(bX3, bY3, bW, bH);
//black square 4 location
rect(bX4, bY4, bW, bH);
//black square 5 location
rect(bX5, bY5, bW, bH);
//black square 6 location
rect(bX6, bY6, bW, bH);
//black square 7 location
rect(bX7, bY7, bW, bH);
//black square tripple in 4 collumn
rect(bX8, bY8, bW, bH);
rect(bX9, bY9, bW, bH);
rect(bX10, bY10, bW, bH);
rect(bX11, bY11, bW, bH);
//black square 12 in 2nd to last collumn
rect(bX12, bY12, bW, bH);
}

void goal(){
fill(gold);
rect(gX,gY,gW,gH);
}

void PlayerTouchesFakeGoal(){
if(pX==gX && pY==gY){
pX=0;
pY=0;
}
}
////////////////////The Real Goal is Pink ///////////////////////////
void RealGoal(){
fill(pink);
rect(rgX,rgY,rgW, rgH);
}

void PlayerTouchesRealGoal(){
if (pX == rgX && pY == rgY){
gamescreen = 2;
}
}
////////Score for Black Squares Saved!!!////////////
void PlayerTouchesBlack(){
float distance = dist(pX, pY, bX1, bY2);
float area1 =10;
float area2 =10;
boolean blackcollision1 = false;

//points for black square 1
if (pX == bX1 && pY == bY1){
blackcollision1 = true;
Score = Score + bs;
bX1 = 1000;
bY1 = 1000;
btScore = btScore +1;
text(saved,pX, pY);
} else{
blackcollision1 = false;
}

//points for black square 2
if (pX == bX2 && pY == bY2){
blackcollision1 = true;
Score = Score + bs;
bX2 = 1000;
bY2 = 1000;
btScore = btScore +1;
text(saved,pX, pY);
}

//points for black square 3
if (pX == bX3 && pY == bY3){
blackcollision1 = true;
Score = Score + bs;
bX3 = 1000;
bY3 = 1000;
btScore = btScore +1;
text(saved,pX, pY);
}

//points for black square 4
if (pX == bX4 && pY == bY4){
blackcollision1 = true;
Score = Score + bs;
bX4 = 1000;
bY4 = 1000;
btScore = btScore +1;
text(saved,pX, pY);
}

//points for black square 5
if (pX == bX5 && pY == bY5){
blackcollision1 = true;
Score = Score + bs;
bX5 = 1000;
bY5 = 1000;
btScore = btScore +1;
text(saved,pX, pY);
}

//points for black square 6
if (pX == bX6 && pY == bY6){
blackcollision1 = true;
Score = Score + bs;
bX6 = 1000;
bY6 = 1000;
btScore = btScore +1;
text(saved,pX, pY);
}

//points for black square 7
if (pX == bX7 && pY == bY7){
blackcollision1 = true;
Score = Score + bs;
bX7 = 1000;
bY7 = 1000;
btScore = btScore +1;
text(saved,pX, pY);
}

//points for black square 8
if (pX == bX8 && pY == bY8){
blackcollision1 = true;
Score = Score + bs;
bX8 = 1000;
bY8 = 1000;
btScore = btScore +1;
text(saved,pX, pY);
}

//points for black square 9
if (pX == bX9 && pY == bY9){
blackcollision1 = true;
Score = Score + bs;
bX9 = 1000;
bY9 = 1000;
btScore = btScore +1;
text(saved,pX, pY);
}

//points for black square 10
if (pX == bX10 && pY == bY10){
blackcollision1 = true;
Score = Score + bs;
bX10 = 1000;
bY10 = 1000;
btScore = btScore +1;
text(saved,pX, pY);
}

//points for black square 11
if (pX == bX11 && pY == bY11){
blackcollision1 = true;
Score = Score + bs;
bX11 = 1000;
bY11 = 1000;
btScore = btScore +1;
text(saved,pX, pY);
}

//points for black square 12
if (pX == bX12 && pY == bY12){
blackcollision1 = true;
Score = Score + bs;
bX12 = 1000;
bY12 = 1000;
btScore = btScore +1;
text(saved,pX, pY);
}

}
void borders(){
// if(pY = height || pY = 0){

// }

}
void Collision(){

}

void ScoreTime(){
fill(0);
textSize(18);
text(“Escape”,textX, textY);
fill(0);
textSize(20);
text((millis()/1000), tX, tY);
text(Score, sX, sY );
}

//////////////////////////////////////End of Level 1////////////////////////////////////

void GameOverScreen(){
background(0);
textSize(60);
fill(red);
textAlign(CENTER);
text(go, goX, goY);
textSize(20);
fill(white);

//Time Penalty
noLoop();
text(t, timeX-50, timeY);
noLoop();
text(tScore, tScoreX,tScoreY);
noLoop();

//Blacks Trusted Score
text(bt, btX, btY);
text(btScore, btScoreX, btScoreY);
text(“x 50 =”, btScoreX+50, btScoreY);
text(btScore*50, btScoreX+120, btScoreY);

//total score
text(totalscore, totalscoreX-20, totalscoreY);
text(Score, totalscoreX+110, totalscoreY);
//PlayButton Location and Variables
fill(green);
rect(pButton2X,pButton2Y,pButton2W, pButton2H);
fill(0);
text(p2, pButtonX+60,pButtonY+50);

//
fill(white);
text(“Title:”, -50, 460);
/////////////////////////////Title/////////////
if(btScore > 0){
textSize(24);
fill(green);
text(om, 200, 460);

}
if(btScore==0){
textSize(24);
fill(white);
text(sheep, 200, 460);
}
}

/////////////////////////////////////Mouse Controls////////////////////////////////////

void keyPressed(){
if (key == CODED) {
if(keyCode == DOWN){
pY=pY+pArrows;
}
else if(keyCode == UP){
pY = pY-pArrows;
}
else if(keyCode == LEFT){
pX = pX – pArrows;
}
else if(keyCode == RIGHT){
pX = pX + pArrows;
}
}
}

One thought on “Games Project: Laws

  1. Finally had a chance to read over this code as I am finishing up grading the game projects. You put so much work into coding this Kyle, awesome job!

    Like

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s