Platform game help

I am making a platform game in AS2 for school and everything works, but the rotation of the character to the ground.The rotation works by two points (dots) on the character that tell when they are hitting the ground. Does anyone know how to make it work

Here is the code:

Code:
onClipEvent (load) {
speed = 4;
jump = 0;
jumpheight = 9;
gravity = 0.5;
scale = _xscale;
wid = _width/2;
heig = _height/2;
//when the character moves his feet will play the animation, but when the movement stops, the feet reset to a rest position
}
onClipEvent (enterFrame) {
_y -= jump;
jump -= gravity;
if (Key.isDown(65)) {
_x -= speed;
_xscale = -scale;
}
if (Key.isDown(68)) {
_x += speed;
_xscale = +scale;
}
while (_root.ground.hitTest(_x, _y+heig, true)) {
_y–;
jump = -5;
inair = false;
if (inair == false && Key.isDown(87)) {
jump = jumpheight;
inair = true;
}
}
}
onClipEvent (enterframe) {
if (_root.ground.hitTest(_root.player[“rightpoint”])){
if (_root.ground.hitTest(_root.player[“leftpoint”])){
_root.player._rotation =0;
}else{
if (_root.ground.hitTest(_root.player[“rightpoint”])){
_root.player._rotation -=1;
}else{
if (_root.ground.hitTest(_root.player[“leftpoint”])){
_root.player._rotation +=1;
}
}
}
}
}