Skip to content
Snippets Groups Projects
Commit a7a9947f authored by ERKEN EFE's avatar ERKEN EFE
Browse files

:sparkles: NEW: Add core game functionality

The game is at a working state with a CLI
parent 509e4603
No related merge requests found
#include <stdio.h> #include <stdio.h>
#include <stdlib.h>
#include <stdbool.h> #include <stdbool.h>
#include "grid.h" #include "grid.h"
#include "player.h"
int main(void) int main()
{ {
grid *level = init_level("levels/level1.txt");
char entry = '\0';
bool run = true; bool run = true;
while (run) while (run)
{ {
char entry = fgetc(stdin); printf("\nAppuyez sur \"q\" pour quitter\n");
printf("Appuyez sur \"h, j, k, l\" pour vous déplacer\n\n");
display(level);
printf("Votre choix : ");
scanf(" %c", &entry);
switch (entry) switch (entry)
{ {
case 'q': case 'q':
{
run = false; run = false;
break; break;
} case 'h':
case 'j':
case 'k':
case 'l':
move_player(level, entry);
break;
default:
printf("---> Cette touche n'a pas de fonctionnalité\n");
} }
} }
free_level(level);
return EXIT_SUCCESS;
} }
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment