Added controls hint
This commit is contained in:
@@ -75,6 +75,13 @@ local function initMaze(world, mazeWidth, mazeHeight)
|
||||
return walls, grid, entrance, exits
|
||||
end
|
||||
|
||||
local function splitTime(startTime, endTime)
|
||||
local timeDiff = endTime - startTime
|
||||
local minute = math.floor(timeDiff / 60)
|
||||
local second = timeDiff % 60
|
||||
return minute, second
|
||||
end
|
||||
|
||||
function Game.new(core, mazeWidth, mazeHeight)
|
||||
setmetatable(Game, { __index = LoveNode })
|
||||
local self = setmetatable(LoveNode.new(), Game)
|
||||
@@ -147,9 +154,7 @@ function Game:update(dt)
|
||||
self.startTime = self.startTime + (dt / 2)
|
||||
end
|
||||
|
||||
local timeDiff = love.timer.getTime() - self.startTime
|
||||
local minute = math.floor(timeDiff / 60)
|
||||
local second = timeDiff % 60
|
||||
local minute, second = splitTime(self.startTime, love.timer.getTime())
|
||||
self.gameTime = string.format('%d:%02d', minute, second)
|
||||
end
|
||||
|
||||
@@ -184,8 +189,13 @@ function Game:draw()
|
||||
|
||||
-- Draw HUD view
|
||||
|
||||
love.graphics.print('Level ' .. self.level, 8, 8)
|
||||
love.graphics.print(self.gameTime, 8, 24)
|
||||
love.graphics.print('Level ' .. self.level .. ' - ' .. self.gameTime, 8, 8)
|
||||
|
||||
local minutes, seconds = splitTime(self.startTime, love.timer.getTime())
|
||||
if minutes == 0 and seconds < 10 then
|
||||
love.graphics.print('Press E or left mouse button to turn on your light', 8, 24)
|
||||
love.graphics.print('Time moves slower when the light is off', 8, 40)
|
||||
end
|
||||
end
|
||||
|
||||
function Game:exit()
|
||||
|
||||
Reference in New Issue
Block a user