- Run a game loop
- Check for arrow keys pressed
- When arrow is pressed, calculate the new player coordinates
- if new player coordinates result in a collision, do not move the player, but instead append a status message to the onscreen status box
My issue is that if I am holding down the arrow key and collide with an object, that onscreen status box gets hundreds of messages appended to it.
I originally thought that a way to get around this would be to check the last line in the status box and if it is the same as the new line then not to append the new line. However, this will cause a problem if the user walks away and comes back to the same object again, in this case the user SHOULD see a second message appended to the box.
What is a proper way to deal with this situation?