From 2478091ce07599524d2eafcc841b49b655bf101e Mon Sep 17 00:00:00 2001 From: fdai7037 Date: Wed, 8 Feb 2023 23:29:57 +0100 Subject: [PATCH] =?UTF-8?q?refactoring:=20Die=20Einr=C3=BCckung=20der=20Ze?= =?UTF-8?q?ilen=20bei=20den=20Levels=20korrigiert?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/Paper-Bin.c | 138 ++++++++++++++++++++++++------------------------ 1 file changed, 69 insertions(+), 69 deletions(-) diff --git a/src/Paper-Bin.c b/src/Paper-Bin.c index dac0cdc..ce53caf 100644 --- a/src/Paper-Bin.c +++ b/src/Paper-Bin.c @@ -66,76 +66,76 @@ void loadLevel(int lvlnum) switch (lvlnum) { - //Level 1 nur der Korb wird Erstellt - case(1): - binX = 12; - binY = 10; - break; - - //Level 2-6 Zufällige positionen für den Korb hinzugefügt - case(2): - case(3): - case(4): - case(5): - case(6): - tmpX = rand() % 19; + //Level 1 nur der Korb wird Erstellt + case(1): + binX = 12; + binY = 10; + break; + + //Level 2-6 Zufällige positionen für den Korb hinzugefügt + case(2): + case(3): + case(4): + case(5): + case(6): + tmpX = rand() % 19; + tmpY = rand() % 12; + while (5 >tmpX) + { + tmpX = rand()%19; + } + while (5 > tmpY) + { tmpY = rand() % 12; - while (5 >tmpX) - { - tmpX = rand()%19; - } - while (5 > tmpY) - { - tmpY = rand() % 12; - } - binX = tmpX; - binY = tmpY; - break; - - //Wind wird dem Level hinzugefügt - case(7): - binX = 2; - binY = 7; - windForce = -2; - printf("Ein Sturm zieht auf!\n"); - sleep(3); - break; - - case(8): - binX = 19; - binY = 7; - windForce = 1; - break; - - //Wände erscheinen jetzt in den Leveln - case(9): - windForce = -1; - binX = 8; - binY = 9; - wallX = 7; - wallLength = 4; - wallY = 17; - break; - - case(10): - windForce = 2; - binX = 16; - binY = 12; - wallX = 11; - wallLength = 4; - wallY = 19; - break; - //Abschluss aller Level - case(11): - system("clear"); - generateField(); - addScoreboard(); - sortScoreboard(); - exit(0); - break; - - default: - exit(0); + } + binX = tmpX; + binY = tmpY; + break; + + //Wind wird dem Level hinzugefügt + case(7): + binX = 2; + binY = 7; + windForce = -2; + printf("Ein Sturm zieht auf!\n"); + sleep(3); + break; + + case(8): + binX = 19; + binY = 7; + windForce = 1; + break; + + //Wände erscheinen jetzt in den Leveln + case(9): + windForce = -1; + binX = 8; + binY = 9; + wallX = 7; + wallLength = 4; + wallY = 17; + break; + + case(10): + windForce = 2; + binX = 16; + binY = 12; + wallX = 11; + wallLength = 4; + wallY = 19; + break; + //Abschluss aller Level + case(11): + system("clear"); + generateField(); + addScoreboard(); + sortScoreboard(); + exit(0); + break; + + default: + exit(0); } getStartPosition();