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


Leave a comment

A-Y, Plan Z !

 

PImage photo;
PImage photo2;
PImage photo3;
PImage photo4;
PImage photo5;
PImage photo6;
PImage photo7;
PImage photo8;
PFont title;
int firstsizex, firstsizey, stage, stage2;
PFont myFont;
PFont myFont2;
float speedArrows = 30;
float x= 800;
float l;
float h;
float y= 100;
float x2= 800;
float y2= 100;
float speed = 2;
float speed2 = 4;
float leftright;
float updown;
int Switch= 0;
boolean stage1 = false;
int a = keyCode;
int w = keyCode;
int s = keyCode;
int d = keyCode;

void setup(){
stage = 1;
size(800,800);
//openingbackground
photo = loadImage(“Sandy.jpg”);
image(photo, 0 , 0 , 800, 800);
//character
photo2 = loadImage(“Plankton.png”);
updown=700;
leftright=680;
//startingpoint
photo3 = loadImage(“Krusty_Krab.jpg”);
//defender
photo4 = loadImage(“Krabs.png”);
//endingpoint
photo5 = loadImage(“The_Chum_Bucket.jpg”);
//defender2
photo6 = loadImage(“Spongebob.png”);
//defender3
photo7 = loadImage(“Squidward.png”);
myFont = createFont(“krazynights.ttf”, 60);
myFont2 = createFont(“AdobeFanHeitiStd-48”, 60);
}

void draw(){
move();
display();
if(stage==1){
fill(0);
noStroke();
ellipse(50,300,30,30);
ellipse(100,150,25,25);
ellipse(200,100,20,20);
ellipse(300,100,15,15);
ellipse(400,100,10,10);
ellipse(500,80,5,5);
ellipse(800,800,400,400);
stroke(#BF0404);
line(600,30,680,100);
stroke(#BF0404);
line(700,30,600,110);
textFont(myFont);
textAlign(CENTER);
textSize(60);
text(“Plan Z”, width/2, 300);
fill(#BF0404);
text(” Z”, width/2, 300);
textSize(22);
fill(#FFFFFF);
text(“Press the spacebar to begin”, 405, 440);
textFont(myFont2);
textSize(16);
fill(0);
textAlign(CENTER, CENTER);
text(“Plankton has stolen the Krabby Pattie secret formula.”,410,500);
text(“Will he make it back to the chum bucket, so he can”,410,515);
text(“continue on with his plan? Thats up to you!”,410,530);
text(“Help Plankton get to the Chum Bucket using a(left), s(down), d(right), w(up)”,410,570);
text(“without falling off the cliff and getting caught by the other characters.”,410,585);
text(“You have 3 lives, use them wisely!”,410,600);
fill(#FFFFFF);
textSize(24);
text(“Start Here”,700,750);
fill(#BF0404);
textSize(18);
text(“How to play:”,400,475);
if(keyPressed == true){
stage = 2;
}
}
if(stage==2){
background(0);
fill(#FFFFFF);
noStroke();
rect(500, 680, 300, 150);
rect(700, 590, 50, 100);
rect(600, 590, 150, 50);
rect(550, 540, 50, 100);
rect(550, 500, 150, 50);
rect(700, 450, 50, 100);
rect(250, 400, 500, 50);
rect(200, 300, 50, 150);
rect(200, 250, 250, 50);
rect(400, 100, 50, 150);
rect(250, 0, 300, 100);
fill(#BF0404);
//TL
ellipse(0, 0, 140, 140);
//BL
ellipse(0, 800, 140, 140);
//TR
ellipse(800, 0, 140, 140);
//spongebob
image(photo6, x, 250, 45, 45);
//krabs
image(photo4, x, 450, 45, 45);
//squidward
image(photo7, x, 595, 45, 45);
//krustykrab
image(photo3, 525, 680, 250, 150);
//chumbucket
image(photo5, 275, 0, 250, 100);
//plankton
image(photo2, leftright, updown, 45, 45);
}
if(keyPressed==true){
if(key==’a’){
leftright=leftright-5;
}
if(key==’d’){
leftright=leftright+5;
}
if(key==’w’){
updown=updown-5;
}
if(key==’s’){
updown=updown+5;
}
}
}
void move(){
if( x > width || x < 0) {
Switch= 1;
}
if( x == x/2) {
Switch= 0;
}
if( Switch==00){
x++;
}
else{
x–;
}
if( x > width || x < 0) {
Switch= 3;
}
if( x == x/2) {
Switch= 0;
}
if( Switch==00){
x++;
}
else{
x–;
}
}

void display(){
//defender1
photo4 = loadImage(“Krabs.png”);
//defender2
photo6 = loadImage(“Spongebob.png”);
//defender3
photo7 = loadImage(“Squidward.png”);
}

Advertisements


Leave a comment

Lionel RIchie Game Code

import ddf.minim.*;
Minim minim;
AudioPlayer player;
AudioPlayer player2;
int gameScreen = 0;
int ballX, ballY;
int ballSize = 50;
int ballColor = color(0);
float gravity = 5;
float ballSpeedVert = 0;
int hits = 0;
PImage img;

void setup() {
size(500, 500);
ballX=width/4;
ballY=height/5;
minim = new Minim(this);
player = minim.loadFile (“fiesta.mp3”);
player2 = minim.loadFile (“party.mp3”);
img = loadImage(“Lionel2.jpg”);

}
void draw() {
if (gameScreen == 0) {
initScreen();
} else if (gameScreen == 1) {
gameScreen();
} else if (gameScreen == 2){
hits = 2;
gameOverScreen();
}
WriteScoreAndTime();
}
public void keyPressed() {

if (gameScreen==0) {
startGame();
}
}
void mouseClicked(){
if (ballY == height/2){
hits = hits+1;
}
if (hits == 6){
gameScreen =2;
}
}
void startGame(){
gameScreen=1;
}
void initScreen() {
background(0);
textAlign(CENTER);
text(“press any key”, height/2, width/2);
player.loop();
}

void gameScreen() {
background(img);
drawBall();
applyGravity();
keepInScreen();
virtue();
WriteScoreAndTime();
player2.loop();
}
void drawBall() {
fill(ballColor);
ellipse(ballX, ballY, ballSize, ballSize);
}
void virtue(){
rect(height/2, width/2, 500, 10);

}
void applyGravity(){
ballSpeedVert += gravity;
ballY += ballSpeedVert;
}
void makeBounceBottom(int surface) {
ballY = surface-(ballSize/2);
ballSpeedVert*=-1;
}

void makeBounceTop(int surface) {
ballY = surface+(ballSize/2);
ballSpeedVert*=-1;
}

void keepInScreen() {

if (ballY+(ballSize/2) > height) {
makeBounceBottom(height);
}

if (ballY-(ballSize/2) < 0) {
makeBounceTop(0);
}
}

void gameOverScreen() {
background(0);
textAlign(CENTER);
fill(255);
text(“GME OVR”, height/2, width/2);
player2.loop();

}
void WriteScoreAndTime(){
textSize(32);
text(hits, width/9, height/6);
fill(255);
}


Leave a comment

FOMO game

// score
int score;
boolean click = false;
//gameOver
int gameOver = 0;
//startGame;
int getRandomX()
// int score;
{
return int(random(600));
}
int[] likex = { getRandomX(), getRandomX(), getRandomX(), getRandomX(), getRandomX() };
int[] likey = { 0, 0, 0, 0, 0 };
//images
PImage like;
PImage phone;
PImage newsfeed;
PImage newsfeed2;
PImage tabs;
//backgroundstuff
float ny1 = 0;
float ny2= 1000;
float speedn =1;
int bgh = 1000;
//notification bubble
float eX = 830;
float eY = 77;
float eD = 30;

int lw = 50 ;//like width
int lh = 43; //like height
void setup()
{
size (900, 500);
phone = loadImage(“phone.png”);
like = loadImage(“like.png”);
newsfeed = loadImage(“newsfeed.jpg”);
newsfeed2 = loadImage(“newsfeed2.jpg”);
tabs = loadImage(“toolbar.png”);
}

void draw()
{
backgroundOneRepeat();
backgroundTwoRepeat();
ny1-=speedn;
ny2-=speedn;
image(newsfeed,0,ny1);
image(newsfeed2,0,ny2);
image(tabs,0,0);
noCursor();
image(phone, mouseX-20, mouseY-37);
fill(0);
textSize(34);
textAlign(CENTER);
text(“COLLECT LIKES”, width/2, 480);

noStroke();
fill(#D81F1F);
ellipse(eX,eY,eD,eD);
textSize(16);
fill(255);
text(score,830,82);

if(click)
{
gun(mouseX, mouseY);
click = false;
}

falling();
gameFinish();
}

void mousePressed()
{
click = true;
}

void falling()
{

for (int i=0; i<5; i++)
{
image(like,likex[i], likey[i]++);
like.resize(lw,lh);
}
}

void gun(int shotX, int shotY)
{
boolean strike = false;
for (int i = 0; i < 5; i++)
{
if((shotX >= (likex[i])) && (shotX <= (likex[i]+lw)) && (shotY >=(likey[i]))&&(shotY<=(likey[i]+lw))) {
strike = true;
image(like,likex[i], likey[i]);
like.resize(lw,lh);
likex[i] = getRandomX();
likey[i] = 0;
// scoreing stuff
score++;
}
}

if(strike == false)
{
line(mouseX, 565, mouseX, 0);
}
}

void backgroundOneRepeat(){
if(ny1==-bgh){
ny1=bgh;
ny1-=1;
}
}

void backgroundTwoRepeat(){
if(ny2==-bgh){
ny2=bgh;
ny2-=1;
}
}

//GameOver
void gameFinish()
{
for (int i=0; i< 5; i++)
{
if(likey[i]==500)
{

gameOverScreen();
fill(color(0));
fill(0);
textAlign(CENTER);
textSize(24);

text(“Congratulations! You Accomplished Nothing!”, width/2, height/2-50);
text(“Notifications collected : “+ score, width/2, height/2 );
text(“New Followers: ” + floor(score/10),width/2, height/2 +50);
text(“No One Cares! YOUR EFFORTS ARE FUTILE!”, width/2, height/2+100);
noLoop();
}
}
}

void gameOverScreen(){
background(#D81F1F,65);
}

//to make it work, you’ll to to have the following images in the same folder titled ‘like.png’ ‘newsfeed.jpg’ ‘newsfeed2.jpg’ ‘phone.png’ and ‘toolbar.png’ respectively

likenewsfeednewsfeed2phonetoolbar


Leave a comment

Squish Z Bug Game

int xPos;
int speed=2;
int xDir=10;
int score=0;
int misses=100;
PImage Sky;
PImage bug;
boolean lost=false;

void setup()
{
size (1000,400);
smooth();
Sky = loadImage(“sky1.png”);
bug = loadImage (“bug.png”);
xPos=width/40;
fill(20,25,123);
textSize(24);
}

void draw()
{
background(Sky);
image(bug,xPos,height/4,40,40);
xPos=xPos+(speed*xDir);
if (xPos > width-20 || xPos<20)
{
xDir=-xDir;
}
text(“Squishes = “+score,8,280);
text(“Misses = “+misses,width-180,280);
if (misses<=0)
{
textSize(80);
text(“Squish Again”, 125,100);
noLoop();
lost=true;
textSize(20);
}
}

void mousePressed()
{
if (dist(mouseX, mouseY, xPos, 200)<=80)
{
score=score+speed;
speed=speed+1;
}
else
{
if (speed<1)
{
speed=speed-1;
}
misses=misses-1;
}
if (lost==true)
{
speed=4;
misses=100;
score=0;
xPos=width/2;
xDir=2;
lost=false;
loop();
}
}


Leave a comment

Break Out into Siezures

breakoutintosiezures

Ze Code:
int[] blocks = new int[20];
int x = 250 + int(random(-80,80));
int y = 350;
int x_speed = 3;
int y_speed = -3;
int x_paddle = 250, y_paddle = 370;
int paddle_width_half = 40;
int score = 0;
int level = 1;
int wait = 0;

void setup() {
int i;
size(500, 400);
rectMode(CENTER);
for (i=0; i<20; i++) {
blocks[i] = 1;
}
}

void draw() {
int i, x_tmp, y_tmp;
int blocks_gone;

x = x + x_speed;
y = y + y_speed;
if (x>width || x<0)
x_speed = -x_speed;
if (y<0)
y_speed = -y_speed;

if (keyPressed) {
if (keyCode == RIGHT || key == ‘d’) {

x_paddle = x_paddle + 8;
} else if (keyCode == LEFT || key == ‘a’) {

x_paddle = x_paddle – 8;
} else if (key == ‘ ‘) {

x = 250 + int(random(-80,80));
y = 350;
x_speed = 3;
y_speed = -3;
x_paddle = 250;
score = 0;
level = 1;

for (i=0; i<20; i++) {
blocks[i] = 1;
}
}
}
if ((x_paddle-paddle_width_half)<x && (x_paddle+paddle_width_half)>x &&
(y_paddle-10)<y && (y_paddle)>y) {

y_speed = -y_speed;
score = score + 1;
}
background( random(255), random(255), random(255), random(255));

fill( random(255), random(255), random(255), random(255));

textSize(16);
textAlign(RIGHT);
text(“Score”, 80, 390);
textAlign(LEFT);
text(score, 90, 390);

textAlign(RIGHT);
text(“Level”, 450, 390);
textAlign(LEFT);
text(level, 460, 390);
ellipse(x, y, 10, 10);

rect(x_paddle, y_paddle, paddle_width_half*2+1, 11);
if (y>height) {
textSize(40);
textAlign(CENTER);
text(“Game Over”, 250, 250);
}

blocks_gone = 1;

for (i=0; i<20; i++) {

x_tmp = i%5*100+10;
y_tmp = 40*(i/5)+10;

if (blocks[i]==1) {

rect(x_tmp+40, y_tmp+10, 80, 20);

blocks_gone = 0;
}

if (x>(x_tmp+4) && x<(x_tmp+76) &&
y>y_tmp && y<(y_tmp+20) && blocks[i]==1) {
blocks[i]=0;
y_speed = -y_speed;
score = score + 5;
}

if (((x>(x_tmp-5) && x<x_tmp) || (x>(x_tmp+80) && x<(x_tmp+85))) &&
y>y_tmp && y<(y_tmp+20) && blocks[i]==1) {
blocks[i]=0;
x_speed = -x_speed;
score = score + 5;
}

if (((x>(x_tmp-1) && x<(x_tmp+5)) || (x>(x_tmp+75) && x<(x_tmp+81))) &&
y>y_tmp && y<(y_tmp+20) && blocks[i]==1) {
blocks[i]=0;
x_speed = -x_speed;
y_speed = -y_speed;
score = score + 5;
}
}
if (blocks_gone==1 && wait<200) {
textSize(40);
textAlign(CENTER);
text(“Level Cleared!”, 250, 210);
text(“Next level”, 250, 290);
x = 250;
y = 350;
x_speed = 0;
y_speed = 0;
wait++;
if (wait==200) {
wait = 0;
x = 250 + int(random(-80,80));;
y = 350;
x_speed = 3+level;
y_speed = -3-level;
x_paddle = 250;
level++;

for (i=0; i<20; i++) {
blocks[i] = 1;
}
}
}
}


1 Comment

Games Project: Laws

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;
}
}
}


Leave a comment

code

int ballX = 250;
int ballY = 250;

int xSpeed = -1;
int ySpeed = 2;

int playerOneX = 0;
int playerOneY = 250;

int playerTwoX = 475;
int playerTwoY = 250;

int paddleHeight = 90;
int paddleWidth = 25;

int playerOneScore = 0;
int playerTwoScore = 0;

void setup() {
size(500, 500);

}

void draw() {
background(225);
noStroke();

if (keyPressed) {
if (keyCode == UP) {
if (playerOneY > 0) {
playerOneY = playerOneY – 5;
}
}

if (keyCode == DOWN) {
if (playerOneY + paddleHeight < 500) {
playerOneY = playerOneY + 5;
}
}
}

if (playerTwoY < mouseY) {
playerTwoY = playerTwoY + 5;
}

if (playerTwoY > mouseY) {
playerTwoY = playerTwoY – 5;
}

ballX = ballX + xSpeed;
ballY = ballY + ySpeed;

if (ballY < 0) {
ySpeed = ySpeed * -1;
}

if (ballY > 500) {
ySpeed = ySpeed * -1;
}

if (ballX < playerOneX + paddleWidth) {

if (ballY < playerOneY) {
playerTwoScore = playerTwoScore + 1;
ballX = 250;
ballY = 250;
}

if (ballY > playerOneY + paddleHeight) {
playerTwoScore = playerTwoScore + 1;
ballX = 250;
ballY = 250;
}

xSpeed = xSpeed * -1;
}

if (ballX > playerTwoX) {

if (ballY < playerTwoY) {
playerOneScore = playerOneScore + 1;
ballX = 250;
ballY = 250;
}

if (ballY > playerTwoY + paddleHeight) {
playerOneScore = playerOneScore + 1;
ballX = 250;
ballY = 250;
}

xSpeed = xSpeed * -1;
}

fill( 50, 55, 100);
textSize(70);
text(playerOneScore, 100, 100);
text(playerTwoScore, 350, 100);
rect(playerOneX, playerOneY, paddleWidth, paddleHeight);
fill ( 50, 100, 150);
rect(playerTwoX, playerTwoY, paddleWidth, paddleHeight);
fill ( 255, 204, 0);
ellipse(ballX, ballY, 70, 70);
ellipseMode(RADIUS);

}