There are many ways to achieve this..
one would be giving the object an intance variable and set it to the moving direction
on key right arrow pressed - object set instance variable to "right"
object compare instance variable = "right" - object : 8 directions simulate pressing right..
If you do this for all directions, you are ready to go..