From 6d51598c4ea5babe36686c5f3ce1981a15deed8c Mon Sep 17 00:00:00 2001 From: fdai8040 Date: Wed, 31 Jan 2024 15:10:01 +0000 Subject: [PATCH] Implementierung Ball --- src/main/c/Pong/game.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/main/c/Pong/game.c b/src/main/c/Pong/game.c index 11a11b4..c6067ed 100644 --- a/src/main/c/Pong/game.c +++ b/src/main/c/Pong/game.c @@ -7,13 +7,22 @@ #define HEIGHT 20 //Höhe Spielfeld #define PADDLE_LENGTH 4 #define PADDLE '#' +#define BALL 'O' + +//Ballstruktur +typedef struct { + int x; + int y; + int speedX; + int speedY; +} Ball; // Bildschirm löschen nach Veränderung Position void clearScreen() { system("clear"); } -void drawField(int paddle1PositionY, int paddle2PositionY) { +void drawField(int paddle1PositionY, int paddle2PositionY, Ball ball) { clearScreen(); for (int i = 0; i <= HEIGHT; i++){