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

FOMO game

Leave a comment

// 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 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