The easiest way I can think of is to give the moving object a value like "dir" which will go up, down, left, or right (1 - 4), and then a collision polygon of basically one pixel.
Then every tick, check the current dir value, if not touching your object at offset of 1px to the direction they are trying to go in, then add 1 to dir. (if dir = 4, then dir = 1, etc)
Then add an action to move in the direction they currently have set.
I think this would be a slow method though, and haven't tested it