From bb2cfdd6affcacebc5b21ebcd0e8759dce113f69 Mon Sep 17 00:00:00 2001 From: Nyeogmi Date: Sun, 11 Feb 2024 20:40:30 -0800 Subject: [PATCH] Add QOL features --- main.p8 | 1 - music_manager.lua | 4 ++++ state_gameround.lua | 18 ++++++++++++++---- state_wonround.lua | 9 +++++++++ 4 files changed, 27 insertions(+), 5 deletions(-) diff --git a/main.p8 b/main.p8 index 2f199ed..ec07981 100644 --- a/main.p8 +++ b/main.p8 @@ -34,7 +34,6 @@ __lua__ #include text.lua #include watcher.lua #include main.lua - --[[ srand(2) for i=1,10 do diff --git a/music_manager.lua b/music_manager.lua index 07a036a..4da6155 100644 --- a/music_manager.lua +++ b/music_manager.lua @@ -7,4 +7,8 @@ function music_manager:update() local should_be_playing = completion_tracker:get_music_preference() if (is_playing and not should_be_playing) music(-1,500) if (not is_playing and should_be_playing) music(0) + + local label,pref="start music",true + if (should_be_playing) label,pref="stop music",false + menuitem(1,label,function() completion_tracker:set_music_preference(pref) end) end \ No newline at end of file diff --git a/state_gameround.lua b/state_gameround.lua index 53b2b8c..b8b7fa0 100644 --- a/state_gameround.lua +++ b/state_gameround.lua @@ -4,11 +4,21 @@ function state_gameround:init(watcher,ruleset) self.outcome=nil self.restart_frames=0 end -function state_gameround:enter() end -function state_gameround:exit() end +function state_gameround:enter() self:add_menu() end +function state_gameround:exit() self:remove_menu() end + +function state_gameround:reenter() self:add_menu() end +function state_gameround:suspend() self:remove_menu() end + +function state_gameround:add_menu() + menuitem(4,"restart",function() self.outcome="restart" self.done=true end) + menuitem(5,"go to menu",function() self.outcome="menu" self.done=true end) +end +function state_gameround:remove_menu() + menuitem(4) + menuitem(5) +end -function state_gameround:reenter() end -function state_gameround:suspend() end function state_gameround:update() self.board:update() diff --git a/state_wonround.lua b/state_wonround.lua index 8aeffe1..3025f02 100644 --- a/state_wonround.lua +++ b/state_wonround.lua @@ -7,9 +7,12 @@ function state_wonround:init(board) self.card=self.board:get_endgame_card() self.verse_id,self.verse_name,self.verse=liturgy:suggest_verse(self.board.ruleset,self.card) end +seen_tip_this_session=false function state_wonround:enter() completion_tracker:mark_seen(self.verse_id) completion_tracker:advance_completion_level(self.board:get_completion_level()) + self.has_tip = not seen_tip_this_session + seen_tip_this_session=true end function state_wonround:exit(new_top) end @@ -61,4 +64,10 @@ function state_wonround:draw() line(oldx,y,oldx+oldw-2,y,15) print("next",57,y+2,15) print("(🅾️)",57,y+8,15) + + if self.has_tip then + local tip="tip: hold ❎ to restart" + local w=measure_text(tip) + print(tip,64-w\2,122,15) + end end \ No newline at end of file