Common event problem

I made a common event for footsteps to happen whenever down, left, right, and up is pressed so it looks like the character is walking with a sound effect. My problem is that when the character hits an object like the wall for example, the sound effect keeps playing if the button is being pressed. Is there a way to only make the sound happen when the character is visibly walking?
My first thought would be to check the player's x and y position, wait a few frames, then check again with a different pair of variables. After that, you'd compare them and then only play the SE if either value has changed.
My first thought would be to check the player's x and y position, wait a few frames, then check again with a different pair of variables. After that, you'd compare them and then only play the SE if either value has changed.
Unfortunately this didn't work, but I did find a script that was simple enough and actually worked for me. Thank you for your suggestion! 🙂 This problem has been resolved.

Original thread: https://forums.rpgmakerweb.com/threads/common-event-problem.45343/