Skip to content
This repository has been archived by the owner on May 6, 2024. It is now read-only.

Commit

Permalink
Level timers
Browse files Browse the repository at this point in the history
When the timer gets to 0, the level is finished.
This value is not saved yet!
  • Loading branch information
jakubg1 committed Dec 30, 2022
1 parent 4bc99e9 commit 81d0861
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions src/Level.lua
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,22 @@ function Level:updateLogic(dt)



-- Time
if self.started and self.time > 0 then
if math.floor(self.time) ~= math.floor(self.time - dt) then
_Debug.console:print("Time: " .. self.time)
end
self.time = self.time - dt
if self.time <= 0 then
self.shooter:empty()
_Game.session:destroyAllSpheres()
self.finish = true
self.wonDelay = _Game.configManager.gameplay.level.wonDelay
end
end



-- Shot spheres, collectibles, floating texts
for i, shotSphere in ipairs(self.shotSpheres) do
shotSphere:update(dt)
Expand Down Expand Up @@ -715,6 +731,7 @@ function Level:reset()
self.dangerSound = nil
self.warningDelay = 0
self.warningDelayMax = nil
self.time = 60

self.pause = false
self.canPause = true
Expand Down

0 comments on commit 81d0861

Please sign in to comment.