floor integers?

Questions about the LÖVE API, installing LÖVE and other support related questions go here.
Forum rules
Before you make a thread asking for help, read this.
Post Reply
User avatar
hertzcastle
Party member
Posts: 100
Joined: Sun Jan 04, 2009 4:51 pm
Location: brighton, uk

floor integers?

Post 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
User avatar
osgeld
Party member
Posts: 303
Joined: Sun Nov 23, 2008 10:13 pm

Re: floor integers?

Post by osgeld »

math.floor()
User avatar
hertzcastle
Party member
Posts: 100
Joined: Sun Jan 04, 2009 4:51 pm
Location: brighton, uk

Re: floor integers?

Post by hertzcastle »

(slaps own forehead)...should have known it was something simple like that...
cheers mate!x
User avatar
Tenoch
Citizen
Posts: 76
Joined: Mon Jul 21, 2008 7:49 am

Re: floor integers?

Post 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.
"When in doubt, use brute force." Ken Thompson
User avatar
hertzcastle
Party member
Posts: 100
Joined: Sun Jan 04, 2009 4:51 pm
Location: brighton, uk

Re: floor integers?

Post 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
User avatar
subrime
Citizen
Posts: 76
Joined: Thu Nov 13, 2008 6:18 pm
Location: Australia

Re: floor integers?

Post 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)
User avatar
Carl
Prole
Posts: 18
Joined: Wed Oct 28, 2009 10:32 pm

Re: floor integers?

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

Who is online

Users browsing this forum: Ahrefs [Bot] and 2 guests