1
Alright so i am using the SFML view to have the screen centered on top of the players sprite the Yellow is the y coordinate and the Blue is the X coordinate , now the thing is everything i press the corresponding key such has the up arrow the screen will always move to far in that direction and i have adjusted the numbers to where it moves slower or fast but it dose not help , so is there a way to keep the SFML view always centered with the player sprite , and by view i am talking about the 2d view option http://www.sfml-dev.org/tutorials/2.0/graphics-view.php
if (sf::Keyboard::isKeyPressed(sf::Keyboard::Up))
{
Yellow = -200;
Blue = 0;
}
if (sf::Keyboard::isKeyPressed(sf::Keyboard::Down))
{
Yellow = 200;
Blue = 0;
}
if (sf::Keyboard::isKeyPressed(sf::Keyboard::Left))
{
Yellow = 0;
Blue = -3.33333;
}
if (sf::Keyboard::isKeyPressed(sf::Keyboard::Right))
{
Yellow = 0;
Blue = 3.33333;
}
if (sf::Keyboard::isKeyPressed(sf::Keyboard::Up))
{
Yellow = -200;
Blue = 0;
}
if (sf::Keyboard::isKeyPressed(sf::Keyboard::Down))
{
Yellow = 200;
Blue = 0;
}
if (sf::Keyboard::isKeyPressed(sf::Keyboard::Left))
{
Yellow = 0;
Blue = -3.33333;
}
if (sf::Keyboard::isKeyPressed(sf::Keyboard::Right))
{
Yellow = 0;
Blue = 3.33333;
}