xxxxxxxxxx
float xPos, yPos, xSpeed, ySpeed, score;
int red, green, blue;
//basic startup
void setup() {
size(500, 500);
xPos = width/2;
yPos = height/2;
xSpeed = 100;
ySpeed = xSpeed;
red = 255;
green = 40;
blue = 51;
}
void draw() {
fill(red, green, blue, 40);
noStroke();
rect(0, 0, width, height);
// ball
fill(0);
ellipse(xPos, yPos, 30, 30);
xPos += xSpeed;
yPos += ySpeed;
if (xPos < 0 + 15) {
xSpeed *= -1;
}
//Text
if (xPos > width - 15) {
xSpeed = 0;
ySpeed = 0;
textAlign(CENTER);
textSize(40);
text("Idk how u lost", width/2, height/2 - 100);
}
if (yPos > height - 15 || yPos < 0 + 15) {
ySpeed *= -1;
}
//paddle system
if (xSpeed > 0 && xPos > width - 450 && yPos > mouseY - 500 && yPos < mouseY + 500) {
xSpeed *= -1;
score += 1;
red = 125;
green = 50;
blue = 1;
}
//paddle size
rectMode(CENTER);
rect(width - 15, mouseY, 30, 120, score*30);
rectMode();
textAlign(CENTER);
textSize(20);
text(" Free Points " + score, width/2, height/2);
textSize(10);
text("You got coconut mauled, send this to all your friends to totally coconut maul them", width/2, height/3);
}