diff options
author | Sven Gothel <[email protected]> | 2022-03-30 01:58:42 +0200 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2022-03-30 01:58:42 +0200 |
commit | d8feca4496ea485fd48d57e8464b33a1ed3ed85b (patch) | |
tree | cf1042b61e21a6f901c21fa1b35fea20b7d86d0e /src | |
parent | a9080bfe4c30a5e7d003d0760fd08e4b5e13c7a8 (diff) |
Freeze pacman only for 3 frames after eating power pellet
Diffstat (limited to 'src')
-rw-r--r-- | src/pacman.cpp | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/src/pacman.cpp b/src/pacman.cpp index 61083e9..ebac6ea 100644 --- a/src/pacman.cpp +++ b/src/pacman.cpp @@ -81,6 +81,7 @@ pacman_t::pacman_t(SDL_Renderer* rend, const float fields_per_sec_total_) noexce score_( 0 ), freeze_score( -1 ), freeze_box_(-1, -1, -1, -1), + freeze_frame_count(0), atex_left( "L", rend, ms_per_tex, global_tex->all_images(), 0, 28, 13, 13, { { 0*13, 0 }, { 1*13, 0 } }), atex_right("R", rend, ms_per_tex, global_tex->all_images(), 0, 28, 13, 13, { { 2*13, 0 }, { 3*13, 0 } }), atex_up( "U", rend, ms_per_tex, global_tex->all_images(), 0, 28, 13, 13, { { 4*13, 0 }, { 5*13, 0 } }), @@ -261,6 +262,9 @@ bool pacman_t::tick() noexcept { set_mode( mode_t::HOME ); } return true; + } else if( 0 < freeze_frame_count ) { + --freeze_frame_count; + return true; } // NORMAL and POWERED @@ -310,6 +314,7 @@ bool pacman_t::tick() noexcept { set_mode( mode_t::POWERED ); audio_samples[ ::number( audio_clip_t::MUNCH ) ]->play(0); next_empty_field_frame_cntr.load( keyframei_.frames_per_field() + 1 ); + freeze_frame_count = 3; } } else if( tile_t::EMPTY == tile ) { if( next_empty_field_frame_cntr.count_down() ) { |