Combined Code
frame 1 {
hp = 100;
stop();
}
frame 1 {
}
movieClip 4 {
frame 1 {
function camControl() {
rp.x = _x;
rp.y = _y;
var v5 = camH * (_yscale * 0.01);
var v6 = camW * (_xscale * 0.01);
var v3 = sH / v5;
var v4 = sW / v6;
_x2 = (v6 / 2) * v4;
_y2 = (v5 / 2) * v3;
_xscale2 = v4 * 100;
_yscale2 = v3 * 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 v2 = {'x': rp.x, 'y': rp.y};
_parent.localToGlobal(v2);
_parent._x += value - v2.x;
}
function get_x2() {
var v2 = {'x': rp.x, 'y': rp.y};
_parent.localToGlobal(v2);
return v2.x;
}
function set_y2(value) {
var v2 = {'x': rp.x, 'y': rp.y};
_parent.localToGlobal(v2);
_parent._y += value - v2.y;
}
function get_y2() {
var v2 = {'x': rp.x, 'y': rp.y};
_parent.localToGlobal(v2);
return v2.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 v3 = {'x': rp.x, 'y': rp.y};
_parent.localToGlobal(v3);
_parent[prop] = n;
var v2 = {'x': rp.x, 'y': rp.y};
_parent.localToGlobal(v2);
_parent._x -= v2.x - v3.x;
_parent._y -= v2.y - v3.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;
}
}
instance of movieClip 4 {
onClipEvent (enterFrame) {
_y = _y + (_root.player._y - _y) / 4;
_x = _x + (_root.player._x - _x) / 4;
}
}
movieClip 7 {
}
movieClip 9 {
}
movieClip 11 {
}
movieClip 15 {
}
movieClip 25 {
instance of movieClip 15 {
onClipEvent (enterFrame) {
if (this.hitTest(_root.player)) {
_root.player.hp -= 0.2;
}
}
}
}
movieClip 26 {
instance of movieClip 11 {
onClipEvent (enterFrame) {
if (this.hitTest(_root.player)) {
_root.player.hp -= 4;
}
}
}
frame 665 {
_root.itfollows.speed = 1;
}
}
instance itfollows of movieClip 26 {
onClipEvent (load) {
speed = 1;
hp = 100;
}
onClipEvent (enterFrame) {
if (_root.player._x > this._x - 20) {
_x = _x + speed;
_xscale = 100;
}
if (_root.player._x < this._x + 20) {
_x = _x - speed;
_xscale = -100;
}
}
onClipEvent (enterFrame) {
_y = _root.player._y;
}
}
movieClip 28 {
}
movieClip 33 {
}
movieClip 43 {
instance of movieClip 33 {
onClipEvent (enterFrame) {
if (this.hitTest(_root.itfollows)) {
_root.itfollows.speed -= 0.01;
_root.itfollows.hp -= 0.1;
}
}
}
}
movieClip 44 {
}
instance player of movieClip 44 {
onClipEvent (load) {
hp = 100;
var grav = 0;
var run = 2;
var wlk = 0;
var speed = run;
var jumpHeight = 10;
var djump = false;
var slow = 0.7;
var slowspd = speed / 2;
var setspeed = speed;
var scale = _xscale;
var ex = 5;
this.gotoAndStop(2);
}
onClipEvent (enterFrame) {
++grav;
_y = _y + grav;
if (Key.isDown(65)) {
setspeed = wlk;
this.gotoAndStop(4);
} else {
setspeed = run;
}
while (_root.ground.hitTest(_x, _y, true)) {
djump = false;
tjump = false;
_y = _y - 1;
grav = 0;
}
if (_root.water.hitTest(_x, _y, true)) {
grav *= slow * 1.25;
} else {
speed = setspeed;
}
if (Key.isDown(39)) {
_x = _x + speed;
_xscale = scale;
speed += 0.001;
if (_root.ground.hitTest(_x, _y + 3, true)) {
this.gotoAndStop(1);
} else {
if (djump == false) {
this.gotoAndStop(2);
}
}
} else {
if (Key.isDown(37)) {
_x = _x - speed;
_xscale = -scale;
speed += 0.001;
if (_root.ground.hitTest(_x, _y + 3, true)) {
this.gotoAndStop(1);
} else {
if (djump == false) {
this.gotoAndStop(2);
} else {
if (tjump == false) {
}
}
}
} else {
if (_root.ground.hitTest(_x, _y + 3, true) && !Key.isDown(68) && !Key.isDown(83)) {
this.gotoAndStop(3);
}
if (Key.isDown(83) && !Key.isDown(39) && !Key.isDown(37) && !Key.isDown(38) && !Key.isDown(68) && _root.ground.hitTest(_x, _y + 3, true) && _currentframe != 6) {
this.gotoAndStop(7);
} else {
if (Key.isDown(83) && grav > 1) {
this.gotoAndStop(6);
}
}
}
}
if (Key.isDown(38) && _root.ground.hitTest(_x, _y + 3, true)) {
grav = -jumpHeight;
_y = _y - 4;
jumpHeight += 0.02;
this.gotoAndStop(2);
}
if (_root.ground.hitTest(_x + _width / 2 + ex, _y - _height / 2, true) || _root.ground.hitTest(_x + _width / 2 + ex, _y - _height / 6, true) || _root.ground.hitTest(_x + _width / 2 + ex, _y - _height, true)) {
_x = _x - speed;
}
if (_root.ground.hitTest(_x - _width / 2 - ex, _y - _height / 2, true) || _root.ground.hitTest(_x - _width / 2 - ex, _y - _height / 6, true) || _root.ground.hitTest(_x - _width / 2 - ex, _y - _height, true)) {
_x = _x + speed;
}
if (_root.ground.hitTest(_x, _y - _height - 15, true)) {
grav = 1;
}
}
}
// unknown tag 88 length 156
movieClip 49 {
}
movieClip 54 {
}
movieClip 55 {
}
instance enemy of movieClip 55 {
onClipEvent (load) {
var egrav = 0;
var scale = this._xscale;
}
onClipEvent (enterFrame) {
var distance = 80;
var tx = this._x;
var ty = this._y;
var sx = _root.player._x;
var sy = _root.player._y;
if (Math.sqrt((sx - tx) * (sx - tx) + (sy - ty) * (sy - ty)) < distance) {
if (tx < sx) {
this.gotoAndStop(2);
this._xscale = scale;
}
if (tx > sx) {
this.gotoAndStop(2);
this._xscale = -scale;
}
}
if (Math.sqrt((sx - tx) * (sx - tx) + (sy - ty) * (sy - ty)) > distance) {
_root.enemy.gotoAndStop(1);
}
if (_currentframe == 2 and this.hitTest(_root.player)) {
--_root.hp.health;
}
if (_root.ground.hitTest(_x, _y, true)) {
egrav = 0;
} else {
++egrav;
_y = _y + egrav;
}
}
onClipEvent (enterFrame) {
distance = 80;
rx = _root.player._x;
ry = _root.player._y;
erx = _root.enemy._x;
ery = _root.enemy._y;
if (Math.sqrt((rx - erx) * (rx - erx) + (ry - ery) * (ry - ery)) < distance) {
if (rx < erx - 40) {
9;
this._x -= 5;
}
if (rx > erx + 40) {
this._x += 5;
}
}
if (_root.player.hitTest(_root.enemy)) {
_root.enemy.gotoAndPlay(3);
_root.player.hp -= 0.01;
}
if (_root.player.attacking.kill.hitTest(_root.enemy)) {
_root.enemy.gotoAndPlay(4);
}
}
onClipEvent (enterFrame) {
if (_root.player.attacking.kill.hitTest(this)) {
_root.enemy.unloadMovie(enemy);
}
}
}
movieClip 57 {
}
instance of movieClip 57 {
onClipEvent (enterFrame) {
_xscale = _root.itfollows.hp;
}
onClipEvent (enterFrame) {
_x = _root.itfollows._x;
_y = _root.itfollows._y - 50;
}
onClipEvent (enterFrame) {
if (_xscale < 0) {
_root.gotoAndStop(3);
}
}
}
movieClip 60 {
}
instance hpbar of movieClip 60 {
onClipEvent (enterFrame) {
_xscale = _root.player.hp;
}
onClipEvent (enterFrame) {
_x = _root.player._x;
_y = _root.player._y - 60;
}
onClipEvent (enterFrame) {
if (_xscale < 0) {
_root.gotoAndStop(2);
}
}
}
button 64 {
on (release) {
gotoAndStop(1);
}
}