We are about to switch to a new forum software. Until then we have removed the registration on this forum.
Hello!
I need some help creating a game if possible, I started taking lessons in processing at school recently and I had some team project where I recently found out that I am the only one that did his part and I kinda found myself short on time to finish it all by myself and I can't figure it out; Here's what I managed to do untill now:
1. Red Moving Bar(Arrow Keys)
int px=350; int py=750; int taillex=100; int tailley=25; int level;
// PALET void palet() { fill(255,0,0); rect(px,py,taillex,tailley); } // keyPressed // LEFT RIGHT void keyPressed() { if (key == CODED) { if(keyCode == LEFT) { px=px-5; } if(keyCode == RIGHT) { px=px+5; } } if (px<0) {px=699;} if (px>700) {px=0;} // Q D if (keyPressed) { if (key == 'q' || key == 'Q') { px=px-5; } if (key == 'd' || key == 'D') { px=px+5;} } }
// BALL void ball() { int ballx=400; int ballsize=25; int bally=50; float ballcolor=random(255); fill (ballcolor); ellipse(ballx,bally,ballsize,ballsize); while(bally<height) {bally=bally++;}
} void setup () { size (800,800); background(255); } void draw () { background(255); palet (); keyPressed ();
}
2.Switch Screen
int level=0; void draw () { if(level==0){ open(); } else if(level==1){ game(); } else {gameover(); } }
void open () { if (buttonpressed()){ level++; }
} boolean buttonPressed () { if (x<mouseX et mouseX<x+hy et y<mouseY et mouseY<y+hhy et mousePressed){ return true; } }
I'm basically trying to make a simple game where you have to either bounce balls off or avoid them, becoming a bit harder over time The level part is basically trying to get a screen in the beginning with something like press here/any key to start and then game over, press here to try again
Thanks for the help!
Answers
I'm on it
you need some tricks to reflect the ball on the screen borders
alternatively you could start with 3 Lives and on each miss say
Lives--;
(which means to decrease Lives by 1)
and when you are down to 0 lives, say game over