Moving around and about

Ok, this is my script:

while(village_holder.village.build.hit.hitTest(pt.getBounds(_root).xMin, pt._y, true)) {
pt._x++;
}
while(village_holder.village.build.hit.hitTest(pt.getBounds(_root).xMax, pt._y, true)) {
pt._x–;
}
while(village_holder.village.build.hit.hitTest(pt._x, pt.getBounds(_root).yMin, true)) {
pt._y++;
}
while(village_holder.village.build.hit.hitTest(pt._x, pt.getBounds(_root).yMax, true)) {
pt._y–;
}

I have a village, called ‘village_holder’, and in it is the village, build, and finally hit MCs. The ‘pt’ is the character that is moving around and about. When the player moves down and collides with the top of the village it makes the pt jump off the screen!! It works fine on the other sides.

Can you spot any problems?