Browse Source

refactoring: Kommentare geschrieben

main
David PC Saiz 2 years ago
parent
commit
ddcf9bafcf
  1. 4
      src/Paper-Bin.c

4
src/Paper-Bin.c

@ -294,13 +294,15 @@ void addScoreboard()
fprintf(fp, "%s %d\n", name, scorePoints); fprintf(fp, "%s %d\n", name, scorePoints);
fclose(fp); fclose(fp);
} }
//Checkt Position vom Ball
int checkBallPosition() int checkBallPosition()
{ {
//Bei eineme Tor gibt es eine 1 zurück
if (binY + 2 == ballY && (ballX == binX || ballX == binX + 1 || ballX == binX - 1)) if (binY + 2 == ballY && (ballX == binX || ballX == binX + 1 || ballX == binX - 1))
{ {
return 1; return 1;
} }
//Wenn der Ball daneben fliegt gibt es eine 2 zurück
else if (binY + 1 >= ballY || field[ballX][ballY - 1] == '_' || ballX >= fieldWidth || ballX <= 0) else if (binY + 1 >= ballY || field[ballX][ballY - 1] == '_' || ballX >= fieldWidth || ballX <= 0)
{ {
return 2; return 2;

Loading…
Cancel
Save