Update 'a3/game.c'

This commit is contained in:
Anzhelika Nikolaieva 2023-04-19 15:48:58 +00:00
parent 32bb3429fc
commit 9e876b864e

View File

@ -29,6 +29,21 @@ int game_event(struct event* event,void* game){
set_message(msg,10,0); set_message(msg,10,0);
if ( event->type == EVENT_ESC){ if ( event->type == EVENT_ESC){
// Non zero means finish the loop and stop the game. // Non zero means finish the loop and stop the game.
switch (event->key) {
case KEY_LEFT:
game->catx--;
break;
case KEY_RIGHT:
game->catx++;
break;
case KEY_UP:
game->caty--;
break;
case KEY_DOWN:
game->caty++;
break;
}
return 1; return 1;
} }
// Read game variable and update the eventstate // Read game variable and update the eventstate