Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found

Target

Select target project
No results found
Show changes
Commits on Source (3)
No preview for this file type
......@@ -28,10 +28,10 @@ typedef struct Player{
*@return Renvoie une énumération nomée Direction
*/
typedef enum {
UP = 'z',
DOWN = 's',
RIGHT = 'd',
LEFT = 'q',
UP = 'h',
DOWN = 'j',
RIGHT = 'k',
LEFT = 'l',
}Direction;
/**
......
No preview for this file type
......@@ -7,35 +7,36 @@ int main(void)
Grid grid = initialise_grid();
init_level("./levels/level1.txt",&grid);
display(&grid);
printf("'h' = UP, 'j' = DOWN, 'k' = LEFT, 'l' = RIGHT, 'q' = STOP \n");
bool run = true;
while(run){
char entry = fgetc(stdin);
switch(entry)
{
case 'e':
case 'q':
{
run = false;
break;
}
case 'z':
case 'h':
{
move_player(entry,&grid);
display(&grid);
break;
}
case 's':
case 'j':
{
move_player(entry,&grid);
display(&grid);
break;
}
case 'd':
case 'k':
{
move_player(entry,&grid);
display(&grid);
break;
}
case 'q':
case 'l':
{
move_player(entry,&grid);
display(&grid);
......