Skip to content

Instantly share code, notes, and snippets.

@ybakos
Created February 7, 2014 17:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ybakos/8866946 to your computer and use it in GitHub Desktop.
Save ybakos/8866946 to your computer and use it in GitHub Desktop.
// Yong Bakos
// Breakout/Arkanoid Remixed.
// This program is based on the classic game of Breakout, by Atari's
// Nolan Bushnell and Steve Bristow, released in 1976.
// A playing field of bricks lies at the top of the screen, and a
// player-controlled paddle lies at the bottom. A ball bounces around
// the playing field and the ball destroys a brick when it contacts the
// brick.
// If the ball reaches the bottom of the screen, the user loses a ball.
// If the player loses 3 balls, the game is over.
// If the player clears all the bricks, he wins.
// Extras: Bricks will be different colors. Some will require more than
// one collision to be destroyed, and are worth more points.
// I would like to have multiple levels and power-ups fall from
// the bricks that enhance the paddle.
boolean displayStartScreen = true;
int x = 10;
int y = 100;
final int BALL_SIZE = 20;
void setup() {
size(400, 400);
}
void draw() {
if (displayStartScreen) {
background(100, 100, 100);
textSize(50);
textAlign(CENTER);
text("BREAKOUT!", width / 2, height / 2);
textSize(10);
text("Press any key to begin.", width / 2, height / 2 + 100);
} else {
background(0);
ellipse(x, y, BALL_SIZE, BALL_SIZE);
}
}
void keyPressed() {
displayStartScreen = false;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment