Page 1 of 1
Josefnpat's Splash
Posted: Fri Oct 14, 2011 8:31 pm
by josefnpat
I wanted to try out the LOVEJam, so I spent a few minutes making mine. It's really basic, featuring some of my original artwork (oh god, my avatar???). I'm open to animation suggestions though. I'm planning on pushing this to my github account at some point.
Nevertheless, I'd rather upload the *.love file here instead of linking it to mediafire or anything.
![KSW4I.png](./download/file.php?id=22356&sid=02c20312d092af7d24d16e0b2fa481ca)
- KSW4I.png (66.63 KiB) Viewed 358 times
Re: Josefnpat's Splash
Posted: Fri Oct 14, 2011 9:02 pm
by tentus
Hm. Your animation was really jerky on my copy of 0.7.2, even after I corrected the image to be PO2, so I opened it up. I wasn't a fan of how you did time calculations, so I tried to implement a similar effect using the significantly smoother DT. Attached is what I came up with (there's a speed variable you can used to control how fast things happen).
Have you considered decoupling the foreground and background, to make the movement more interesting?
Re: Josefnpat's Splash
Posted: Fri Oct 14, 2011 9:06 pm
by Robin
Neato.
josefnpat wrote:Nevertheless, I'd rather upload the *.love file here instead of linking it to mediafire or anything.
That's actually preferred. Having it up on GitHub or something as well is good too.
Re: Josefnpat's Splash
Posted: Fri Oct 14, 2011 10:23 pm
by josefnpat
tentus wrote:Hm. Your animation was really jerky on my copy of 0.7.2, even after I corrected the image to be PO2, so I opened it up. I wasn't a fan of how you did time calculations, so I tried to implement a similar effect using the significantly smoother DT. Attached is what I came up with (there's a speed variable you can used to control how fast things happen).
Have you considered decoupling the foreground and background, to make the movement more interesting?
Thanks, I'm having issues with jerkyness in other games too. Need to better understand love and the drawing patters, thanks for the help! As for decoupling, I think that'd be spiffy. I'll see what I can do.
Robin wrote:Neato.
josefnpat wrote:Nevertheless, I'd rather upload the *.love file here instead of linking it to mediafire or anything.
That's actually preferred. Having it up on GitHub or something as well is good too.
I plan on pushing it up to GitHub at some point
![Smile :)](./images/smilies/ms-smile.png)
Thanks mate.
Re: Josefnpat's Splash
Posted: Sat Oct 15, 2011 4:21 am
by tentus
josefnpat wrote:
Thanks, I'm having issues with jerkyness in other games too. Need to better understand love and the drawing patters, thanks for the help! As for decoupling, I think that'd be spiffy. I'll see what I can do.
The big thing to keep in mind is 1 dt == 1 second. So, if we want something to take 8 seconds, add dt to a variable until it equals 8.
Code: Select all
time = time + dt
if time >= 8 then
doStuff()
end
If we want to move something (lets say we want to increase the y position of an image by 200 pixels over 1 second), we take the current position and add dt times 200.
It gets a little trickier when neither side equals 1, but it's still simple math. If we want to move an image 1000 pixels over 4 seconds, then this would be our code:
Because 1000 pixels divided by 5 seconds equals 250 pixels per second.
I hope that helps, dt is a bit of an alien concept at first, but once you learn how to use it you never go back.
Re: Josefnpat's Splash
Posted: Mon Oct 17, 2011 6:41 pm
by josefnpat
tentus wrote:josefnpat wrote:
Thanks, I'm having issues with jerkyness in other games too. Need to better understand love and the drawing patters, thanks for the help! As for decoupling, I think that'd be spiffy. I'll see what I can do.
The big thing to keep in mind is 1 dt == 1 second. So, if we want something to take 8 seconds, add dt to a variable until it equals 8.
Code: Select all
time = time + dt
if time >= 8 then
doStuff()
end
If we want to move something (lets say we want to increase the y position of an image by 200 pixels over 1 second), we take the current position and add dt times 200.
It gets a little trickier when neither side equals 1, but it's still simple math. If we want to move an image 1000 pixels over 4 seconds, then this would be our code:
Because 1000 pixels divided by 5 seconds equals 250 pixels per second.
I hope that helps, dt is a bit of an alien concept at first, but once you learn how to use it you never go back.
Well, dt isn't so alien to me, it's just that I'm depending on the socket.http for the get time to produce a dt, instead of using the one from the framebuffer. I see the error in my ways, thank you so much.
Re: Josefnpat's Splash
Posted: Mon Oct 17, 2011 9:18 pm
by kraftman
josefnpat wrote:
Well, dt isn't so alien to me, it's just that I'm depending on the socket.http for the get time to produce a dt, instead of using the one from the framebuffer. I see the error in my ways, thank you so much.
I was so confused by this that i had to take a look at your code.
Using luasocket for timing is not a great idea, there is either
love.timer, or the
love.update callback which is passed dt (the time in seconds between the last frame and this one) every time it is called.
for example:
Code: Select all
x = 5
function love.update(dt)
x = x + dt*100
end