yes, as well as the sf::Keybaord::isKeyPressed(sf::Keyboard:);
The 'window.setKeyRepeatEnabled(bool)' function works only with 'sf::Event::KeyPressed':
See here.
And I am sorry, but your code and explanation is quite confusing.
My wild guess is that you have a faulty 'if' statements:
if (Event.key.code == sf::Keyboard::D){
if (PlayerColor == Blue){
BlueScore++;
ChooseNextPlayer();
}
if (PlayerColor == Pink){
GameOver();
}
Here in this code you say to the program: "When I press the 'D' key, check whether the player is blue
AND THEN check whether the player is pink."
If the player is blue, the program will then continue to execute the said statement, where you call the 'ChooseNextPlayer()' function (which apparently randomly chooses the next player).
When program randomly chooses next player, it proceeds with next 'if' statement, which checks whether the player is pink, and if that player is pink - because in previous 'if' statement you called 'ChooseNextPlayer()' function - it will then execute it's statement, which calls 'GameOver()'.
The same applies when you press 'A' key.
In order to prevent this, you need to use an 'else' or 'else if' in your second statements, so when the first 'if' statement is true, it won't proceed to check the other statements.
If there is another problem, then I can't help you further without you providing a
complete and minimal code --- Go and read the post in the link.