Sign in to follow this  
anupgupta

Using Camera

Recommended Posts

hello I am currently working on a 2D project...which is basically a top-down scrolling game...I am a little confused whether to case 1: move the background or case 2: move the camera I want to know which is the best method case 1 or case 2..and which would be ideal to implement as it is a 2D scrolling game... Also I am rendering all the images giving pixel values on the screen...but i have come to know that the camera would require to give the values in co-ordinate system..and not in pixels... I think the background could be rendered according to the co-ordinate system and the rest in 2D pixels.. I really do not if I am right or wrong..Please advice... Any suggestion would be of great help...

Share this post


Link to post
Share on other sites
It will be better to move the camera instead of the background.

If you move the background, whenever you have some sort of object that needs to be in a fixed position relative to the background you need to keep moving that object to keep it in that same place. And when you have 10 objects, then you have to do it 10 times.

It's more intuitive to move the camera and your player around. That way, it will be the camera following the player, and the player moving around in the world, instead of the player staying still and the world moving around the player.

Share this post


Link to post
Share on other sites
Thanks Endar

it was a similar problem i was facing...that u have explained...
i had seven objects of which one moves and the rest are stationary...thus moving the background was resulting in moving the stationary objects...which i somehow felt was not right...

Anyways...i have decided to move the camera..and attach it to the player...

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this