/* built with Studio Sketchpad:
* https://sketchpad.cc
*
* observe the evolution of this sketch:
* https://studio.sketchpad.cc/sp/pad/view/ro.0PnZKy2cza8/rev.1064
*
* authors:
* Raiyan
* license (unless otherwise specified):
* creative commons attribution-share alike 3.0 license.
* https://creativecommons.org/licenses/by-sa/3.0/
*/
void setup(){
size(800,520);
}
int x = 50;
int y = 50;
int Z = 1;
int A = 0;
int B = 0;
int C = 0;
int D = y + 50;
int C1 = 255;
int C2 = 0;
int F1 = 0;
int F2 = 0;
int scr = 0;
int Y1 = 0;
int Y2 = 0;
int M;
int N;
void draw() {
if (N == 0) {
background(200);
fill(155);
textSize(70);
text("Click n' Play!",220,100);
fill(50);
textSize(200);
text("DX Ball",100,300);
textSize(20);
text("THE UNLIMITED EDITION",300,400);
ellipse (50,50,100,100);
rect(200,490,130,30);
}
if (N == 0 && M == 1) {N = 1;}
if (N == 1) {
background(C1);
fill(C2);
ellipse(x,y,100,100);
colorphool();
rectMode(CENTER);
rect(mouseX-4,490,130,30);
Z = Z + 0.01;
bounce();
score();
}
if (N == 2) {
textSize(17);
text("Click to try again",350,225);
}
if (N == 2 && M == 1) {
N = 1;
x = 50;
y = 50;
Z = 1;
scr = 0;
}
}
void bounce() {
if (x <= 50){
A = 1;
}
if (x >= 750) {
A = 2;
}
if (A == 1) {
x = x+Z ;
}
if (A == 2) {
x = x-Z;
}
if (y <= 50){
B = 1;
}
if (B == 1) {
y = y+Z;
}
if (B == 2) {
y = y-Z;
}
if (B == 3) {
y = y+Z;
}
if (y >= 430 && y <= 480 && C == 1) {
B = 2;
}
else if (y >= 430 && y <= 480 && C == 2) {
B = 3;
}
if (x > mouseX-120 && x < mouseX+90) {
C = 1;
}
if (x < mouseX-120 || x > mouseX+90) {
C = 2;
}
}
void colorphool(){
if (C1 == 255) {
F1 = 1;
}
else if (C2 == 255) {
F2 = 1;
}
if (C1 == 0) {
F1 = 2;
}
else if (C2 == 0) {
F2 = 2;
}
if (F1 == 1) {
C1--;
}
else if (F1 == 2) {
C1++;
}
if (F2 == 1) {
C2--;
}
else if (F2 == 2) {
C2++;
}
}
void score(){
if (B != 3) {
scr++;
}
if (B == 3) {
fill(C2);
if (scr >= 0 && scr <= 10) {
Y1 = 1;
}
else if (scr >= 101 && scr <= 250) {
Y1 = 2;
}
else if (scr >= 251 && scr <= 750) {
Y1 = 3;
}
else if (scr >= 751 && scr <= 2000) {
Y1 = 4;
}
else if (scr >= 2001 && scr <= 5000) {
Y1 = 5;
}
else if (scr >= 5001 && scr <= 7000) {
Y1 = 6;
}
else if (scr >= 7001 && scr <= 9000) {
Y1 = 7;
}
else if (scr >= 9001&& scr <= 15000) {
Y1 = 8;
}
else if (scr >= 20000){
Y1 = 9;
}
if (Y1 == 1) {
textSize(50);
text("Damn!",50,100);
textSize(15);
text("Current score",50,120);
textSize(30)
text(scr,50,150);
//noloop();
}
else if (Y1 == 2) {
textSize(50);
text("Arrrgh...",50,100);
textSize(15);
text("Current score",50,120);
textSize(30);
text(scr,50,150);
//noloop();
}
else if (Y1 == 3) {
textSize(50);
text("Oh man! Come on!",50,100);
textSize(15);
text("Current score",50,120);
textSize(30);
text(scr,50,150);
//noloop();
}
else if (Y1 == 4) {
textSize(50);
text("Oh ***!",50,100);
textSize(15);
text("Current score",50,120);
textSize(30);
text(scr,50,150);
//noloop();
}
else if (Y1 == 5) {
textSize(50);
text("Reach for the sky",50,100);
textSize(15);
text("Current score",50,120);
textSize(30);
text(scr,50.150);
//noloop();
}
else if (Y1 == 6) {
textSize(50);
text("Almost there...",50,100);
textSize(15);
text("Current score",50,120);
textSize(30);
text(scr,50,150);
//noloop();
}
else if (Y1 == 7) {
textSize(50);
text("WHOA!",50,100);
textSize(15);
text("Your score is",50,120);
textSize(30);
text(scr,50,150);
//noloop();
}
else if (Y1 == 8) {
textSize(50);
text("Oh yes! OH yees!! OH YEEES!!!",50,100);
textSize(15);
text("Your score is",50,120);
textSize(30);
text(scr,50,150);
//noloop();
}
else if (Y1 == 9) {
textSize(50);
text("Nailed it!",50,100);
textSize(15);
text("Your score is",50,120);
textSize(30);
text(scr,50,150);
//noloop();
}
//println("Game Over")
// println("Current score");
//println(scr);
//noloop();
M = 0;
N = 2;
}
}
void mousePressed() {
M++;
}