hey guys,
I have some rotation code for a slope:
_________________________________________
function onEnterFrame() {
var leftist:Object = {x

lank.leftdot._x, y

lank.leftdot._y}
plank.leftdot.localToGlobal(leftist);
var rightist:Object = {x

lank.rightdot._x, y

lank.rightdot._y}
plank.rightdot.localToGlobal(rightist);
plank._x = _xmouse; plank._y = _ymouse;
if (hill.hitTest(leftist.x, leftist.y, true)) {left = true;}
else {left = false;}
if (hill.hitTest(rightist.x, rightist.y, true)) {right = true;}
else {right = false;}
if (right == true && left == false)
{plank._rotation-=2; trace("right only");}
else if (right == false && left == true)
{plank._rotation+=2; trace("left only");}
else if (right == false && left == false)
{ trace("neither only");}
else if (right == true && left == true)
{ trace("both only");}
lefty._x = (leftist.x);
lefty._y = (leftist.y);
righty._x = (rightist.x);
righty._y = (rightist.y);
}
__________________________________________
when I changed the name 'plank' to 'guyOnHorse' using the code below, the gravity, pulls the whole lot off the bottom of the screen:
_________________________________________
onClipEvent (load) {
speed = 3.6;
gravity = 0;
r = _height/29;
jumping = false;
var scale:Number = _xscale;
jumpheight = 11;
running = false;
var touchingGround = false;
}
onClipEvent (enterFrame) {
if (Key.isDown(Key.RIGHT)) {
_xscale = +scale;
if(touchingGround == true) {
this.gotoAndPlay("walk");
}
_x += Walkspeed;
}
if (Key.isDown(Key.LEFT)) {
_xscale = -scale;
if(touchingGround == true) {
this.gotoAndPlay("walk");
}
_x -= Walkspeed;
} else {
if (touchingGround == true) {
this.gotoAndPlay("still");
}
}
if (Key.isDown(Key.UP) && !jumping) {
gravity = -jumpheight;
jumping = true;
this.gotoAndPlay("jump");
}
if (!_root.ground.hitTest(_x, _y, true)) {
gravity++;
_y += gravity;
touchingGround = false;
} else {
jumping = false;
gravity = 0;
}
while (_root.ground.hitTest(_x, _y-1+r, true)) {
gravity = 0;
jumping = false;
_y--;
touchingGround = true;
}
}
Is there anyone who can help, thankyou kindly in advance!
bryser