Home » Community » Forums » Graphics Programming and Theory » Scrolling the camera with a side-scrolling video game
  Intel sponsors gamedev.net search:   
[Control Panel] [Register] [Bookmarks] [Who's Online] [Active Topics] [Stats] [FAQ] [Search]

Add Forum to Favorites |  Send Topic To a Friend | View Forum FAQ | Track this topic


 Last Thread Next Thread 
 Scrolling the camera with a side-scrolling video game
Post New Topic  Post Reply 
Right now I am scrolling the camera so that the character always stays perfectly in the center, (horizontally). It looks rather unreal, and I was wondering how I should go about making this look more realistic. I seem to remember the camera rather sliding around in the old Mario type games, but i can't seem to emulate that effect very well, and I don't know how I would go about doing it.

Math maybe? ;)

 User Rating: 1018   |  Rate This User  Send Private MessageView Profile Report this Post to a Moderator | Link

My suggestion would be to only scroll the camera when the character gets a pre-determined distance to the sides of the screen then scroll the camera with the character.

So you have your character, he starts running to the right say he's 100 pixels from the right side of the screen, start scrolling the camera. He does a quick turn around and runs at the left side of the screen, wait until the character is 100 pixels(or whatever you chose) from the left side of the screen and start scrolling it that way. That gives the character time to react to any enemies that may appear.

 User Rating: 1015   |  Rate This User  Send Private MessageView Profile Report this Post to a Moderator | Link

Or you could make the camera speed vary based on the position of the character from the center of the screen. So if he's 1 logical unit away from the center, the camera goes slowly, but if he's 10 away, it goes fast. You might do something like if he's 3/8ths from the right of the screen, make the camera as fast as the character.

[edit] To give the player visibility, you might change that based on which direction the character is facing. So if he is facing right, the "center" of the screen is 1/4th from the left. I hope I'm not being too incomprehensible...


HTH

Regards,
jflanglois

 User Rating: 1612   |  Rate This User  Send Private MessageView Profile Report this Post to a Moderator | Link

All times are ET (US)

Post Reply
 Last Thread Next Thread 
Forum Rules:
You may not post new threads
You may post replies
You may not edit your posts
You may not use HTML in your posts
Jump To:
Administrative Options: