Page 1 of 1

floor integers?

Posted: Tue Oct 27, 2009 1:19 pm
by hertzcastle
hi!
trying to get some seamless scrolling together in love using delta timing. anyone know how to 'floor' x/y values in lua?
thanks!
x

Re: floor integers?

Posted: Tue Oct 27, 2009 1:20 pm
by osgeld
math.floor()

Re: floor integers?

Posted: Tue Oct 27, 2009 1:28 pm
by hertzcastle
(slaps own forehead)...should have known it was something simple like that...
cheers mate!x

Re: floor integers?

Posted: Tue Oct 27, 2009 2:03 pm
by Tenoch
:x

For all your Lua needs, remember to check first:
  • 2. the official book, http://www.lua.org/pil/ for more friendly and verbose explanations. Ideal to learn. It should also cover most of your needs, as it introduces some data structures, algorithms, etc, which help you getting familiar with the language.
I strongly recommend bookmarking and studying those.
Putting the cart before the horse rarely works.

Re: floor integers?

Posted: Tue Oct 27, 2009 2:46 pm
by hertzcastle
yea sorry bout askin.
basically what im trying to do is get a parralax scrolling effect. this still doesnt work as theres gaps between every few images. any tips on this?
x

Re: floor integers?

Posted: Thu Oct 29, 2009 11:33 pm
by subrime
another good lua reference: http://pgl.yoyo.org/luai/i/_

You could combat gaps by:
1) making your images overlap a little (so a bit of shift is ok)
2) placing images relative to each other.
eg: img1 at img1.x, img2 at img1.x+img1.width, img3 at img1.x+img1.width+img2.width, etc
3) use a package to handle the scrolling (eg http://love2d.org/wiki/index.php?title=CAMERA)

Re: floor integers?

Posted: Fri Oct 30, 2009 9:35 am
by Carl
Tenoch wrote::x

For all your Lua needs, remember to check first:
  • 2. the official book, http://www.lua.org/pil/ for more friendly and verbose explanations. Ideal to learn. It should also cover most of your needs, as it introduces some data structures, algorithms, etc, which help you getting familiar with the language.
I strongly recommend bookmarking and studying those.
Putting the cart before the horse rarely works.
Thanks for those, I was having a hard time finding a good learning source but the book is exactly what I was after. :D