Page 2 of 3
Re: Delay on a loop?
Posted: Fri Feb 28, 2014 6:44 am
by micha
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.
Re: Delay on a loop?
Posted: Sun Mar 02, 2014 5:28 am
by Findo777
Cool!
And for the part of source code....?
When I click the download, it shows only the game.
How would I "zip" it?
Re: Delay on a loop?
Posted: Sun Mar 02, 2014 8:58 am
by Robin
Rename delay.love to delay.zip. Or drag the .love file on the archiving application you use, that'll probably work too.
Re: Delay on a loop?
Posted: Sun Mar 02, 2014 11:59 am
by Jeeper
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?
Posted: Sun Mar 02, 2014 9:20 pm
by Findo777
How do I rename it?
:p
I try right clicking, but it doesn't show rename as an option.
Re: Delay on a loop?
Posted: Mon Mar 03, 2014 12:44 am
by Findo777
Ok, I see the code.
Thank you, I understand now, but,
how could I make it less than 1 second?
like... .5?
Re: Delay on a loop?
Posted: Mon Mar 03, 2014 3:03 pm
by Jeeper
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?
Posted: Tue Mar 04, 2014 12:32 am
by Findo777
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?
Posted: Tue Mar 04, 2014 7:07 am
by Wojak
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
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 time
Re: Delay on a loop?
Posted: Tue Mar 04, 2014 11:31 am
by Jeeper
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
Nope, dt stands for Delta Time, the time between each frame.