Timer

Questions about the LÖVE API, installing LÖVE and other support related questions go here.
Forum rules
Before you make a thread asking for help, read this.
Post Reply
User avatar
Cauan
Prole
Posts: 22
Joined: Thu Mar 09, 2023 5:58 pm

Timer

Post by Cauan »

Hi there!
I created an timer Library
Any error tell me here
timer.love
Timer Library
(828 Bytes) Downloaded 36 times
I'm me, and you are you
User avatar
darkfrei
Party member
Posts: 1186
Joined: Sat Feb 08, 2020 11:09 pm

Re: Timer

Post by darkfrei »

Please explain how to use it and when I need it to use?
:awesome: in Lua we Löve
:awesome: Platformer Guide
:awesome: freebies
User avatar
Cauan
Prole
Posts: 22
Joined: Thu Mar 09, 2023 5:58 pm

Re: Timer

Post by Cauan »

Use it is simple:

Code: Select all

timer = require 'timer'
show = true
n = timer.newTimer(timer.countdown, 10, function() show = false end) -- type, time, callback
--type for countdown is "1" or timer.countdown and countup is timer.countup or "2" (countup haven't an callback, use getTime() to do that)

function love.update(dt)
n.update(dt) --dt is needs
end

function love.draw()
if show then
love.graphics.print(n.getTime(), 90, 90)
end
end
This is a simple code to how to use that, and removing text when is not more need

The all callbacks is:
newTimer returns = {
update
Stop
Resume
getTime
setTime
reset
}
I'm me, and you are you
Post Reply

Who is online

Users browsing this forum: Ahrefs [Bot], Bing [Bot] and 3 guests