camera?

General discussion about LÖVE, Lua, game development, puns, and unicorns.
Post Reply
User avatar
Pliskin09
Citizen
Posts: 89
Joined: Fri Jul 24, 2009 8:30 am

camera?

Post 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
User avatar
JSharpe
Prole
Posts: 6
Joined: Mon Jul 27, 2009 4:48 pm
Location: UK
Contact:

Re: camera?

Post 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.
User avatar
Pliskin09
Citizen
Posts: 89
Joined: Fri Jul 24, 2009 8:30 am

Re: camera?

Post by Pliskin09 »

alright thanks. the camera looks very nice, will fiddle with it later on :)
Post Reply

Who is online

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