Combined Code
movieClip 2 {
}
instance of movieClip 2 {
onClipEvent (enterFrame) {
if (_root.moveLeft == true) {
this._x += 4;
}
if (_root.moveUp == true) {
this._y += 4;
}
if (_root.moveDown == true) {
this._y -= 4;
}
if (_root.moveRight == true) {
this._x -= 4;
}
}
}
movieClip 4 {
}
movieClip 7 {
frame 1 {
stop();
}
}
instance Player of movieClip 7 {
onClipEvent (enterFrame) {
if (Key.isDown(40)) {
if (_root.BG.hitTest(_x, _y + 5, true)) {
this._y += 4;
} else {}
this.gotoAndStop(2);
}
if (Key.isDown(38)) {
if (_root.BG.hitTest(_x, _y - 5, true)) {
this._y -= 4;
} else {}
this.gotoAndStop(1);
}
if (Key.isDown(37)) {
if (_root.BG.hitTest(_x - 5, _y, true)) {
this._x -= 4;
} else {
this.gotoAndStop(3);
}
}
if (Key.isDown(39)) {
if (_root.BG.hitTest(_x + 5, _y, true)) {
this._x += 4;
} else {}
this.gotoAndStop(4);
}
if (_root.gridUP.hitTest(_x, _y - 20, true)) {
this._y += 4;
_root.BG._y += 4;
_root.moveUp = true;
} else {
_root.moveUp = false;
}
if (_root.gridDOWN.hitTest(_x, _y + 20, true)) {
this._y -= 4;
_root.BG._y -= 4;
_root.moveDown = true;
} else {
_root.moveDown = false;
}
if (_root.gridRIGHT.hitTest(_x + 20, _y, true)) {
this._x -= 4;
_root.BG._x -= 4;
_root.moveRight = true;
} else {
_root.moveRight = false;
}
if (_root.gridLEFT.hitTest(_x - 20, _y, true)) {
this._x += 4;
_root.BG._x += 4;
_root.moveLeft = true;
} else {
_root.moveLeft = false;
}
}
onClipEvent (load) {
facing = 2;
}
onClipEvent (enterFrame) {
this._x = _root.hero._x;
this._y = _root.hero._y - 30;
if (Key.isDown(40)) {
facing = 2;
this.gotoAndStop(4);
} else {
if (Key.isDown(38)) {
facing = 1;
this.gotoAndStop(2);
} else {
if (Key.isDown(37)) {
facing = 3;
this.gotoAndStop(6);
} else {
if (Key.isDown(39)) {
facing = 4;
this.gotoAndStop(8);
} else {
if (facing == 1) {
this.gotoAndStop(1);
} else {
if (facing == 2) {
this.gotoAndStop(3);
} else {
if (facing == 3) {
this.gotoAndStop(5);
} else {
if (facing == 4) {
this.gotoAndStop(7);
}
}
}
}
}
}
}
}
}
}
movieClip 9 {
}