Example I created some recangles using
Code: Select all
world = {}
function CreateObject(x, y, w, h)
return {position = vector2.new(x, y), size = vector2.new(w, h)}
end
function LoadWorld()
world[1] = CreateObject(0,0,1400,200) --ceiling
world[2] = CreateObject(0,800-200,1400,200) --floor
end
function DrawWorld(world)
for i = 1, table.getn(world), 1 do
love.graphics.rectangle("fill", world[i].position.x, world[i].position.y, world[i].size.x, world[i].size.y)
end
end
Code: Select all
countdown = 5
function Countdown(dt)
if countdown > 0 then
countdown = countdown - dt
end
if countdown == 0 then
countdown = countdown
end
end
function Drawtimer()
love.graphics.setColor(0,0,0)
love.graphics.setDefaultFilter("nearest", "nearest")
local timerfont = love.graphics.newFont("edosz.ttf", 25)
love.graphics.setFont(timerfont)
local round = string.format("%.1f", countdown)
love.graphics.print("time: " .. round, 60, 300)
love.graphics.setColor(1,1,1)
end