This example is almost exactly the same as the last Smooth Roguelike Movement example. In this example though the player will continuously move 1 grid space (32×32) while the movement key is held down. If the movement key is released while the player is not bound to the grid, the player will carry on until it reaches the next grid space, making sure the player is always aligned to the grid correctly.
Here is another method for creating roguelike movement. This time instead of the player “jumping” to his new position, it slides smoothly into position. This would be better if your player sprite had an nice animated “walk cycle”. The player movement is still per button press and is still bound to a grid (32×32) but gives the illusion that it isn’t.
Here’s a basic example of “roguelike” grid movement. This type of movement “jumps” the player to his new position when a key is pressed as long as that position is not a wall.