I have a game where you can move your character around a tile-based map in 4 directions. Currently I have a function that runs every frame, then inside of that I check to see which button is pressed to move the character whichever way. However I want to add a little more functionality. So that if you only tap (vs hold down) a button your character will turn in place.
I’m thinking about doing this by storing the numbers of frames that a button has been held down (and reset it every time its released). Then if that number gets above a certain number move the character, but if the button is released before a certain number of frames, then just turn it.
Does this sound like a good idea, or would you do it some other way?