Browse Source

refactoring: Übersicht: loadLevel

main
fdai7103 2 years ago
parent
commit
eb514527e4
  1. 18
      src/Paper-Bin.c

18
src/Paper-Bin.c

@ -54,10 +54,10 @@ void buildBin(int width, int heigth)
void loadLevel(int lvlnum) void loadLevel(int lvlnum)
{ {
clearField(); clearField();
ballX = -1;
ballY = 27;
ballX = -1;
ballY = 27;
int tmpX,tmpY;
int tmpX,tmpY;
switch (lvlnum) switch (lvlnum)
{ {
@ -65,6 +65,7 @@ void loadLevel(int lvlnum)
binX = 12; binX = 12;
binY = 10; binY = 10;
break; break;
case(2): case(2):
case(3): case(3):
case(4): case(4):
@ -82,21 +83,22 @@ void loadLevel(int lvlnum)
} }
binX = tmpX; binX = tmpX;
binY = tmpY; binY = tmpY;
break; break;
case(7): case(7):
binX = 2; binX = 2;
binY = 7; binY = 7;
windForce = -2; windForce = -2;
printf("Ein Sturm zieht auf!\n"); printf("Ein Sturm zieht auf!\n");
sleep(3); sleep(3);
break; break;
case(8): case(8):
binX = 19; binX = 19;
binY = 7; binY = 7;
windForce = 1; windForce = 1;
break; break;
case(9): case(9):
windForce = -1; windForce = -1;
binX = 8; binX = 8;
@ -105,6 +107,7 @@ void loadLevel(int lvlnum)
wallLength = 4; wallLength = 4;
wallY = 17; wallY = 17;
break; break;
case(10): case(10):
windForce = 2; windForce = 2;
binX = 16; binX = 16;
@ -112,19 +115,20 @@ void loadLevel(int lvlnum)
wallX = 11; wallX = 11;
wallLength = 4; wallLength = 4;
wallY = 19; wallY = 19;
break; break;
case(11): case(11):
system("clear"); system("clear");
Generatefield(); Generatefield();
addScoreboard(); addScoreboard();
sortScoreboard(); sortScoreboard();
exit(0); exit(0);
break; break;
default: default:
exit(0); exit(0);
} }
getStartPosition(); getStartPosition();
printf("Der Ball wird geworfen!!!"); printf("Der Ball wird geworfen!!!");
sleep(1); sleep(1);

Loading…
Cancel
Save