GetKeyState too Sticky
I'm using GetKeyState for input in a project I'm working on and I'm having some trouble with it. For example:
1) User presses E to enter Weapon Shop.
2) User now has the option to press E to select a Weapon, but as soon as the user enters the shop a weapon is selected, it would seem that the previous pressing of E has been passed over.
I have some sleep() after getting key states, but that doesn't seem to change much. Any ideas? Is there a way to "remove" or release the current key state before proceeding to something else? Changing the user's input option (i.e. pressing X instead of E on the second part) isn't really an option I want to look into.
Just save the state of the key each frame and only execute an action if the state changes from KeyUp to KeyDown, that way you only activate the action once when the key is pushed down.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement