I tried love.timer.sleep, the game just crashed.
Tried googling it, I saw the wiki page.
I got this code that increases the variable every one second:
Code: Select all
x = 0
function love.update(dt)
x = x + dt
end
Code: Select all
function love.load()
logo = love.graphics.newImage("logo.png")
medium = love.graphics.newFont(45)
num = 0
end
function love.update(dt)
if love.keyboard.isDown("up") then
num = num + 1
end
if love.keyboard.isDown("down") and num > 0 then
num = num - 1
end
end
function love.draw()
love.graphics.print(num, 200, 200)
love.graphics.setFont(medium)
end
What I need it to do is have some sort of sleep() so that it waits a certain amount of time before increasing the number again.
Sorry if this is kind of a dumb question in general, I'm new to love2d.