sf::Event event;
while (win.pollEvent(event))
{
if (event.type == sf::Event::KeyPressed)
{
if (event.key.code == sf::Keyboard::Space) chara.jump();
}
}
if (sf::Keyboard::isKeyPressed(sf::Keyboard::Space)) chara.jump();
Should I use Events to check for inputs to i.e move my character or should I use the other one ??They are not equivalent. The KeyPressed event happens once when you press the key, whereas isKeyPressed will return true as long as the key is down, ie continuously for a short while. So in the first case your character will jump once, in the second one it will restart its jump continuously until you release the key. It's easy to workaround (do nothing if a jump is already active), but from a design point of view what you need is an event.