Combined Code
// unknown tag 88 length 73
movieClip 4 {
}
movieClip 6 {
}
instance of movieClip 6 {
onClipEvent (enterFrame) {
if (_root.char.hitTest(this)) {
charX = 260;
_root.char._x = 260;
charY = 294;
_root.char._y = 294;
}
}
}
movieClip 9 {
}
instance char of movieClip 9 {
onClipEvent (load) {
var ground = _root.ground;
var grav = 0;
var gravity = 1.5;
var speed = 10;
var maxJump = -15;
var touchingGround = false;
}
onClipEvent (enterFrame) {
_y = _y + grav;
grav += gravity;
while (ground.hitTest(_x, _y, true)) {
_y = _y - gravity;
grav = 0;
}
if (ground.hitTest(_x, _y + 5, true)) {
touchingGround = true;
} else {
touchingGround = false;
}
if (Key.isDown(39)) {
_x = _x + speed;
}
if (Key.isDown(37)) {
_x = _x - speed;
}
if (Key.isDown(38) && touchingGround) {
grav = maxJump;
}
if (ground.hitTest(_x + _width / 2, _y - _height / 2, true)) {
_x = _x - speed;
}
if (ground.hitTest(_x - _width / 2, _y - _height / 2, true)) {
_x = _x + speed;
}
if (ground.hitTest(_x, _y - height, true)) {
grav = 3;
}
}
}