RPG Door Animation

So in all RPG games you have buildings, but wait! Doors are on Buildings so how would I go about to making a door anitmation so when your player trys to move into the door so it opens? I know how to make the animation like with the images an stuff but not the codeing part of it.