# Moving logic

**URL:** <https://forum.kirupa.com/t/moving-logic/305301>\
**Category:** Uncategorized\
**Created:** [February 23, 2010, 5:09am UTC](https://forum.kirupa.com/t/moving-logic/305301 "2010-02-23T05:09:35Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![AlexWD](https://avatars.discourse-cdn.com/v4/letter/a/838e76/32.png) [@AlexWD](https://forum.kirupa.com/u/AlexWD)\
**Post date:** [February 23, 2010, 5:09am UTC](https://forum.kirupa.com/t/moving-logic/305301/1 "2010-02-23T05:09:35Z")

</div>

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?
