Browse Source

Startposition&Geschwindigkeit des Balles

remotes/origin/branchJulia
fdai8040 11 months ago
parent
commit
d1a3a890c1
  1. 3
      src/main/c/Pong/game.c

3
src/main/c/Pong/game.c

@ -35,6 +35,8 @@ void drawField(int paddle1PositionY, int paddle2PositionY, Ball ball) {
printf("%c", PADDLE); printf("%c", PADDLE);
} else if (i >= paddle2PositionY && i < paddle2PositionY + PADDLE_LENGTH && j == 0) { } else if (i >= paddle2PositionY && i < paddle2PositionY + PADDLE_LENGTH && j == 0) {
printf("%c", PADDLE); printf("%c", PADDLE);
} else if (i == ball.y && j == ball.x) {
printf("%c", BALL);
} else { } else {
printf(" "); printf(" ");
} }
@ -77,6 +79,7 @@ int getch(void) {
int main(){ int main(){
int paddle1PositionY = HEIGHT / 2 - PADDLE_LENGTH / 2; int paddle1PositionY = HEIGHT / 2 - PADDLE_LENGTH / 2;
int paddle2PositionY = HEIGHT / 2 - PADDLE_LENGTH / 2; int paddle2PositionY = HEIGHT / 2 - PADDLE_LENGTH / 2;
Ball ball = {WIDTH / 2, HEIGHT / 2, 1, 1}; //Startposition&Geschwindigkeit Ball
while (1) { while (1) {
//Steuerung für Schläger 1 //Steuerung für Schläger 1

Loading…
Cancel
Save