Page 1 of 1

camera?

Posted: Tue Jul 28, 2009 11:28 am
by Pliskin09
hey guys, i was wondering, especially after seeing the Pokemon example posted up earlier, how does the "camera" work? i know there is no real camera (or maybe love has a function for that?) but we still need to get things to move around when you move the character. the character sits in the middle but the tiles move under his feet. im just wondering how this is done?

from what i think, when the player moves we add a certain amount to a variable that stores his verticle and horizontal movements (not actually move him), then add these values to every single object's x and y thats supposed to move.. but that sounds a little elaborate

Re: camera?

Posted: Tue Jul 28, 2009 11:58 am
by JSharpe
Is this what you're looking for?
http://love2d.org/wiki/index.php?title=CAMERA:Usage --See also the "Getting Started" at the bottom

You might have already thought about this before forget i said this if so;
But you might want to use the love.graphic.setScissor() to stop resource/memory use wasted drawing a map you can't view. Maybe set a few tiles outside the view of the Scissors box to also reduce some display issues. Though I have not used it yet. Besides, most tile based games like that one move the map, rather than moving a cam above the player object. Though I could see this being a problem if you are using a big map.

Re: camera?

Posted: Tue Jul 28, 2009 12:16 pm
by Pliskin09
alright thanks. the camera looks very nice, will fiddle with it later on :)