Josefnpat's Splash

Showcase your libraries, tools and other projects that help your fellow love users.
Post Reply
User avatar
josefnpat
Inner party member
Posts: 955
Joined: Wed Oct 05, 2011 1:36 am
Location: your basement
Contact:

Josefnpat's Splash

Post 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.
josefnpat-splash.love
(262.78 KiB) Downloaded 176 times
KSW4I.png
KSW4I.png (66.63 KiB) Viewed 284 times
Missing Sentinel Software | Twitter

FORCIBLY IGNORED.
<leafo> when in doubt delete all of your code
<bartbes> git rm -r *
<bartbes> git commit -m "Fixed all bugs"
<bartbes> git push
User avatar
tentus
Inner party member
Posts: 1060
Joined: Sun Oct 31, 2010 7:56 pm
Location: Appalachia
Contact:

Re: Josefnpat's Splash

Post 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?
Attachments
jos_2.love
(116.66 KiB) Downloaded 107 times
Kurosuke needs beta testers
User avatar
Robin
The Omniscient
Posts: 6506
Joined: Fri Feb 20, 2009 4:29 pm
Location: The Netherlands
Contact:

Re: Josefnpat's Splash

Post 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.
Help us help you: attach a .love.
User avatar
josefnpat
Inner party member
Posts: 955
Joined: Wed Oct 05, 2011 1:36 am
Location: your basement
Contact:

Re: Josefnpat's Splash

Post 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 :) Thanks mate.
Missing Sentinel Software | Twitter

FORCIBLY IGNORED.
<leafo> when in doubt delete all of your code
<bartbes> git rm -r *
<bartbes> git commit -m "Fixed all bugs"
<bartbes> git push
User avatar
tentus
Inner party member
Posts: 1060
Joined: Sun Oct 31, 2010 7:56 pm
Location: Appalachia
Contact:

Re: Josefnpat's Splash

Post 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.

Code: Select all

y = y + (dt * 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:

Code: Select all

y = y + (dt * 250)
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.
Kurosuke needs beta testers
User avatar
josefnpat
Inner party member
Posts: 955
Joined: Wed Oct 05, 2011 1:36 am
Location: your basement
Contact:

Re: Josefnpat's Splash

Post 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.

Code: Select all

y = y + (dt * 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:

Code: Select all

y = y + (dt * 250)
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.
Missing Sentinel Software | Twitter

FORCIBLY IGNORED.
<leafo> when in doubt delete all of your code
<bartbes> git rm -r *
<bartbes> git commit -m "Fixed all bugs"
<bartbes> git push
User avatar
kraftman
Party member
Posts: 277
Joined: Sat May 14, 2011 10:18 am

Re: Josefnpat's Splash

Post 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
Post Reply

Who is online

Users browsing this forum: Bing [Bot] and 4 guests