Skip to content

Commit

Permalink
Added starting info before each game, pacman does not move after respawn
Browse files Browse the repository at this point in the history
  • Loading branch information
Lukas Nejezchleb committed May 5, 2021
1 parent 5e23fbf commit bf97cd1
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
1 change: 1 addition & 0 deletions config.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
#define SCARE_REGIME_DURATION 300 //in game ticks
#define GAME_SPEED 2 //ammount of ticks in one frame

#define GAME_START_TERMINAL "Move pacman with %c%c%c%c keys, to pause press %c, to quit game press %c.\n"
#define GAME_END_TERMINAL "Game has ended with pacman getting score %d and having %d lives\n"

//led colors
Expand Down
4 changes: 4 additions & 0 deletions game.c
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ int run_game(game_init_data_t *game_data, peripherals_data_t *peripherals)
{
ghost[i] = create_ghost(map, i);
}
printf(GAME_START_TERMINAL, KEY_UP, KEY_DWN, KEY_LEFT, KEY_RIGHT, PAUSE_KEY, KEY_QUIT);
// actual game
char read = ' ';
bool coins_to_eat = true;
Expand Down Expand Up @@ -155,6 +156,9 @@ bool game_tick(map_data *map, pacman_type *pacman, ghost_type *ghost_arr, int nu
{
ghost_arr[j] = create_ghost(map, j);
}
pthread_mutex_lock(&mtx);
read_thread_data.last_read = ' ';
pthread_mutex_unlock(&mtx);
ret = true;
break;
}
Expand Down

0 comments on commit bf97cd1

Please sign in to comment.