feat: added standard day cycle, added mysterious man screen, added work screen, added new decisions, placed minigames in their proposed space
Some checks failed
ci/woodpecker/push/woodpecker Pipeline failed
ci/woodpecker/pr/woodpecker Pipeline failed

This commit is contained in:
Zoltan Timar
2026-03-09 16:20:50 +01:00
parent 53a3f37c8e
commit 732c8b34c8
13 changed files with 205 additions and 18 deletions

View File

@@ -39,7 +39,8 @@ function MinigameDDRWindow.init_context()
pattern_index = 1,
use_pattern = false,
return_window = nil,
win_timer = 0
win_timer = 0,
on_win = nil
}
end
@@ -162,8 +163,12 @@ function MinigameDDRWindow.update()
mg.win_timer = mg.win_timer - 1
if mg.win_timer == 0 then
Meter.on_minigame_complete()
Meter.show()
Window.set_current(mg.return_window)
if mg.on_win then
mg.on_win()
else
Meter.show()
Window.set_current(mg.return_window)
end
end
return
end

View File

@@ -21,7 +21,8 @@ function MinigameButtonMashWindow.init_context()
focus_center_x = nil,
focus_center_y = nil,
focus_initial_radius = 0,
win_timer = 0
win_timer = 0,
on_win = nil
}
end
@@ -63,9 +64,13 @@ function MinigameButtonMashWindow.update()
mg.win_timer = mg.win_timer - 1
if mg.win_timer == 0 then
Meter.on_minigame_complete()
Meter.show()
if mg.focus_center_x then Focus.stop() end
Window.set_current(mg.return_window)
if mg.on_win then
mg.on_win()
else
Meter.show()
Window.set_current(mg.return_window)
end
end
return
end

View File

@@ -30,7 +30,8 @@ function MinigameRhythmWindow.init_context()
focus_center_x = nil,
focus_center_y = nil,
focus_initial_radius = 0,
win_timer = 0
win_timer = 0,
on_win = nil
}
end
@@ -72,9 +73,13 @@ function MinigameRhythmWindow.update()
mg.win_timer = mg.win_timer - 1
if mg.win_timer == 0 then
Meter.on_minigame_complete()
Meter.show()
if mg.focus_center_x then Focus.stop() end
Window.set_current(mg.return_window)
if mg.on_win then
mg.on_win()
else
Meter.show()
Window.set_current(mg.return_window)
end
end
return
end

View File

@@ -0,0 +1,132 @@
--- @section MysteriousManWindow
local STATE_TEXT = "text"
local STATE_DAY = "day"
local STATE_CHOICE = "choice"
local state = STATE_TEXT
local text_y = Config.screen.height
local text_speed = 0.4
local day_timer = 0
local day_display_frames = 120
local selected_choice = 1
local choices = {
{
label = "Wake Up",
},
{
label = "Stay in Bed",
},
}
local text = [[
Misterious man appears
during your sleep.
He says nothing.
He doesn't need to.
He says nothing.
]]
--- Sets the scrolling text content.
--- @within MysteriousManWindow
--- @param new_text string The text to display.
function MysteriousManWindow.set_text(new_text)
text = new_text
end
--- Starts the mysterious man window.
--- @within MysteriousManWindow
function MysteriousManWindow.start()
state = STATE_TEXT
text_y = Config.screen.height
day_timer = 0
selected_choice = 1
Meter.hide()
Window.set_current("mysterious_man")
end
local function wake_up()
Util.go_to_screen_by_id("home")
MinigameButtonMashWindow.start("game", {
focus_center_x = Config.screen.width / 2,
focus_center_y = Config.screen.height / 2,
focus_initial_radius = 0,
on_win = function()
Meter.show()
Window.set_current("game")
end,
})
end
local function stay_in_bed()
Day.increase()
state = STATE_DAY
day_timer = day_display_frames
end
--- Updates the mysterious man window logic.
--- @within MysteriousManWindow
function MysteriousManWindow.update()
if state == STATE_TEXT then
text_y = text_y - text_speed
local lines = 1
for _ in string.gmatch(text, "\n") do
lines = lines + 1
end
if text_y < -lines * 8 then
state = STATE_DAY
day_timer = day_display_frames
end
if Input.select() then
state = STATE_DAY
day_timer = day_display_frames
end
elseif state == STATE_DAY then
day_timer = day_timer - 1
if day_timer <= 0 or Input.select() then
state = STATE_CHOICE
selected_choice = 1
end
elseif state == STATE_CHOICE then
selected_choice = UI.update_menu(choices, selected_choice)
if Input.select() then
Audio.sfx_select()
if selected_choice == 1 then
wake_up()
else
stay_in_bed()
end
end
end
end
--- Draws the mysterious man window.
--- @within MysteriousManWindow
function MysteriousManWindow.draw()
rect(0, 0, Config.screen.width, Config.screen.height, Config.colors.black)
if state == STATE_TEXT then
local x = (Config.screen.width - 132) / 2
Print.text(text, x, text_y, Config.colors.light_grey)
elseif state == STATE_DAY then
local day_text = "Day " .. Context.day_count
Print.text_center(
day_text,
Config.screen.width / 2,
Config.screen.height / 2 - 3,
Config.colors.white
)
elseif state == STATE_CHOICE then
local menu_x = (Config.screen.width - 60) / 2
local menu_y = (Config.screen.height - 20) / 2
UI.draw_menu(choices, selected_choice, menu_x, menu_y)
end
end

View File

@@ -27,3 +27,6 @@ Window.register("minigame_rhythm", MinigameRhythmWindow)
MinigameDDRWindow = {}
Window.register("minigame_ddr", MinigameDDRWindow)
MysteriousManWindow = {}
Window.register("mysterious_man", MysteriousManWindow)