guys, i need to put time in my game, but i really don`t know how. Can you help me??
it`s just to pass while the game is running and when the user win then the time stop, how can i do this????
HELP ME PLEASEEE
how to put a time
Forum rules
Before you make a thread asking for help, read this.
Before you make a thread asking for help, read this.
Re: how to put a time
When love calls your love.update function, it passes in an argument called dt, aka delta time, which is the time elapsed since the last update (in seconds, probably a very small number like 0.01). You can use this for timing. The following is a simple example of a timer, just counting the time since the program started and printing it out every frame.
Code: Select all
local timer = 0
function love.update(dt)
timer = timer + dt
print(timer)
end
-
- Citizen
- Posts: 86
- Joined: Mon Jul 17, 2017 2:07 pm
Re: how to put a time
or
Code: Select all
--save start time
start_time = love.timer.getTime()
--to get the time since start
time_elapsed = love.timer.getTime() - start_time
Who is online
Users browsing this forum: Ahrefs [Bot], Bing [Bot], Google [Bot] and 4 guests