Browse Source

Hinzufügen Schlägel 2

remotes/origin/branchJulia
fdai8040 11 months ago
parent
commit
2e38b367d8
  1. 11
      src/main/c/Pong/game.c

11
src/main/c/Pong/game.c

@ -24,6 +24,7 @@ void drawField(int paddle1PositionY, int paddle2PositionY) {
}
}
int main(){
int paddle1PositionY = HEIGHT / 2 - PADDLE_LENGTH / 2;
int paddle2PositionY = HEIGHT / 2 - PADDLE_LENGTH / 2;
@ -39,7 +40,15 @@ int main(){
}
}
// Hier Steuerung für Schläger 2 noch reinschreiben
//Steuerung für Schläger 2
if (kbhit()){
char input = getch();
if (input == 'i' && paddle2PositionY > 1) {
paddle2PositionY--;
} else if (input == 'k' && paddle2PositionY < HEIGHT - PADDLE_LENGTH - 1){
paddle2PositionY++;
}
}
draw Field(paddle1PositionY, paddle2PositionY);

Loading…
Cancel
Save