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;

}

}

}

}