xxxxxxxxxx
void setup() {
background(10, 5, 25);
size(540, 1000);
blocks.add(new colourBlock());
}
boolean isYellow = false;
boolean isStart = false;
int lives = 50;
int score = 0;
int tick;
void draw() {
strokeWeight(20);
stroke(50, 90, 255);
if (isYellow) {
stroke(205, 240, 20);
}
fill(0, 20);
rect(0, 0, width, height);
fill(50, 90, 255);
if (isYellow) {
fill(205, 240, 20);
}
rect(0, 0, width, 100);
if (isStart) {
for (colourBlock block : blocks) {
block.render();
}
tick++;
if (tick % 15 == 0) {
blocks.add(new colourBlock());
}
fill(255, 255, 255);
textSize(50);
textAlign(CENTER, TOP);
text("Lives: " + str(lives), width / 2, 0);
text("Score: " + str(score), width / 2, 50);
}
}
void keyPressed() {
if (key == ' ') {
isYellow = !isYellow;
}
if (key == 'a') {
isYellow = false;
}
if (key == 'd') {
isYellow = true;
}
isStart = true;
}
void mouseClicked() {
isStart = true;
}