From d5db4bb843050485d4c31875f744bf48d2f697bc Mon Sep 17 00:00:00 2001 From: fdai7103 Date: Wed, 8 Feb 2023 19:04:10 +0100 Subject: [PATCH] =?UTF-8?q?checkballposition:Weitere=20bed.,feldgr=C3=B6ss?= =?UTF-8?q?e=20global?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/Paper-Bin.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/Paper-Bin.c b/src/Paper-Bin.c index 560b118..e2a2adf 100644 --- a/src/Paper-Bin.c +++ b/src/Paper-Bin.c @@ -9,6 +9,9 @@ char field[23][29]; int Ballx = -1; int Bally = 27; +int fieldWidth = 25; +int fieldHeigth = 30; + void buildBin(int width, int heigth){ field[width][heigth] = 'V'; field[width+1][heigth+1] = '\\'; @@ -96,9 +99,6 @@ void getStartPosition() void clearField() { - int fieldWidth = 25; - int fieldHeigth = 30; - for (int i = 0; i <= fieldWidth; i++) { for (int j = 0; j <= fieldHeigth; j++) @@ -132,4 +132,8 @@ int checkBallPosition() { return 1; } + else if (BinY > Bally || field[Ballx][Bally - 1] == '_' || Ballx > fieldWidth || Ballx < 0) + { + return 2; + } }