Add QOL features

This commit is contained in:
Pyrex 2024-02-11 20:40:30 -08:00
parent 3b9c61329b
commit bb2cfdd6af
4 changed files with 27 additions and 5 deletions

View File

@ -34,7 +34,6 @@ __lua__
#include text.lua
#include watcher.lua
#include main.lua
--[[
srand(2)
for i=1,10 do

View File

@ -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

View File

@ -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()

View File

@ -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