Compare commits
1 Commits
feature/gl
...
24757e8cca
| Author | SHA1 | Date | |
|---|---|---|---|
| 24757e8cca |
@@ -11,7 +11,6 @@ logic/logic.day.lua
|
||||
logic/logic.timer.lua
|
||||
logic/logic.trigger.lua
|
||||
logic/logic.minigame.lua
|
||||
logic/logic.glitch.lua
|
||||
system/system.ui.lua
|
||||
audio/audio.manager.lua
|
||||
audio/audio.songs.lua
|
||||
|
||||
@@ -2,7 +2,6 @@ Decision.register({
|
||||
id = "go_to_office",
|
||||
label = "Go to Office",
|
||||
handle = function()
|
||||
Glitch.show()
|
||||
Util.go_to_screen_by_id("office")
|
||||
end,
|
||||
})
|
||||
|
||||
@@ -42,11 +42,6 @@ function Context.initial_data()
|
||||
current_situation = nil,
|
||||
},
|
||||
day_count = 1,
|
||||
glitch = {
|
||||
enabled = false,
|
||||
state = "active",
|
||||
timer = 0,
|
||||
},
|
||||
_end = {
|
||||
state = "choice",
|
||||
selection = 1,
|
||||
|
||||
@@ -1,57 +0,0 @@
|
||||
Glitch = {}
|
||||
|
||||
--- Shows the glitch effect.
|
||||
--- @within Glitch
|
||||
function Glitch.show()
|
||||
if Context and Context.glitch then
|
||||
Context.glitch.enabled = true
|
||||
end
|
||||
end
|
||||
|
||||
--- Hides the glitch effect.
|
||||
--- @within Glitch
|
||||
function Glitch.hide()
|
||||
if Context and Context.glitch then
|
||||
Context.glitch.enabled = false
|
||||
end
|
||||
end
|
||||
|
||||
--- Draws the glitch effect if active.
|
||||
--- @within Glitch
|
||||
function Glitch.draw()
|
||||
if not Context or not Context.glitch or not Context.glitch.enabled then return end
|
||||
|
||||
-- Update state timer
|
||||
Context.glitch.timer = Context.glitch.timer - 1
|
||||
if Context.glitch.timer <= 0 then
|
||||
if Context.glitch.state == "active" then
|
||||
Context.glitch.state = "waiting"
|
||||
Context.glitch.timer = math.random(20, 60) -- Time to stay fixed
|
||||
else
|
||||
Context.glitch.state = "active"
|
||||
Context.glitch.timer = math.random(40, 100) -- Time to stay glitchy
|
||||
end
|
||||
end
|
||||
|
||||
-- Draw stripes only when active
|
||||
if Context.glitch.state == "active" then
|
||||
for i = 1, 15 do
|
||||
local rx = math.random(0, Config.screen.width - 1)
|
||||
local ry = math.random(0, Config.screen.height - 1)
|
||||
|
||||
-- Sample color at the random point
|
||||
local color = pix(rx, ry)
|
||||
|
||||
-- Determine random length for the stripe (2-40)
|
||||
local length = math.random(2, 40)
|
||||
|
||||
-- Draw the vertical stripe
|
||||
for sy = 0, length - 1 do
|
||||
local dy = ry + sy
|
||||
if dy < Config.screen.height then
|
||||
pix(rx, dy, color)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -27,6 +27,5 @@ function TIC()
|
||||
if Context.game_in_progress then
|
||||
Meter.draw()
|
||||
Timer.draw()
|
||||
Glitch.draw()
|
||||
end
|
||||
end
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
EndWindow = {}
|
||||
|
||||
--- Draws the end screen window.
|
||||
--- @within EndWindow
|
||||
function EndWindow.draw()
|
||||
|
||||
Reference in New Issue
Block a user