Sure. Here you go.
I added some comments to the code. If you have any questions feel free to ask. To view the source code, rename the .love file to .zip and unzip it.
Delay on a loop?
Re: Delay on a loop?
- Attachments
-
- delay.love
- (385 Bytes) Downloaded 223 times
Check out my blog on gamedev
Re: Delay on a loop?
Cool!
And for the part of source code....?
When I click the download, it shows only the game.
How would I "zip" it?
And for the part of source code....?
When I click the download, it shows only the game.
How would I "zip" it?
- Robin
- The Omniscient
- Posts: 6506
- Joined: Fri Feb 20, 2009 4:29 pm
- Location: The Netherlands
- Contact:
Re: Delay on a loop?
Rename delay.love to delay.zip. Or drag the .love file on the archiving application you use, that'll probably work too.
Help us help you: attach a .love.
Re: Delay on a loop?
In other words, a .love is just a .zip, but it has been renamed so that your operating system knows that it is supposed to open this file with löve2d by default.
Re: Delay on a loop?
How do I rename it?
:p
I try right clicking, but it doesn't show rename as an option.
:p
I try right clicking, but it doesn't show rename as an option.
Re: Delay on a loop?
Ok, I see the code.
Thank you, I understand now, but,
how could I make it less than 1 second?
like... .5?
Thank you, I understand now, but,
how could I make it less than 1 second?
like... .5?
Re: Delay on a loop?
Findo777 wrote:Ok, I see the code.
Thank you, I understand now, but,
how could I make it less than 1 second?
like... .5?
Code: Select all
function love.update(dt)
updateStuff(dt)
end
Local timer = 0.5
function updateStuff(dt)
timer = timer - dt
if timer < 0 then
--Do stuff
end
end
Re: Delay on a loop?
how would that change it?
isn't dt one every second?
So..................
0.5 - 1 = -0.5
1 - 1 = 0
0 is the same or bigger in each one
isn't dt one every second?
So..................
0.5 - 1 = -0.5
1 - 1 = 0
0 is the same or bigger in each one
Re: Delay on a loop?
dt is 1/FPS so if you running the game at 1 frame per second dt will be 1 but if you running it with 60 it will be 0,017 and love.update is not called once per second but once per frame, that is why dt it is the best way for measuring timeFindo777 wrote:how would that change it?
isn't dt one every second?
So..................
0.5 - 1 = -0.5
1 - 1 = 0
0 is the same or bigger in each one
Re: Delay on a loop?
Nope, dt stands for Delta Time, the time between each frame.Findo777 wrote:how would that change it?
isn't dt one every second?
So..................
0.5 - 1 = -0.5
1 - 1 = 0
0 is the same or bigger in each one
Who is online
Users browsing this forum: Ahrefs [Bot], Bing [Bot] and 2 guests