Camera in 2D platformer game

Aug 27, 2012 at 12:18pm
Hi, I'm currently developing a 2D side-scrolling platformer game using SFML. How do I stop the camera from moving when it reaches the edges of the level ?
Aug 27, 2012 at 12:37pm
Something like this
1
2
3
if right edge of camera > right edge of level
	move camera so that right edge of camera = right edge of level
	if you have some kind of variable determining the horizontal camera speed you could set that speed to zero here.

Do the same with the other directions.
Aug 27, 2012 at 12:55pm
Thank you Peter87, the first one worked really well.
Topic archived. No new replies allowed.