void draw()
{
if (keyPressed)
{
if(key == 'r')
{
move1 = 0;
move2 = 0;
move3 = 0;
x=0;
y=0;
h=0;
ende=0;
score=0;
}
if(key == 'w') basketmode = 1;
if(key == 'e') basketmode = 2;
if(key == '1') mousemode = 1;
if(key == '2') mousemode = 2;
if(key == '3') mousemode = 3;
}
if (ende == 1)
{
if (keyPressed){
if(key == 'r')
{
move1 = 0;
move2 = 0;
move3 = 0;
x=0;
y=0;
h=0;
ende=0;
score=0;
}
}
return;
}
background(0);
textSize(50);
fill(255,0,0);
text(score,10,50);
fill(255);
if(basketmode == 0) rect(250,height/2+h,40,40);
if(move1 == 1)
{
aa = random(0,500);
ab = aa + 180;
}
rect(500-move1,0,75,aa);
rect(500-move1,ab,75,500);
if(500-move1 < 290 && 500-move1 >165){
if(height/2+h < aa || height/2+h > ab-40){
textSize(90);
fill(255,0,0);
text("Game Over",10,300);
textSize(50);
text("highscore:", 10,400);
text(highscore ,300,400);
ende=1;
}
}
if (move1 == 725) move1 = 0;
move1++;
if (move1 == 250 || move2 == 500) score++;
if(move2 == 1)
{
ba = random(0,500);
bb = ba + 180;
}
rect(750-move2,0,75,ba);
rect(750-move2,bb,75,500);
if(750-move2 < 290 && 750-move2 >165){
if (height/2+h < ba || height/2+h > bb-40){
textSize(90);
fill(255,0,0);
text("Game Over",10,300);
textSize(50);
text("highscore:", 10,400);
text(highscore ,300,400);
ende=1;
}
Tidak ada komentar:
Posting Komentar