SFML community forums

Help => General => Topic started by: Clockwork on July 06, 2014, 11:27:21 pm

Title: Moving the sf::View at the same rate that the player moves
Post by: Clockwork on July 06, 2014, 11:27:21 pm
I want to make a sidescroller, but I ran into the problem where it seems unnecessarily complicated to get the camera to move at the same rate as the player.  If I do this:

view.move(sf::Vector2f(Speed, 0.f));

The camera moves significantly faster than the player, how can I match them up?
Title: Re: Moving the sf::View at the same rate that the player moves
Post by: zsbzsb on July 06, 2014, 11:31:56 pm
Why not just...
view.setCenter(player.getPosition());
Title: Re: Moving the sf::View at the same rate that the player moves
Post by: Clockwork on July 06, 2014, 11:38:42 pm
That's what I love about programming, there's always a better way to solve a problem.

Thanks, I was over-thinking it again.