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

Squish Z Bug Game

Leave a comment

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