From d1a3a890c1daad92c1685786f3e56b07b3ea5d4d Mon Sep 17 00:00:00 2001 From: fdai8040 Date: Wed, 31 Jan 2024 15:13:19 +0000 Subject: [PATCH] Startposition&Geschwindigkeit des Balles --- src/main/c/Pong/game.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/main/c/Pong/game.c b/src/main/c/Pong/game.c index c6067ed..f0f382e 100644 --- a/src/main/c/Pong/game.c +++ b/src/main/c/Pong/game.c @@ -35,6 +35,8 @@ void drawField(int paddle1PositionY, int paddle2PositionY, Ball ball) { printf("%c", PADDLE); } else if (i >= paddle2PositionY && i < paddle2PositionY + PADDLE_LENGTH && j == 0) { printf("%c", PADDLE); + } else if (i == ball.y && j == ball.x) { + printf("%c", BALL); } else { printf(" "); } @@ -77,6 +79,7 @@ int getch(void) { int main(){ int paddle1PositionY = 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) { //Steuerung für Schläger 1