diff options
Diffstat (limited to 'menu.lua')
-rw-r--r-- | menu.lua | 14 |
1 files changed, 10 insertions, 4 deletions
@@ -16,7 +16,7 @@ Menu = { portrait_sprite = nil, portrait_sheet = require "portraits", scale = 4, - countdown = 3 + countdown = 6 } -- Constructor of `Menu` @@ -39,7 +39,7 @@ function Menu:newSelector() local w, h = love.graphics.getWidth()/self.scale, love.graphics.getHeight()/self.scale local n = #self.selectors - 1 table.insert(self.selectors, selector) - local x = (w-79)/2+n*38 + local x = (w-76)/2+n*44 local y = h/2-16 selector:setPosition(x, y) end @@ -52,7 +52,13 @@ function Menu:draw() for _,selector in pairs(self.selected) do selector:draw() end - love.graphics.print(self.countdown,2,2,0,self.scale,self.scale) + local countdown, _ = math.modf(self.countdown) + local w, h = love.graphics.getWidth()/self.scale, love.graphics.getHeight()/self.scale + if self.countdown < 6 then + love.graphics.setFont(Bold) + love.graphics.print(countdown,(w/2-6.5)*self.scale,(h/2+20)*self.scale,0,2,2) + love.graphics.setFont(Font) + end end function Menu:update(dt) @@ -67,7 +73,7 @@ function Menu:update(dt) if state then self.countdown = self.countdown - dt else - self.countdown = 3 + self.countdown = 6 end if state and self.countdown < 0 then self:startGame() |