Frame 1
stop();
char = charLayer.attachMovie("character", "char", _root.getNextHighestDepth());
char._x = xPos;
char._y = yPos;
char.xSpeed = 0;
char.ySpeed = 0;
char.walkSpeed = 5;
char.runSpeed = 10;
char.bottomLeft = char.stop();
char.onEnterFrame = function () {
if (Key.isDown(16)) {
this.speed = this.runSpeed;
} else {
this.speed = this.walkSpeed;
}
if (Key.isDown(38)) {
this.ySpeed = -this.speed;
} else if (Key.isDown(40)) {
this.ySpeed = this.speed;
} else {
this.ySpeed = 0;
}
if (Key.isDown(37)) {
this.xSpeed = -this.speed;
} else if (Key.isDown(39)) {
this.xSpeed = this.speed;
} else {
this.xSpeed = 0;
}
if ((this.xSpeed == 0) && (this.ySpeed == 0)) {
this.walk.gotoAndStop("stand");
} else {
this.walk.play();
}
if (this.xSpeed > 0) {
this.gotoAndStop("right");
} else if (this.xSpeed < 0) {
this.gotoAndStop("left");
} else if (this.ySpeed > 0) {
this.gotoAndStop("down");
} else if (this.ySpeed < 0) {
this.gotoAndStop("up");
}
if (this.xCollision(walls)) {
this.xSpeed = 0;
}
if (this.yCollision(walls)) {
this.ySpeed = 0;
}
this._x = this._x + this.xSpeed;
this._y = this._y + this.ySpeed;
};
char.yCollision = function (object) {
if (this.ySpeed > 0) {
if (object.hitTest((this._x + (this._width / 2)) - 6, ((this._y + (this._height / 2)) + this.ySpeed) - 4, true)) {
return(true);
}
if (object.hitTest((this._x - (this._width / 2)) + 6, ((this._y + (this._height / 2)) + this.ySpeed) - 4, true)) {
return(true);
}
return(false);
}
if (this.ySpeed < 0) {
if (object.hitTest((this._x + (this._width / 2)) - 6, ((this._y - (this._height / 2)) + this.ySpeed) + 20, true)) {
return(true);
}
if (object.hitTest((this._x - (this._width / 2)) + 6, ((this._y - (this._height / 2)) + this.ySpeed) + 20, true)) {
return(true);
}
return(false);
}
return(false);
};
char.xCollision = function (object) {
if (this.xSpeed > 0) {
if (object.hitTest(((this._x + (this._width / 2)) - 6) + this.xSpeed, (this._y - (this._height / 2)) + 20, true)) {
return(true);
}
if (object.hitTest(((this._x + (this._width / 2)) - 6) + this.xSpeed, (this._y + (this._height / 2)) - 4, true)) {
return(true);
}
return(false);
}
if (this.xSpeed < 0) {
if (object.hitTest(((this._x - (this._width / 2)) + 6) + this.xSpeed, (this._y - (this._height / 2)) + 20, true)) {
return(true);
}
if (object.hitTest(((this._x - (this._width / 2)) + 6) + this.xSpeed, (this._y + (this._height / 2)) - 4, true)) {
return(true);
}
return(false);
}
return(false);
};
enemy = enemyLayer.attachMovie("enemial", "enemy", _root.getNextHighestDepth());
enemy._x = xPos;
enemy._y = yPos;
_y = (_y + ((_root.char._y - _y) / 45));
enemy.ySpeed = _y + ((_root.char._y - _y) / 45);
_x = (_x + ((_root.char._x - _x) / 45));
enemy.xSpeed = _x + ((_root.char._x - _x) / 45);
enemy.walkSpeed = 2;
enemy.runSpeed = 10;
enemy.bottomLeft = enemy.stop();
enemy.onEnterFrame = function () {
if (Key.isDown(16)) {
this.speed = this.runSpeed;
} else {
this.speed = this.walkSpeed;
}
if (Key.isDown(38)) {
this.ySpeed = -this.speed;
} else if (Key.isDown(40)) {
this.ySpeed = this.speed;
} else {
this.ySpeed = 0;
}
if (Key.isDown(37)) {
this.xSpeed = -this.speed;
} else if (Key.isDown(39)) {
this.xSpeed = this.speed;
} else {
this.xSpeed = 0;
}
if ((enemy.xSpeed == 0) && (this.ySpeed == 0)) {
this.walk.gotoAndStop("stand");
} else {
this.walk.play();
}
if (enemy.xSpeed > 0) {
this.gotoAndStop("right");
} else if (this.xSpeed < 0) {
this.gotoAndStop("left");
} else if (this.ySpeed > 0) {
this.gotoAndStop("down");
} else if (this.ySpeed < 0) {
this.gotoAndStop("up");
}
if (this.xCollision(walls)) {
_x = 0;
}
if (this.yCollision(walls)) {
_y = 0;
}
this._x = this._x + this.xSpeed;
this._y = this._y + this.ySpeed;
};
enemy.yCollision = function (object) {
if (this.ySpeed > 0) {
if (object.hitTest((this._x + (this._width / 2)) - 6, ((this._y + (this._height / 2)) + this.ySpeed) - 4, true)) {
return(true);
}
if (object.hitTest((this._x - (this._width / 2)) + 6, ((this._y + (this._height / 2)) + this.ySpeed) - 4, true)) {
return(true);
}
return(false);
}
if (this.ySpeed < 0) {
if (object.hitTest((this._x + (this._width / 2)) - 6, ((this._y - (this._height / 2)) + this.ySpeed) + 20, true)) {
return(true);
}
if (object.hitTest((this._x - (this._width / 2)) + 6, ((this._y - (this._height / 2)) + this.ySpeed) + 20, true)) {
return(true);
}
return(false);
}
return(false);
};
enemy.xCollision = function (object) {
if (this.xSpeed > 0) {
if (object.hitTest(((this._x + (this._width / 2)) - 6) + this.xSpeed, (this._y - (this._height / 2)) + 20, true)) {
return(true);
}
if (object.hitTest(((this._x + (this._width / 2)) - 6) + this.xSpeed, (this._y + (this._height / 2)) - 4, true)) {
return(true);
}
return(false);
}
if (this.xSpeed < 0) {
if (object.hitTest(((this._x - (this._width / 2)) + 6) + this.xSpeed, (this._y - (this._height / 2)) + 20, true)) {
return(true);
}
if (object.hitTest(((this._x - (this._width / 2)) + 6) + this.xSpeed, (this._y + (this._height / 2)) - 4, true)) {
return(true);
}
return(false);
}
return(false);
};
Instance of Symbol 92 MovieClip "trigger" in Frame 1
onClipEvent (enterFrame) {
if (this.hitTest(_root.char)) {
trace("HIT");
_root.gotoAndStop("61");
}
}
Instance of Symbol 96 MovieClip in Frame 1
onClipEvent (enterFrame) {
_y = (_y + ((_root.char._y - _y) / 1));
_x = (_x + ((_root.char._x - _x) / 1));
}
Instance of Symbol 100 MovieClip in Frame 1
onClipEvent (enterFrame) {
if (this.hitTest(_root.char)) {
trace("DEAD");
_root.gotoAndPlay("2");
}
}
Frame 20
stop();
Frame 61
stop();
char = charLayer.attachMovie("character", "char", _root.getNextHighestDepth());
char._x = xPos;
char._y = yPos;
char.xSpeed = 0;
char.ySpeed = 0;
char.walkSpeed = 30;
char.runSpeed = 10;
char.bottomLeft = char.stop();
char.onEnterFrame = function () {
if (Key.isDown(16)) {
this.speed = this.runSpeed;
} else {
this.speed = this.walkSpeed;
}
if (Key.isDown(38)) {
this.ySpeed = -this.speed;
} else if (Key.isDown(40)) {
this.ySpeed = this.speed;
} else {
this.ySpeed = 0;
}
if (Key.isDown(37)) {
this.xSpeed = -this.speed;
} else if (Key.isDown(39)) {
this.xSpeed = this.speed;
} else {
this.xSpeed = 0;
}
if ((this.xSpeed == 0) && (this.ySpeed == 0)) {
this.walk.gotoAndStop("stand");
} else {
this.walk.play();
}
if (this.xSpeed > 0) {
this.gotoAndStop("right");
} else if (this.xSpeed < 0) {
this.gotoAndStop("left");
} else if (this.ySpeed > 0) {
this.gotoAndStop("down");
} else if (this.ySpeed < 0) {
this.gotoAndStop("up");
}
if (this.xCollision(walls)) {
this.xSpeed = 0;
}
if (this.yCollision(walls)) {
this.ySpeed = 0;
}
this._x = this._x + this.xSpeed;
this._y = this._y + this.ySpeed;
};
char.yCollision = function (object) {
if (this.ySpeed > 0) {
if (object.hitTest((this._x + (this._width / 2)) - 6, ((this._y + (this._height / 2)) + this.ySpeed) - 4, true)) {
return(true);
}
if (object.hitTest((this._x - (this._width / 2)) + 6, ((this._y + (this._height / 2)) + this.ySpeed) - 4, true)) {
return(true);
}
return(false);
}
if (this.ySpeed < 0) {
if (object.hitTest((this._x + (this._width / 2)) - 6, ((this._y - (this._height / 2)) + this.ySpeed) + 20, true)) {
return(true);
}
if (object.hitTest((this._x - (this._width / 2)) + 6, ((this._y - (this._height / 2)) + this.ySpeed) + 20, true)) {
return(true);
}
return(false);
}
return(false);
};
char.xCollision = function (object) {
if (this.xSpeed > 0) {
if (object.hitTest(((this._x + (this._width / 2)) - 6) + this.xSpeed, (this._y - (this._height / 2)) + 20, true)) {
return(true);
}
if (object.hitTest(((this._x + (this._width / 2)) - 6) + this.xSpeed, (this._y + (this._height / 2)) - 4, true)) {
return(true);
}
return(false);
}
if (this.xSpeed < 0) {
if (object.hitTest(((this._x - (this._width / 2)) + 6) + this.xSpeed, (this._y - (this._height / 2)) + 20, true)) {
return(true);
}
if (object.hitTest(((this._x - (this._width / 2)) + 6) + this.xSpeed, (this._y + (this._height / 2)) - 4, true)) {
return(true);
}
return(false);
}
return(false);
};
enemy = enemyLayer.attachMovie("enemial", "enemy", _root.getNextHighestDepth());
enemy._x = xPos;
enemy._y = yPos;
_y = (_y + ((_root.char._y - _y) / 45));
enemy.ySpeed = _y + ((_root.char._y - _y) / 45);
_x = (_x + ((_root.char._x - _x) / 45));
enemy.xSpeed = _x + ((_root.char._x - _x) / 45);
enemy.walkSpeed = 2;
enemy.runSpeed = 10;
enemy.bottomLeft = enemy.stop();
enemy.onEnterFrame = function () {
if (Key.isDown(16)) {
this.speed = this.runSpeed;
} else {
this.speed = this.walkSpeed;
}
if (Key.isDown(38)) {
this.ySpeed = -this.speed;
} else if (Key.isDown(40)) {
this.ySpeed = this.speed;
} else {
this.ySpeed = 0;
}
if (Key.isDown(37)) {
this.xSpeed = -this.speed;
} else if (Key.isDown(39)) {
this.xSpeed = this.speed;
} else {
this.xSpeed = 0;
}
if ((enemy.xSpeed == 0) && (this.ySpeed == 0)) {
this.walk.gotoAndStop("stand");
} else {
this.walk.play();
}
if (enemy.xSpeed > 0) {
this.gotoAndStop("right");
} else if (this.xSpeed < 0) {
this.gotoAndStop("left");
} else if (this.ySpeed > 0) {
this.gotoAndStop("down");
} else if (this.ySpeed < 0) {
this.gotoAndStop("up");
}
if (this.xCollision(walls)) {
_x = 0;
}
if (this.yCollision(walls)) {
_y = 0;
}
this._x = this._x + this.xSpeed;
this._y = this._y + this.ySpeed;
};
enemy.yCollision = function (object) {
if (this.ySpeed > 0) {
if (object.hitTest((this._x + (this._width / 2)) - 6, ((this._y + (this._height / 2)) + this.ySpeed) - 4, true)) {
return(true);
}
if (object.hitTest((this._x - (this._width / 2)) + 6, ((this._y + (this._height / 2)) + this.ySpeed) - 4, true)) {
return(true);
}
return(false);
}
if (this.ySpeed < 0) {
if (object.hitTest((this._x + (this._width / 2)) - 6, ((this._y - (this._height / 2)) + this.ySpeed) + 20, true)) {
return(true);
}
if (object.hitTest((this._x - (this._width / 2)) + 6, ((this._y - (this._height / 2)) + this.ySpeed) + 20, true)) {
return(true);
}
return(false);
}
return(false);
};
enemy.xCollision = function (object) {
if (this.xSpeed > 0) {
if (object.hitTest(((this._x + (this._width / 2)) - 6) + this.xSpeed, (this._y - (this._height / 2)) + 20, true)) {
return(true);
}
if (object.hitTest(((this._x + (this._width / 2)) - 6) + this.xSpeed, (this._y + (this._height / 2)) - 4, true)) {
return(true);
}
return(false);
}
if (this.xSpeed < 0) {
if (object.hitTest(((this._x - (this._width / 2)) + 6) + this.xSpeed, (this._y - (this._height / 2)) + 20, true)) {
return(true);
}
if (object.hitTest(((this._x - (this._width / 2)) + 6) + this.xSpeed, (this._y + (this._height / 2)) - 4, true)) {
return(true);
}
return(false);
}
return(false);
};
Instance of Symbol 96 MovieClip in Frame 61
onClipEvent (enterFrame) {
_y = (_y + ((_root.char._y - _y) / 1));
_x = (_x + ((_root.char._x - _x) / 1));
}
Symbol 96 MovieClip Frame 1
function camControl() {
rp.x = _x;
rp.y = _y;
var _local5 = camH * (_yscale * 0.01);
var _local6 = camW * (_xscale * 0.01);
var _local3 = sH / _local5;
var _local4 = sW / _local6;
_x2 = (_local6 / 2) * _local4;
_y2 = (_local5 / 2) * _local3;
_xscale2 = _local4 * 100;
_yscale2 = _local3 * 100;
_rotation2 = -_rotation;
_parent.filters = this.filters;
_parent.transform.colorTransform = this.transform.colorTransform;
}
function reset() {
_parent._xscale = 100;
_parent._yscale = 100;
_parent._x = 0;
_parent._y = 0;
_parent._rotation = 0;
_parent._visible = true;
}
function set_x2(value) {
var _local2 = {x:rp.x, y:rp.y};
_parent.localToGlobal(_local2);
_parent._x = _parent._x + (value - _local2.x);
}
function get_x2() {
var _local2 = {x:rp.x, y:rp.y};
_parent.localToGlobal(_local2);
return(_local2.x);
}
function set_y2(value) {
var _local2 = {x:rp.x, y:rp.y};
_parent.localToGlobal(_local2);
_parent._y = _parent._y + (value - _local2.y);
}
function get_y2() {
var _local2 = {x:rp.x, y:rp.y};
_parent.localToGlobal(_local2);
return(_local2.y);
}
function get_xscale2() {
return(_parent._xscale);
}
function set_xscale2(value) {
setProperty2("_xscale", value);
}
function get_yscale2() {
return(_parent._yscale);
}
function set_yscale2(value) {
setProperty2("_yscale", value);
}
function get_rotation2() {
return(parent.rotation);
}
function set_rotation2(value) {
setProperty2("_rotation", value);
}
function setProperty2(prop, n) {
var _local3 = {x:rp.x, y:rp.y};
_parent.localToGlobal(_local3);
_parent[prop] = n;
var _local2 = {x:rp.x, y:rp.y};
_parent.localToGlobal(_local2);
_parent._x = _parent._x - (_local2.x - _local3.x);
_parent._y = _parent._y - (_local2.y - _local3.y);
}
_visible = false;
addProperty("_x2", get_x2, set_x2);
addProperty("_y2", get_y2, set_y2);
addProperty("_xscale2", get_xscale2, set_xscale2);
addProperty("_yscale2", get_yscale2, set_yscale2);
addProperty("_rotation2", get_rotation2, set_rotation2);
var oldScaleMode = stage.scaleMode;
stage.scaleMode = "exactFit";
var sW = Stage.width;
var sH = Stage.height;
stage.scaleMode = oldScaleMode;
var bounds_obj = this.getBounds(this);
var camH = Math.abs(bounds_obj.yMax - bounds_obj.yMin);
var camW = Math.abs(bounds_obj.xMax - bounds_obj.xMin);
var rp = {x:this._x, y:this._y};
onEnterFrame = function () {
camControl();
};
this.onUnload = reset;