Tag Info

New answers tagged

1

You could check to see if the key was pressed in the previous frame. Consider doing something like this: bool DownPressed; bool UpPressed; .... if (KeyBinding.downDown) { if (!DownPressed) { DownPressed = true; nextEntry(); } } else { DownPressed = false; } if (KeyBinding.upDown) { if (!UpPressed) { ...


1

Your main character class should not have a reference to the keyboard or any input-related class. Input should be handled in the game loop, or preferably a dedicated input class, decoupled from other entities so they'll only need to respond to abstract actions, not raw input. Not all input is related to your characters and and not all types of input devices ...



Top 50 recent answers are included