climbing up to a corner

I have an actor climbing up a wall. I do this by making it so that it'll move toward the wall when I press and hold a key, and will ignore gravity while the key is pressed. how do I make it so that the actor, once it reaches the top of the wall, will move on top of it? The wall is tiled by the way.