Frame 2
stop();
Frame 6
g.setGameMode(0);
g.pauseGame();
g.hideGame();
g.playMusic("./music/AmbientGlow.mp3");
stop();
Frame 12
g.setGameMode(1);
g.unhideGame();
stop();
Frame 17
g.setGameMode(0);
g.unhideGame();
g.unpauseGame();
stop();
Instance of Symbol 6 MovieClip in Symbol 9 MovieClip Frame 1
onClipEvent (load) {
kbps = 0;
timer = new Date();
bprev = _root.getBytesLoaded();
bytestotal = _root.getBytesTotal();
bytesloaded = bprev;
bytessum = bytesloaded;
favg = 0;
}
onClipEvent (enterFrame) {
bytesloaded = _root.getBytesLoaded();
bprev = bytesloaded;
_xscale = (100 * (bytesloaded / bytestotal));
if (_xscale < 100) {
} else {
_root.play();
}
var currtime = new Date();
if ((currtime - timer) > 1000) {
var tdelta = ((currtime - timer) / 1000);
timer = currtime;
favg = ((bytesloaded - bytessum) * 1) / tdelta;
bytessum = bytesloaded;
}
_parent.loadtext = ("Loading... " + (Math.floor(_xscale * 10) / 10)) + "%";
_parent.kbtext = ((Math.floor(bytesloaded / 1024) + "//") + Math.ceil(bytestotal / 1024)) + " kB";
_parent.kbpstext = (Math.floor(favg / 100) / 10) + "kBps";
}
Instance of Symbol 10 MovieClip "entertainor" in Symbol 14 MovieClip Frame 1
onClipEvent (load) {
function FireOrange(x, y) {
var newname = ("ong_" + gGarbageClipCurr);
gGarbageClip.duplicateMovieClip(newname, gGarbageClipCurr + 1024);
var clip = eval ("_parent." + newname);
clip._x = x;
clip._y = y;
clip._xvel = (Math.random() * 32) - 16;
clip._yvel = (Math.random() * 32) - 16;
clip._xscale = 12 + (Math.random() * 12);
clip._yscale = clip._xscale;
clip.destroy = false;
gGarbageClipCurr++;
if (gGarbageClipCurr > gMaxClips) {
gGarbageClipCurr = 0;
}
gGarbageClips.push(clip);
}
var gGarbageClip = _parent.dup_orange;
var gGarbageClipCurr = 0;
var gMaxClips = 16;
var gGarbageClips = [];
var gMouseState = 0;
var gMouseXPrev = 0;
var gMouseYPrev = 0;
var gTimer = 5;
var gFieldWidth = 960;
var gFieldHeight = 540;
}
onClipEvent (enterFrame) {
gTimer = gTimer + 1;
if (gTimer > 5) {
FireOrange(Math.random() * gFieldWidth, Math.random() * gFieldHeight);
gTimer = 0;
}
var remarray = [];
var i = 0;
var imax = gGarbageClips.length;
while (i < imax) {
var mc = gGarbageClips[i];
if (gMouseState) {
if (mc.hitTest(_parent._xmouse, _parent._ymouse, true)) {
remarray.push(i);
}
}
mc._yvel = mc._yvel + 0.327;
mc._y = mc._y + mc._yvel;
mc._x = mc._x + mc._xvel;
if (mc._x < 0) {
mc._x = -mc._x;
mc._xvel = -mc._xvel;
} else if (mc._x > gFieldWidth) {
mc._x = gFieldWidth + (gFieldWidth - mc._x);
mc._xvel = -mc._xvel;
}
if (mc._y < 0) {
mc._y = -mc._y;
mc._yvel = -mc._yvel;
} else if (mc._y > gFieldHeight) {
mc._y = gFieldHeight + (gFieldHeight - mc._y);
mc._yvel = -mc._yvel;
}
i++;
}
var r = 0;
var rcount = 0;
var rmax = remarray.length;
while (r < rmax) {
removeMovieClip(gGarbageClips[remarray[r] - rcount]);
gGarbageClips.splice(remarray[r] - rcount, 1);
rcount++;
r++;
}
gMouseXPrev = _parent._xmouse;
gMouseYPrev = _parent._ymouse;
}
onClipEvent (mouseDown) {
gMouseState = gMouseState + 1;
}
onClipEvent (mouseUp) {
gMouseState = 0;
}
Symbol 238 MovieClip [__Packages.GameObj] Frame 0
class GameObj extends Object
{
var uid, _init, destroy, update, tracking, x, y, vx, vy, dirx, diry, impx, impy, coll_x, coll_y, coll_w, coll_h, coll_mask, game_class, game_type, scale_x, scale_y, rotation, clip, clip_name, clip_dup, clip_frame, clip_coll, clip_anim, anim_curr, anim_prev, anim_next, anim_start, anim_stop, anim_speed, anim_time, input_type, input;
function GameObj () {
super();
uid = 0;
_init = 0;
destroy = 0;
update = 0;
tracking = 0;
x = 0;
y = 0;
vx = 0;
vy = 0;
dirx = 1;
diry = 0;
impx = 0;
impy = 0;
coll_x = 0;
coll_y = 0;
coll_w = 0;
coll_h = 0;
coll_mask = 0;
game_class = 0;
game_type = "";
scale_x = 100;
scale_y = 100;
rotation = 0;
clip = null;
clip_name = "";
clip_dup = null;
clip_frame = "";
clip_coll = null;
clip_anim = null;
anim_curr = "";
anim_prev = "";
anim_next = "";
anim_start = 0;
anim_stop = 0;
anim_speed = 1;
anim_time = 0;
input_type = 0;
input = new Object();
input.right = 0;
input.left = 0;
input.up = 0;
input.down = 0;
input.a = 0;
input.b = 0;
input.c = 0;
input.d = 0;
input.e = 0;
input.f = 0;
input.g = 0;
input.h = 0;
}
}
Symbol 239 MovieClip [__Packages.Map] Frame 0
class Map extends Object
{
var hasOwnProperty;
function Map () {
super();
}
function __resolve(inputstr) {
trace("#ERROR - Map does not have key: " + inputstr);
}
function exists(key) {
return(hasOwnProperty(key));
}
function insert(key, value) {
this[key] = value;
}
function remove(key) {
delete this[key];
}
function count() {
var _local2 = 0;
for (var _local3 in this) {
_local2++;
}
return(_local2);
}
function empty() {
for (var _local2 in this) {
return(false);
}
return(true);
}
function first_key() {
for (var _local2 in this) {
return(_local2);
}
return(null);
}
function remove_first_key() {
var _local2 = null;
for (var _local3 in this) {
_local2 = _local3;
break;
}
remove(_local2);
}
function insertSafe(key, value) {
if (!hasOwnProperty(key)) {
this[key] = value;
return(true);
}
return(false);
}
function removeSafe(key) {
if (hasOwnProperty(key)) {
delete this[key];
return(true);
}
return(false);
}
function debugPrint() {
var _local2 = "Map:\n";
for (var _local3 in this) {
_local2 = _local2 + (((("\t" + _local3) + " -> ") + this[_local3]) + newline);
}
return(_local2);
}
}
Symbol 240 MovieClip [__Packages.SpaceHashMap] Frame 0
class SpaceHashMap extends Object
{
var __bin_size, __bin_min, __bin_max, __bins;
function SpaceHashMap () {
super();
}
function __getBinIndex(value) {
return(Math.floor(value / __bin_size));
}
function __getClampedBinIndex(value) {
var _local2 = __getBinIndex(value);
if (_local2 < __bin_min) {
_local2 = __bin_min;
} else if (_local2 >= __bin_max) {
_local2 = __bin_max - 1;
if (_local2 < __bin_min) {
_local2 = __bin_min;
}
}
return(_local2);
}
function __encloseBinIndex(value) {
var _local3 = __getBinIndex(value);
if (_local3 < __bin_min) {
var _local2 = Math.floor(__bin_min - _local3);
while (_local2 > 0) {
__bin_min--;
__bins[String(__bin_min)] = new Map();
_local2--;
}
} else if (_local3 >= __bin_max) {
var _local2 = Math.floor(_local3 - __bin_max) + 1;
while (_local2 > 0) {
__bins[String(__bin_max)] = new Map();
__bin_max++;
_local2--;
}
}
}
function __valueOutsideRange(value) {
var _local2 = __getBinIndex(value);
if (_local2 < __bin_min) {
return(true);
}
if (_local2 >= __bin_max) {
return(true);
}
return(false);
}
function SpaceHashCustom() {
__bins = new Map();
__bin_min = 0;
__bin_max = 1;
__bin_size = 64;
__bins[String(__bin_min)] = new Map();
}
function clear(binsize) {
__bins = new Map();
__bin_min = 0;
__bin_max = 1;
__bin_size = binsize;
__bins[String(__bin_min)] = new Map();
}
function insert(uid, cat, minv, maxv) {
var _local3 = __getClampedBinIndex(minv);
var _local7 = __getClampedBinIndex(maxv);
var _local8 = false;
while (_local3 <= _local7) {
var _local2 = __bins[String(_local3)];
if (!_local2.exists(cat)) {
_local2.insert(cat, new Map());
}
var _local5 = _local2[cat];
_local5.insert(String(uid), uid);
_local3++;
}
return(_local8);
}
function remove(uid, cat, minv, maxv) {
var _local4 = __getClampedBinIndex(minv);
var _local8 = __getClampedBinIndex(maxv);
var _local7 = false;
while (_local4 <= _local8) {
var _local3 = __bins[String(_local4)];
if (_local3.exists(cat)) {
var _local2 = _local3[cat];
if (_local2.exists(String(uid))) {
_local2.remove(String(uid));
_local7 = true;
}
}
_local4++;
}
return(_local7);
}
function exists(uid, cat, minv, maxv) {
var _local3 = __getClampedBinIndex(minv);
var _local6 = __getClampedBinIndex(maxv);
while (_local3 <= _local6) {
var _local2 = __bins[String(_local3)];
if (_local2.exists(cat)) {
var _local4 = _local2[cat];
if (_local4.exists(String(uid))) {
return(true);
}
}
_local3++;
}
return(false);
}
function rangeOutside(minv, maxv) {
return(__valueOutsideRange(minv) || (__valueOutsideRange(maxv)));
}
function encloseRange(minv, maxv) {
__encloseBinIndex(minv);
__encloseBinIndex(maxv);
}
function getRangeMin() {
return(__bin_min * __bin_size);
}
function getRangeMax() {
return(__bin_max * __bin_size);
}
function getBinSize() {
return(__bin_size);
}
function get(cat, minv, maxv) {
var _local5 = new Map();
var _local4 = __getClampedBinIndex(minv);
var _local8 = __getClampedBinIndex(maxv);
while (_local4 <= _local8) {
var _local3 = __bins[String(_local4)];
if (_local3.exists(cat)) {
var _local2 = _local3[cat];
for (var _local7 in _local2) {
_local5.insert(String(_local7), _local7);
}
}
_local4++;
}
return(_local5);
}
function debugPrint() {
var _local2 = ((((("Space Hash: min:" + __bin_min) + " max:") + __bin_max) + " size:") + __bin_size) + newline;
var _local5 = __bin_min;
var _local8 = __bin_max;
while (_local5 <= _local8) {
var _local4 = __bins[String(_local5)];
_local2 = _local2 + (((((("\tBin " + _local5) + " ") + (__bin_size * _local5)) + " ") + _local4.count()) + newline);
for (var _local7 in _local4) {
var _local3 = _local4[String(_local7)];
_local2 = _local2 + (((("\t\tCat " + _local7) + " ") + _local3.count()) + newline);
_local2 = _local2 + "\t\t\tVals:\t";
for (var _local6 in _local3) {
_local2 = _local2 + (_local6 + ", ");
}
_local2 = _local2 + newline;
}
_local5++;
}
return(_local2);
}
}
Symbol 18 MovieClip Frame 1
stop();
Symbol 18 MovieClip Frame 6
stop();
Symbol 18 MovieClip Frame 11
stop();
Symbol 18 MovieClip Frame 18
stop();
Symbol 19 MovieClip Frame 1
dup_shape._visible = false;
stop();
Symbol 23 MovieClip Frame 1
_parent.anim_start = 1;
Symbol 23 MovieClip Frame 15
_parent.anim_stop = 1;
Symbol 48 MovieClip Frame 5
_parent.anim_start = 1;
Symbol 48 MovieClip Frame 11
_parent.anim_stop = 1;
Symbol 67 MovieClip Frame 1
_parent.anim_start = 1;
Symbol 67 MovieClip Frame 9
_parent.anim_stop = 1;
Symbol 67 MovieClip Frame 10
_parent.anim_start = 1;
Symbol 67 MovieClip Frame 14
_parent.anim_stop = 1;
Symbol 67 MovieClip Frame 15
_parent.anim_start = 1;
Symbol 67 MovieClip Frame 45
_parent.anim_stop = 1;
Symbol 67 MovieClip Frame 50
_parent.anim_start = 1;
Symbol 67 MovieClip Frame 67
_parent.anim_stop = 1;
Symbol 103 MovieClip Frame 3
_parent.anim_start = 1;
head.gotoAndStop("norm");
Symbol 103 MovieClip Frame 10
_parent.anim_stop = 1;
Symbol 103 MovieClip Frame 15
_parent.anim_start = 1;
head.gotoAndStop("norm");
Symbol 103 MovieClip Frame 45
_parent.anim_stop = 1;
Symbol 103 MovieClip Frame 50
_parent.anim_start = 1;
head.gotoAndStop("openmid");
Symbol 103 MovieClip Frame 55
head.gotoAndStop("open");
Symbol 103 MovieClip Frame 59
head.gotoAndStop("gape");
Symbol 103 MovieClip Frame 62
head.gotoAndStop("open");
Symbol 103 MovieClip Frame 67
head.gotoAndStop("gape");
Symbol 103 MovieClip Frame 71
head.gotoAndStop("happy");
Symbol 103 MovieClip Frame 93
_parent.anim_stop = 1;
head.gotoAndStop("happy");
Symbol 103 MovieClip Frame 97
_parent.anim_start = 1;
head.gotoAndStop("happy");
Symbol 103 MovieClip Frame 132
_parent.anim_stop = 1;
head.gotoAndStop("happy");
Symbol 103 MovieClip Frame 138
_parent.anim_start = 1;
head.gotoAndStop("norm");
Symbol 103 MovieClip Frame 145
head.gotoAndStop("happy");
Symbol 103 MovieClip Frame 150
head.gotoAndStop("gape");
Symbol 103 MovieClip Frame 154
head.gotoAndStop("happy");
Symbol 103 MovieClip Frame 158
head.gotoAndStop("norm");
Symbol 103 MovieClip Frame 161
_parent.anim_stop = 1;
Symbol 103 MovieClip Frame 166
_parent.anim_start = 1;
head.gotoAndStop("gape");
Symbol 103 MovieClip Frame 207
_parent.anim_stop = 1;
Symbol 103 MovieClip Frame 211
_parent.anim_start = 1;
head.gotoAndStop("gape");
Symbol 103 MovieClip Frame 216
head.gotoAndStop("happy");
Symbol 103 MovieClip Frame 221
head.gotoAndStop("gape");
Symbol 103 MovieClip Frame 224
head.gotoAndStop("happy");
_parent.poop_complete = 1;
Symbol 103 MovieClip Frame 228
head.gotoAndStop("norm");
Symbol 103 MovieClip Frame 229
_parent.anim_stop = 1;
Symbol 103 MovieClip Frame 233
_parent.anim_start = 1;
head.gotoAndStop("gape");
Symbol 103 MovieClip Frame 237
head.gotoAndStop("happy");
Symbol 103 MovieClip Frame 262
head.gotoAndStop("norm");
Symbol 103 MovieClip Frame 265
_parent.anim_stop = 1;
Symbol 121 MovieClip Frame 1
_parent.anim_start = 1;
Symbol 121 MovieClip Frame 8
_parent.anim_stop = 1;
Symbol 121 MovieClip Frame 13
_parent.anim_start = 1;
Symbol 121 MovieClip Frame 33
_parent.anim_stop = 1;
Symbol 121 MovieClip Frame 38
_parent.anim_start = 1;
Symbol 121 MovieClip Frame 68
_parent.anim_stop = 1;
Symbol 139 MovieClip Frame 10
stop();
Symbol 153 MovieClip Frame 1
_parent.anim_start = 1;
Symbol 153 MovieClip Frame 35
_parent.anim_stop = 1;
Symbol 153 MovieClip Frame 40
_parent.anim_start = 1;
Symbol 153 MovieClip Frame 70
_parent.anim_stop = 1;
Symbol 153 MovieClip Frame 75
_parent.anim_start = 1;
Symbol 153 MovieClip Frame 81
_parent.anim_stop = 1;
Symbol 153 MovieClip Frame 91
_parent.anim_start = 1;
Symbol 153 MovieClip Frame 121
_parent.anim_stop = 1;
Symbol 153 MovieClip Frame 194
_parent.anim_start = 1;
Symbol 153 MovieClip Frame 239
_parent.anim_stop = 1;
Symbol 153 MovieClip Frame 240
_parent.anim_start = 1;
Symbol 153 MovieClip Frame 245
_parent.anim_stop = 1;
Symbol 153 MovieClip Frame 246
_parent.anim_start = 1;
Symbol 153 MovieClip Frame 255
_parent.anim_stop = 1;
Symbol 153 MovieClip Frame 256
_parent.anim_start = 1;
Symbol 153 MovieClip Frame 265
_parent.anim_stop = 1;
Symbol 153 MovieClip Frame 266
_parent.anim_start = 1;
Symbol 153 MovieClip Frame 276
_parent.anim_stop = 1;
Symbol 153 MovieClip Frame 277
_parent.anim_start = 1;
Symbol 153 MovieClip Frame 286
_parent.anim_stop = 1;
Symbol 153 MovieClip Frame 287
_parent.anim_start = 1;
Symbol 153 MovieClip Frame 302
_parent.anim_stop = 1;
Symbol 153 MovieClip Frame 347
_parent.anim_start = 1;
Symbol 154 MovieClip Frame 1
this.game = _parent;
this.anim_stop = 0;
this.anim_start = 0;
this.init = function (gobj) {
};
this.runAI = function (gobj) {
};
this.run = function (gobj) {
};
Symbol 154 MovieClip Frame 5
this.init = function (gobj) {
game.setAnim(gobj, "idle", "idle");
};
this.runAI = function (gobj) {
if (game.getInputType(gobj) == 1) {
var _local1 = game.getInputs(gobj);
_local1.right = Key.isDown(39);
_local1.left = Key.isDown(37);
_local1.up = Key.isDown(38);
_local1.down = Key.isDown(40);
var _local2 = Key.isDown(32);
if (_local2 > 0) {
_local1.a++;
} else {
_local1.a = 0;
}
_local1.b = 0;
_local1.c = 0;
_local1.d = 0;
} else {
_local1.right = 0;
_local1.left = 0;
_local1.up = 0;
_local1.down = 0;
_local1.a = 0;
_local1.b = 0;
_local1.c = 0;
_local1.d = 0;
}
};
this.run = function (gobj) {
var _local2 = game.getInputs(gobj);
var _local4 = _local2.right - _local2.left;
var _local3 = _local2.up - _local2.down;
if (_local4 != 0) {
gobj.dirx = _local4;
}
if (_local3 != 0) {
gobj.diry = _local3;
}
game.applyImpulseClamped(gobj, _local4, _local3, 4 * _local4, 4 * _local3);
if (_local2.a == 1) {
game.playSound("Space Gun 06.wav");
var _local5 = game.addBullet(gobj.x + (gobj.dirx * 6), gobj.y + 10, (gobj.dirx * 64) + gobj.vx, gobj.vy, 0, "GenericGreen");
var _local6 = game.getObjData(_local5);
_local6.owner_uid = game.getUID(gobj);
}
game.motionPlatformChar(gobj);
};
Symbol 154 MovieClip Frame 12
this.init = function (gobj) {
game.setAnim(gobj, "idle", "idle");
};
this.runAI = function (gobj) {
if (getInputType(gobj)) {
}
};
this.run = function (gobj) {
var _local1 = getInputs(gobj);
var _local3 = _local1.input_right - _local1.input_left;
var _local2 = _local1.input_up - _local1.input_down;
if (_local3 != 0) {
gobj.dirx = _local3;
}
if (_local2 != 0) {
gobj.diry = _local2;
}
game.applyObjImpulseClamped(gobj.uid, _local3, _local2, 4 * _local3, 4 * _local2);
game.movePlatformChar(gobj);
};
Symbol 154 MovieClip Frame 19
this.grabbed_target = -1;
this.grabbed_timer = 0;
this.init = function (gobj) {
grabbed_target = -1;
grabbed_timer = 30;
game.setAnim(gobj, "idle", "idle");
};
this.runAI = function (gobj) {
if (grabbed_target < 0) {
if (grabbed_timer == 0) {
var _local2 = game.calcRelativePoint(gobj, 0, 10);
var _local1 = game.pointHitsFirstChar(_local2.x, _local2.y);
if (_local1 > 0) {
game.makeAbove(gobj, game.getObj(_local1));
game.setAnim(gobj, "close", "closed");
grabbed_target = _local1;
grabbed_timer = 60;
}
} else {
grabbed_timer--;
}
}
gobj.update = 1;
};
this.run = function (gobj) {
if (grabbed_target > 0) {
var _local1 = game.getObj(grabbed_target);
_local1.x = gobj.x;
_local1.y = gobj.y;
_local1.vx = 0;
_local1.vy = 0;
_local1.rotation = game.getRotation(gobj);
grabbed_timer--;
if (grabbed_timer == 0) {
var _local3 = game.calcRelativePoint(gobj, (Math.random() * 2) - 1, 2);
game.applyImpulse(_local1, _local3.lx, _local3.ly);
_local1.rotation = 0;
grabbed_target = -1;
grabbed_timer = 30;
game.setAnim(gobj, "spit", "idle");
}
}
};
Symbol 154 MovieClip Frame 29
this.grabbed_target = -1;
this.grabbed_timer = 0;
this.grabbed_target_moving = 0;
this.digestion_state = 0;
this.init = function (gobj) {
game.setAnim(gobj, "idle", "idle");
};
this.runAI = function (gobj) {
if (game.getInputType(gobj) == 1) {
var _local1 = game.getInputs(gobj);
_local1.right = Key.isDown(39);
_local1.left = Key.isDown(37);
_local1.up = Key.isDown(38);
_local1.down = Key.isDown(40);
_local1.a = Key.isDown(32);
_local1.b = 0;
_local1.c = 0;
_local1.d = 0;
}
if (grabbed_timer < 1) {
var _local4 = game.calcRelativePoint(gobj, -40, 50);
var _local2 = game.pointHitsFirstChar(_local4.x, _local4.y);
if (_local2 > 0) {
grabbed_target = _local2;
game.makeAbove(gobj, game.getObj(_local2));
game.setAnim(gobj, "swallow", "digest");
grabbed_timer = 120;
game.playSound("SD_ToonGulp00.wav");
grabbed_target_moving = 0;
digestion_state = 0;
} else {
grabbed_timer = 0;
}
} else if (grabbed_target > 0) {
} else {
grabbed_timer--;
}
};
this.run = function (gobj) {
var _local3 = game.getInputs(gobj);
var _local5 = _local3.right - _local3.left;
var _local4 = _local3.up - _local3.down;
if (_local5 != 0) {
gobj.dirx = _local5;
}
if (_local4 != 0) {
gobj.diry = _local4;
}
game.applyImpulseClamped(gobj, _local5, _local4, 4 * _local5, 4 * _local4);
game.motionPlatformChar(gobj);
if (grabbed_target > 0) {
var _local1 = game.getObj(grabbed_target);
var _local9 = Math.cos(((90 - mc.head_target._rotation) * Math.PI) / 180);
var _local8 = Math.sin(((90 - mc.head_target._rotation) * Math.PI) / 180);
var _local7 = gobj.x + (((gobj.scale_x / 100) * ((mc._xscale / 100) * mc.head_target._x)) - (_local1.coll_h * _local9));
var _local6 = gobj.y - (((gobj.scale_y / 100) * ((mc._yscale / 100) * mc.head_target._y)) + (_local1.coll_h * _local8));
_local1.x = _local7;
_local1.y = _local6;
mc.bulger.bulge._xscale = 100 + (25 * (Math.abs(_local1.input.left) + Math.abs(_local1.input.right)));
mc.bulger.bulge._yscale = 100 + (50 * (Math.abs(_local1.input.up) - Math.abs(_local1.input.down)));
if ((((_local1.input.left != 0) || (_local1.input.right != 0)) || (_local1.input.up != 0)) || (_local1.input.down != 0)) {
grabbed_target_moving++;
} else {
grabbed_target_moving = 0;
}
if (grabbed_target_moving == 1) {
game.playSound("SD_MovePulse.wav");
}
grabbed_timer = grabbed_timer - (((Math.abs(_local1.input.left) + Math.abs(_local1.input.right)) + Math.abs(_local1.input.up)) + Math.abs(_local1.input.down));
if (grabbed_timer < 30) {
grabbed_timer = grabbed_timer + 0.5;
}
if (digestion_state < 120) {
if (game.getAnim(gobj) == "digest") {
digestion_state++;
}
} else if (digestion_state == 120) {
grabbed_timer = 30;
game.setAnim(gobj, "to_intestine", "in_intestine");
digestion_state++;
} else if (digestion_state > 120) {
if (game.getAnim(gobj) == "in_intestine") {
digestion_state++;
}
if (grabbed_timer < 1) {
game.setAnim(gobj, "poop_out", "idle");
} else if (digestion_state > 360) {
game.setAnim(gobj, "poop_absorb", "idle");
_local1.destroy = 1;
grabbed_target = -1;
grabbed_timer = 60;
gobj.input_type = 1;
game.setViewObj(gobj);
}
}
if (gobj.clip.poop_complete == 1) {
gobj.clip.poop_complete = 0;
digestion_state = 0;
grabbed_timer = 0;
}
if (grabbed_target >= 0) {
_local1.vx = 0;
_local1.vy = 0;
_local1.rotation = mc.head_target._rotation;
game.m_view_zoom = 4;
if ((grabbed_timer < 1) && (digestion_state < 120)) {
_local1.rotation = 0;
_local1.vx = 4 * gobj.dirx;
_local1.vy = 0;
grabbed_target = -1;
grabbed_timer = 30;
game.m_view_zoom = 1;
game.setAnim(gobj, "idle", "idle");
}
}
}
};
Symbol 154 MovieClip Frame 39
this.grabbed_target = -1;
this.grabbed_timer = 30;
this.init = function (gobj) {
game.setAnim(gobj, "idle", "idle");
};
this.runAI = function (gobj) {
if (grabbed_target > 0) {
} else if (grabbed_timer < 1) {
var _local3 = game.calcRelativePoint(gobj, -10, 10);
var _local1 = game.pointHitsFirstChar(_local3.x, _local3.y, gobj.uid);
if (_local1 > 0) {
trace((("Snake hit" + _local1) + " ") + gobj.uid);
if (_local1 != game.getUID(gobj)) {
grabbed_target = _local1;
game.makeAbove(gobj, game.getObj(_local1));
game.setAnim(gobj, "chomp", "full");
grabbed_timer = 360;
game.playSound("SD_Swallow002.wav");
game.playSound("SD_Swallow001.wav");
}
} else {
grabbed_timer = 0;
}
} else {
grabbed_timer--;
}
};
this.run = function (gobj) {
game.motionPlatformChar(gobj);
if (grabbed_target > 0) {
var _local1 = game.getObj(grabbed_target);
var _local6 = Math.cos(((90 - mc.head_target._rotation) * Math.PI) / 180);
var _local5 = Math.sin(((90 - mc.head_target._rotation) * Math.PI) / 180);
var _local4 = (gobj.x + ((mc._xscale / 100) * mc.head_target._x)) - (10 * _local6);
var _local3 = (gobj.y - ((mc._yscale / 100) * mc.head_target._y)) - (10 * _local5);
_local1.x = _local4;
_local1.y = _local3;
_local1.rotation = mc.head_target._rotation;
_local1.vx = 0;
_local1.vy = 0;
grabbed_timer--;
if (grabbed_timer < 1) {
grabbed_target = -1;
grabbed_timer = 30;
_local1.rotation = 0;
_local1.vx = 4 * gobj.dirx;
game.setAnim(gobj, "idle", "idle");
}
}
};
Symbol 154 MovieClip Frame 49
this.grabbed_target = -1;
this.grabbed_timer = 0;
this.grabbed_target_moving = 0;
this.init = function (gobj) {
game.setAnim(gobj, "idle", "idle");
};
this.runAI = function (gobj) {
if (game.getInputType(gobj) == 1) {
var _local1 = game.getInputs(gobj);
_local1.right = Key.isDown(39);
_local1.left = Key.isDown(37);
_local1.up = Key.isDown(38);
_local1.down = Key.isDown(40);
_local1.a = Key.isDown(32);
_local1.b = 0;
_local1.c = 0;
_local1.d = 0;
}
if (grabbed_timer < 1) {
var _local4 = game.calcRelativePoint(gobj, 40, 10);
var _local2 = game.pointHitsFirstChar(_local4.x, _local4.y);
if (_local2 > 0) {
grabbed_target = _local2;
game.makeAbove(gobj, game.getObj(_local2));
game.setAnim(gobj, "swallow", "vnone");
grabbed_timer = 10;
game.playSound("SD_ToonGulp00.wav");
grabbed_target_moving = 0;
digestion_state = 0;
} else {
grabbed_timer = 0;
}
} else if (grabbed_target > 0) {
} else {
grabbed_timer--;
}
};
this.run = function (gobj) {
var _local3 = game.getInputs(gobj);
var _local5 = _local3.right - _local3.left;
var _local4 = _local3.up - _local3.down;
if (_local5 != 0) {
gobj.dirx = _local5;
}
if (_local4 != 0) {
gobj.diry = _local4;
}
game.applyImpulseClamped(gobj, _local5, _local4, 4 * _local5, 4 * _local4);
game.motionPlatformChar(gobj);
if (grabbed_target > 0) {
var _local1 = game.getObj(grabbed_target);
var _local9 = Math.cos(((90 - mc.head_target._rotation) * Math.PI) / 180);
var _local8 = Math.sin(((90 - mc.head_target._rotation) * Math.PI) / 180);
var _local7 = gobj.x + (((gobj.scale_x / 100) * ((mc._xscale / 100) * mc.head_target._x)) - (_local1.coll_h * _local9));
var _local6 = gobj.y - (((gobj.scale_y / 100) * ((mc._yscale / 100) * mc.head_target._y)) + (_local1.coll_h * _local8));
_local1.x = _local7;
_local1.y = _local6;
if (game.getAnim(gobj) == "vnone") {
if (_local1.input.left) {
game.setAnim(gobj, "vpush_left", "vnone");
} else if (_local1.input.right) {
game.setAnim(gobj, "vpush_right", "vnone");
} else if (_local1.input.up) {
game.setAnim(gobj, "vpush_up", "vnone");
} else if (_local1.input.down) {
game.setAnim(gobj, "vpush_down", "vnone");
}
if ((((_local1.input.left != 0) || (_local1.input.right != 0)) || (_local1.input.up != 0)) || (_local1.input.down != 0)) {
grabbed_target_moving++;
} else {
grabbed_target_moving = 0;
}
if (grabbed_target_moving == 1) {
game.playSound("SD_MovePulse.wav");
}
grabbed_timer = grabbed_timer - (((Math.abs(_local1.input.left) + Math.abs(_local1.input.right)) + Math.abs(_local1.input.up)) + Math.abs(_local1.input.down));
if (grabbed_timer > 0) {
grabbed_timer = grabbed_timer + 0.5;
}
if (grabbed_timer > 120) {
game.setAnim(gobj, "vexcrete", "idle");
game.playSound("SD_MovePulse.wav");
_local1.destroy = 1;
grabbed_target = -1;
grabbed_timer = 60;
gobj.input_type = 1;
game.setViewObj(gobj);
}
}
if (grabbed_target >= 0) {
_local1.vx = 0;
_local1.vy = 0;
_local1.rotation = mc.head_target._rotation;
game.m_view_zoom = 4;
if (grabbed_timer < 1) {
_local1.rotation = 0;
_local1.vx = 4 * gobj.dirx;
_local1.vy = 0;
grabbed_target = -1;
grabbed_timer = 30;
game.m_view_zoom = 1;
game.setAnim(gobj, "idle", "idle");
}
}
}
};
Symbol 155 MovieClip Frame 1
stop();
Symbol 156 MovieClip Frame 2
stop();
Symbol 156 MovieClip Frame 14
removeMovieClip(this);
Symbol 156 MovieClip Frame 24
removeMovieClip(this);
Symbol 160 MovieClip Frame 1
stop();
Symbol 160 MovieClip Frame 8
stop();
Symbol 168 MovieClip Frame 1
this.sounds = new Map();
this.playSound = function (sname, svolume) {
var _local5 = false;
if (!sounds.exists(sname)) {
sounds[sname] = new Sound(this);
_local5 = true;
}
var _local3 = sounds[sname];
if (_local5) {
_local3.attachSound(sname);
}
_local3.stop(sname);
_local3.start(0, 0);
var _local2 = new Object();
_local2.ll = svolume;
_local2.lr = 0;
_local2.rr = svolume;
_local2.rl = 0;
_local3.setTransform(_local2);
};
stop();
Symbol 168 MovieClip Frame 5
stop();
Symbol 169 MovieClip Frame 1
this.csnd = new Sound(this);
this.csnd2 = new Sound(this);
this.csndtoggle = 0;
this.currfile = null;
this.id3struct = new Object();
this.snd_volscale = 1;
this.snd_nextvol = 0;
this.snd_curvol = 0;
this.snd_delayvol = 30;
this.snd_volstep = 100 / this.snd_delayvol;
csnd.onID3 = function () {
trace(("onID3 called at " + getTimer()) + " ms.");
for (var _local2 in this.id3) {
id3struct[_local2] = this.id3[_local2];
}
};
csnd.onSoundComplete = function () {
loadMusic(currfile);
};
csnd.onLoad = function (success) {
if (success) {
csnd.start();
trace("Sound loaded");
} else {
trace("Sound failed");
}
};
this.setVolumeScale = function (vol) {
if (vol > 1) {
vol = 1;
} else if (vol < 0) {
vol = 0;
}
snd_volscale = vol;
};
this.loadMusic = function (sndfile, crossfade) {
trace(sndfile);
currfile = null;
if (sndfile != null) {
if (crossfade == undefined) {
snd_curvol = 0;
snd_nextvol = 100;
snd_delayvol = 30;
snd_volstep = (snd_nextvol - snd_curvol) / snd_delayvol;
csnd.setVolume(100);
id3struct = new Object();
currfile = sndfile;
csnd.loadSound(sndfile, true);
}
} else {
snd_curvol = 0;
snd_nextvol = 0;
currfile = null;
}
};
this.update = function () {
if (currfile != null) {
snd_curvol = snd_curvol + snd_volstep;
if (snd_curvol > snd_nextvol) {
snd_curvol = snd_nextvol;
snd_volstep = 0;
}
var _local2 = snd_curvol * snd_volscale;
var _local1 = new Object();
_local1.ll = _local2;
_local1.lr = 0;
_local1.rr = _local2;
_local1.rl = 0;
csnd.setTransform(_local1);
}
};
stop();
Symbol 170 MovieClip Frame 2
this.MAIN_CLIP = this;
this.MAIN_PIXELS_PER_METER = 10;
this.MAIN_FPS = 30;
this.MAIN_WIDTH = 960;
this.MAIN_HEIGHT = 540;
this.CLIP_SOUNDS = this.audio_sound;
this.CLIP_MUSIC = this.audio_music;
this.CLIP_COLL = this.dcoll;
this.CLIP_DUP_COLL = this.dcoll.dup_shape;
this.CLIP_BG = null;
this.CLIP_DUP_BG = null;
this.CLIP_FG = null;
this.CLIP_DUP_FG = null;
this.CLIP_BGSCENE = null;
this.CLIP_DUP_DECOR = this.dup_decor;
this.CLIP_DUP_ACTOR = this.dup_char;
this.CLIP_DUP_BULLET = this.dup_bullet;
this.CLIP_DUP_PARTICLE = this.dup_particles;
this.dbg = function (msg, extra1, extra2, extra3, extra4, extra5) {
var _local1 = msg;
if (extra1 != undefined) {
_local1 = _local1 + (" " + String(extra1));
if (extra2 != undefined) {
_local1 = _local1 + (" " + String(extra2));
if (extra3 != undefined) {
_local1 = _local1 + (" " + String(extra3));
if (extra4 != undefined) {
_local1 = _local1 + (" " + String(extra4));
if (extra5 != undefined) {
_local1 = _local1 + (" " + String(extra5));
}
}
}
}
}
trace(_local1);
};
this.flashTraceFilters = function (mc) {
var _local1 = mc.filters;
for (var _local2 in _local1) {
F = _local1[_local2];
trace((("Filter: " + typeof(F)) + " ") + _local2);
for (prop in F) {
trace((("\t" + prop) + ": ") + F[prop]);
}
}
};
this.flashMakeAbove = function (objA, objB) {
var _local2 = objA.getDepth();
var _local1 = objB.getDepth();
if (_local2 < _local1) {
objA.swapDepths(objB);
return(1);
}
return(0);
};
this.flashMakeBelow = function (objA, objB) {
var _local2 = objA.getDepth();
var _local1 = objB.getDepth();
if (_local2 > _local1) {
objA.swapDepths(objB);
return(1);
}
return(0);
};
this.flashKeycodeToString = function (code) {
var _local1 = "UNKNOWN KEYCODE";
switch (code) {
case 8 :
_local1 = "BACKSPACE";
break;
case 20 :
_local1 = "CAPSLOCK";
break;
case 17 :
_local1 = "CONTROL";
break;
case 46 :
_local1 = "DELETE";
break;
case 40 :
_local1 = "DOWN";
break;
case 35 :
_local1 = "END";
break;
case 13 :
_local1 = "ENTER";
break;
case 27 :
_local1 = "ESCAPE";
break;
case 36 :
_local1 = "HOME";
break;
case 45 :
_local1 = "INSERT";
break;
case 37 :
_local1 = "LEFT";
break;
case 34 :
_local1 = "PGDN";
break;
case 33 :
_local1 = "PGUP";
break;
case 39 :
_local1 = "RIGHT";
break;
case 39 :
_local1 = "RIGHT";
break;
case 16 :
_local1 = "SHIFT";
break;
case 32 :
_local1 = "SPACE";
break;
case 9 :
_local1 = "TAB";
break;
case 38 :
_local1 = "UP";
break;
case 96 :
_local1 = "Num 0";
break;
case 97 :
_local1 = "Num 1";
break;
case 98 :
_local1 = "Num 2";
break;
case 99 :
_local1 = "Num 3";
break;
case 100 :
_local1 = "Num 4";
break;
case 101 :
_local1 = "Num 5";
break;
case 102 :
_local1 = "Num 6";
break;
case 103 :
_local1 = "Num 7";
break;
case 104 :
_local1 = "Num 8";
break;
case 105 :
_local1 = "Num 9";
break;
case 106 :
_local1 = "Num Multiply";
break;
case 107 :
_local1 = "Num Add";
break;
case 109 :
_local1 = "Num Subtract";
break;
case 110 :
_local1 = "Num Decimal";
break;
case 111 :
_local1 = "Num Divide";
break;
case 112 :
_local1 = "F1";
break;
case 113 :
_local1 = "F2";
break;
case 114 :
_local1 = "F3";
break;
case 115 :
_local1 = "F4";
break;
case 116 :
_local1 = "F5";
break;
case 117 :
_local1 = "F6";
break;
case 118 :
_local1 = "F7";
break;
case 119 :
_local1 = "F8";
break;
case 120 :
_local1 = "F9";
break;
case 122 :
_local1 = "F11";
break;
case 123 :
_local1 = "F12";
break;
case 124 :
_local1 = "F13";
break;
case 125 :
_local1 = "F14";
break;
case 126 :
_local1 = "F15";
break;
case 144 :
_local1 = "Num Lock";
break;
case 145 :
_local1 = "Scroll Lock";
break;
case 19 :
_local1 = "Pause";
break;
case 186 :
_local1 = "; :";
break;
case 187 :
_local1 = "= +";
break;
case 189 :
_local1 = "- _";
break;
case 191 :
_local1 = "/ ?";
break;
case 192 :
_local1 = "` ~";
break;
case 219 :
_local1 = "[ {";
break;
case 220 :
_local1 = "\\|";
break;
case 221 :
_local1 = "] }";
break;
case 222 :
_local1 = "\" '";
break;
case 188 :
_local1 = ",";
break;
case 190 :
_local1 = ".";
break;
case 191 :
_local1 = "/";
break;
default :
if ((code > 64) && (code < 91)) {
_local1 = chr(code);
} else {
if (!((code > 47) && (code < 57))) {
break;
}
_local1 = String(code - 48);
}
}
return(_local1);
};
this.flashXMLUserBegin = function (UserObject) {
};
this.flashXMLUserData = function (N, UserObject) {
};
this.flashXMLUserEnd = function (UserObject) {
};
this.flashXMLUserError = function (tracestring, UserObject) {
};
this.flashXMLLoad = function (filename, userData, userBegin, userEnd, userError) {
if ((userData == undefined) || (userData == null)) {
userData = flashXMLUserData;
}
if ((userBegin == undefined) || (userBegin == null)) {
userBegin = flashXMLUserBegin;
}
if ((userEnd == undefined) || (userEnd == null)) {
userEnd = flashXMLUserEnd;
}
if ((userError == undefined) || (userError == null)) {
userError = flashXMLUserError;
}
this._curr_xml = new XML();
this._curr_xml.userobject = this;
this.userData = userData;
this.userBegin = userBegin;
this.userEnd = userEnd;
this.userError = userError;
this._curr_xml.ignoreWhite = true;
XML.prototype.ignoreWhite = true;
this._curr_xml.onHTTPStatus = function (httpStatus) {
var _local2 = this.userobject;
_local2.httpStatus = httpStatus;
if (httpStatus < 100) {
_local2.httpStatusType = "flashError";
} else if (httpStatus < 200) {
_local2.httpStatusType = "informational";
} else if (httpStatus < 300) {
_local2.httpStatusType = "successful";
} else if (httpStatus < 400) {
_local2.httpStatusType = "redirection";
} else if (httpStatus < 500) {
_local2.httpStatusType = "clientError";
} else if (httpStatus < 600) {
_local2.httpStatusType = "serverError";
} else {
_local2.httpStatusType = "unknown: " + httpStatus;
}
};
this._curr_xml.onLoad = function (success) {
var _local2 = this.userobject;
var _local9 = _local2._curr_xml;
if (success != 0) {
_local2.userBegin(_local2);
var _local8 = _local9.firstChild;
var _local3 = _local8.firstChild;
while (_local3 != null) {
var _local5 = new XML(String(_local3));
var _local4 = _local5.firstChild;
var _local7 = _local4.attributes;
try {
_local2.userData(_local4, _local2);
} catch(_local) {
if (Error( /* Error999 */
) != null) {
var myError = Error( /* Error999 */
);
_local2.userError("XML: error caught: " + myError, _local2);
} else {
var e = ( /* Error999 */
);
_local2.userError("XML: Unkown error caught: " + e.toString(), _local2);
}
}
_local3 = _local3.nextSibling;
}
if (_local9.status == 0) {
} else {
_local2.userError("XML: XML was loaded successfully, but was unable to be parsed.", _local2);
}
var _local6;
switch (_local9.status) {
case 0 :
_local6 = "No error; parse was completed successfully.";
break;
case -2 :
_local6 = "A CDATA section was not properly terminated.";
break;
case -3 :
_local6 = "The XML declaration was not properly terminated.";
break;
case -4 :
_local6 = "The DOCTYPE declaration was not properly terminated.";
break;
case -5 :
_local6 = "A comment was not properly terminated.";
break;
case -6 :
_local6 = "An XML element was malformed.";
break;
case -7 :
_local6 = "Out of memory.";
break;
case -8 :
_local6 = "An attribute value was not properly terminated.";
break;
case -9 :
_local6 = "A start-tag was not matched with an end-tag.";
break;
case -10 :
_local6 = "An end-tag was encountered without a matching start-tag.";
break;
default :
_local6 = "An unknown error has occurred.";
}
_local2.userError(((("XML: status: " + _local9.status) + " (") + _local6) + ")", _local2);
} else {
_local2.userError(("XML: Unable to load/parse XML. (status: " + _local9.status) + ")", _local2);
}
_local2.userEnd(_local2);
return(0);
};
this._curr_xml.load(filename);
return(0);
};
this.COLL_TYPE_NONE = 0;
this.COLL_TYPE_Xp = 1;
this.COLL_TYPE_Yp = 2;
this.COLL_TYPE_Xn = 4;
this.COLL_TYPE_Yn = 8;
this.COLL_TYPE_INITIAL = 16;
this.COLL_TYPE_INSIDE = 32;
this.COLL_TYPE_SIDE = ((COLL_TYPE_Xp | COLL_TYPE_Yp) | COLL_TYPE_Xn) | COLL_TYPE_Yn;
this.COLL_TYPE_ANY = (COLL_TYPE_SIDE | COLL_TYPE_INITIAL) | COLL_TYPE_INSIDE;
this.COLL_SHAPE_BOX = 0;
this.COLL_SHAPE_RAMP_Xp_Yp = 4;
this.COLL_SHAPE_RAMP_Xn_Yp = 5;
this.COLL_SHAPE_RAMP_Xn_Yn = 6;
this.COLL_SHAPE_RAMP_Xp_Yn = 7;
this.COLL_SHAPE_PLATFORM_Xp = 8;
this.COLL_SHAPE_PLATFORM_Yp = 9;
this.COLL_SHAPE_PLATFORM_Xn = 10;
this.COLL_SHAPE_PLATFORM_Yn = 11;
this.COLL_SHAPE_RAMPFORM_Xp_Yp = 12;
this.COLL_SHAPE_RAMPFORM_Xn_Yp = 13;
this.COLL_SHAPE_RAMPFORM_Xn_Yn = 14;
this.COLL_SHAPE_RAMPFORM_Xp_Yn = 15;
this.coll_CopyObject = function (A, B) {
for (x in A) {
B[x] = A[x];
}
return(B);
};
this.coll_DBoxBox = function (px, py, vx, vy, aw, ah, bw, bh) {
var _local1 = new Object();
var _local14 = bw + aw;
var _local13 = bh + ah;
var _local7 = 0;
var _local10 = 0;
if (px > bw) {
if (py > bh) {
var _local15 = ((-(bh - py)) * vx) + ((bw - px) * vy);
if (_local15 < 0) {
_local7 = 2;
_local10 = 1;
} else {
_local7 = 1;
_local10 = 2;
}
} else if (py < (-bh)) {
var _local15 = ((-((-bh) - py)) * vx) + ((bw - px) * vy);
if (_local15 < 0) {
_local7 = 1;
_local10 = 6;
} else {
_local7 = 6;
_local10 = 1;
}
} else {
_local7 = 1;
}
} else if (px < (-bw)) {
if (py > bh) {
var _local15 = ((-(bh - py)) * vx) + (((-bw) - px) * vy);
if (_local15 < 0) {
_local7 = 5;
_local10 = 2;
} else {
_local7 = 2;
_local10 = 5;
}
} else if (py < (-bh)) {
var _local15 = ((-((-bh) - py)) * vx) + (((-bw) - px) * vy);
if (_local15 < 0) {
_local7 = 6;
_local10 = 5;
} else {
_local7 = 5;
_local10 = 6;
}
} else {
_local7 = 5;
}
} else if (py > bh) {
_local7 = 2;
} else if (py < (-bh)) {
_local7 = 6;
} else {
_local7 = 8;
}
var _local4 = COLL_TYPE_NONE;
while (_local7 > 0) {
switch (_local7) {
case 1 :
_local7 = 0;
if (vx < 0) {
_local1.hit_time = ((bw + aw) - px) / vx;
if (_local1.hit_time < 1) {
_local1.nx = 1;
_local1.ny = 0;
_local1.x = px + (_local1.hit_time * vx);
if (_local1.hit_time < 0) {
_local1.hit_time = 0;
}
_local1.y = py + (_local1.hit_time * vy);
if ((_local1.y > _local13) || (_local1.y < (-_local13))) {
_local7 = _local10;
_local10 = 0;
} else {
_local4 = COLL_TYPE_Xp;
}
}
}
break;
case 2 :
_local7 = 0;
if (vy < 0) {
_local1.hit_time = ((bh + ah) - py) / vy;
if (_local1.hit_time < 1) {
_local1.nx = 0;
_local1.ny = 1;
_local1.y = py + (_local1.hit_time * vy);
if (_local1.hit_time < 0) {
_local1.hit_time = 0;
}
_local1.x = px + (_local1.hit_time * vx);
if ((_local1.x > _local14) || (_local1.x < (-_local14))) {
_local7 = _local10;
_local10 = 0;
} else {
_local4 = COLL_TYPE_Yp;
}
}
}
break;
case 5 :
_local7 = 0;
if (vx > 0) {
_local1.hit_time = (-((bw + aw) + px)) / vx;
if (_local1.hit_time < 1) {
_local1.nx = -1;
_local1.ny = 0;
_local1.x = px + (_local1.hit_time * vx);
if (_local1.hit_time < 0) {
_local1.hit_time = 0;
}
_local1.y = py + (_local1.hit_time * vy);
if ((_local1.y > _local13) || (_local1.y < (-_local13))) {
_local7 = _local10;
_local10 = 0;
} else {
_local4 = COLL_TYPE_Xn;
}
}
}
break;
case 6 :
_local7 = 0;
if (vy > 0) {
_local1.hit_time = (-((bh + ah) + py)) / vy;
if (_local1.hit_time < 1) {
_local1.nx = 0;
_local1.ny = -1;
_local1.y = py + (_local1.hit_time * vy);
if (_local1.hit_time < 0) {
_local1.hit_time = 0;
}
_local1.x = px + (_local1.hit_time * vx);
if ((_local1.x > _local14) || (_local1.x < (-_local14))) {
_local7 = _local10;
_local10 = 0;
} else {
_local4 = COLL_TYPE_Yn;
}
}
}
break;
case 8 :
default :
_local7 = 0;
_local1.hit_time = 0;
_local1.y = py;
_local1.x = px;
_local4 = COLL_TYPE_INITIAL;
if (px > bw) {
if (py > bh) {
if ((-((bw - px) / aw)) > (-((bh - py) / ah))) {
_local1.ny = 0;
_local1.nx = 1;
_local1.x = bw + aw;
_local4 = _local4 | COLL_TYPE_Xp;
} else {
_local1.ny = 1;
_local1.nx = 0;
_local1.y = bh + ah;
_local4 = _local4 | COLL_TYPE_Yp;
}
} else if (py < (-bh)) {
if ((-((bw - px) / aw)) > (((-bh) - py) / ah)) {
_local1.ny = 0;
_local1.nx = 1;
_local1.x = bw + aw;
_local4 = _local4 | COLL_TYPE_Xp;
} else {
_local1.ny = -1;
_local1.nx = 0;
_local1.y = (-bh) - ah;
_local4 = _local4 | COLL_TYPE_Yn;
}
} else {
_local1.ny = 0;
_local1.nx = 1;
_local1.x = bw + aw;
_local4 = _local4 | COLL_TYPE_Xp;
}
} else if (px < (-bw)) {
if (py > bh) {
if ((((-bw) - px) / aw) > (-((bh - py) / ah))) {
_local1.ny = 0;
_local1.nx = -1;
_local1.x = (-bw) - aw;
_local4 = _local4 | COLL_TYPE_Xn;
} else {
_local1.ny = 1;
_local1.nx = 0;
_local1.y = bh + ah;
_local4 = _local4 | COLL_TYPE_Yp;
}
} else if (py < (-bh)) {
if ((((-bw) - px) / aw) > (((-bh) - py) / ah)) {
_local1.ny = 0;
_local1.nx = -1;
_local1.x = (-bw) - aw;
_local4 = _local4 | COLL_TYPE_Xn;
} else {
_local1.ny = -1;
_local1.nx = 0;
_local1.y = (-bh) - ah;
_local4 = _local4 | COLL_TYPE_Yp;
}
} else {
_local1.ny = 0;
_local1.nx = -1;
_local1.x = (-bw) - aw;
_local4 = _local4 | COLL_TYPE_Xn;
}
} else if (py > bh) {
_local1.ny = 1;
_local1.nx = 0;
_local1.y = bh + ah;
_local4 = _local4 | COLL_TYPE_Yp;
} else if (py < (-bh)) {
_local1.ny = -1;
_local1.nx = 0;
_local1.y = (-bh) - ah;
_local4 = _local4 | COLL_TYPE_Yn;
} else {
_local4 = COLL_TYPE_INSIDE;
}
}
}
_local1.returned = _local4;
return(_local1);
};
this.coll_DBoxPlane = function (px, py, vx, vy, aw, ah, pnx, pny) {
var _local1 = new Object();
var _local3 = pnx;
var _local2 = pny;
var _local6 = aw * _local3;
var _local5 = ah * _local2;
_local6 = ((_local6 < 0) ? (-_local6) : (_local6));
_local5 = ((_local5 < 0) ? (-_local5) : (_local5));
var _local9 = _local6 + _local5;
var _local4 = (_local3 * px) + (_local2 * py);
var _local12 = (_local4 + (_local3 * vx)) + (_local2 * vy);
var _local8 = 0;
if (_local4 > 0) {
if (_local4 < _local9) {
var _local11 = -px;
var _local10 = -py;
if (_local3 < 0) {
_local11 = _local11 - aw;
} else {
_local11 = _local11 + aw;
}
if (_local2 < 0) {
_local10 = _local10 - ah;
} else {
_local10 = _local10 + ah;
}
var _local7 = 0.5 * ((_local3 * _local11) + (_local2 * _local10));
_local1.x = px + (_local7 / _local3);
_local1.y = py + (_local7 / _local2);
_local1.hit_time = 0;
_local8 = 1;
} else if (_local12 <= _local9) {
var _local7 = _local12 - _local4;
if (_local7 < 0) {
_local7 = -_local7;
}
_local1.hit_time = ((_local7 == 0) ? 0 : ((_local4 - _local9) / _local7));
_local1.hit_time = ((_local1.hit_time > 1) ? 1 : (((_local1.hit_time < 0) ? 0 : (_local1.hit_time))));
_local1.x = px + (vx * _local1.hit_time);
_local1.y = py + (vy * _local1.hit_time);
_local8 = 1;
}
}
_local1.returned = _local8;
return(_local1);
};
this.coll_DBoxToShape = function (A, vx, vy, B) {
var _local2 = coll_DBoxBox(A.x - B.x, A.y - B.y, vx, vy, A.w, A.h, B.w, B.h);
var _local5 = _local2.returned;
if (_local5 != COLL_TYPE_NONE) {
var _local4 = _local5;
switch (B.type) {
case COLL_SHAPE_BOX :
if (_local5 != COLL_TYPE_INSIDE) {
_local4 = _local5;
}
break;
case COLL_SHAPE_RAMP_Xp_Yp :
var _local12 = (-B.w) + A.w;
var _local11 = (-B.h) + A.h;
_local4 = 0;
var _local8 = coll_DBoxPlane(A.x - B.x, A.y - B.y, vx, vy, A.w, A.h, B.h, B.w);
var _local10 = _local8.returned;
if (_local10 != 0) {
if ((_local8.x >= _local12) && (_local8.y >= _local11)) {
_local2.x = _local8.x;
_local2.y = _local8.y;
_local2.nx = _local8.nx;
_local2.ny = _local8.ny;
_local2.hit_time = _local8.hit_time;
var _local9 = Math.sqrt((B.w * B.w) + (B.h * B.h));
_local2.nx = B.h / _local9;
_local2.ny = B.w / _local9;
_local4 = COLL_TYPE_Xp | COLL_TYPE_Yp;
}
}
if (_local4 == 0) {
if ((_local2.x < _local12) || (_local2.y < _local11)) {
_local4 = _local5;
}
}
break;
case COLL_SHAPE_RAMP_Xn_Yp :
_local12 = B.w - A.w;
_local11 = (-B.h) + A.h;
_local4 = 0;
_local8 = coll_DBoxPlane(A.x - B.x, A.y - B.y, vx, vy, A.w, A.h, -B.h, B.w);
_local10 = _local8.returned;
if (_local10 != 0) {
if ((_local8.x <= _local12) && (_local8.y >= _local11)) {
_local2.x = _local8.x;
_local2.y = _local8.y;
_local2.nx = _local8.nx;
_local2.ny = _local8.ny;
_local2.hit_time = _local8.hit_time;
var _local9 = Math.sqrt((B.w * B.w) + (B.h * B.h));
_local2.nx = (-B.h) / _local9;
_local2.ny = B.w / _local9;
_local4 = COLL_TYPE_Xn | COLL_TYPE_Yp;
}
}
if (_local4 == 0) {
if ((_local2.x > _local12) || (_local2.y < _local11)) {
_local4 = _local5;
}
}
break;
case COLL_SHAPE_RAMP_Xn_Yn :
_local12 = B.w - A.w;
_local11 = B.h - A.h;
_local4 = 0;
_local8 = coll_DBoxPlane(A.x - B.x, A.y - B.y, vx, vy, A.w, A.h, -B.h, -B.w);
_local10 = _local8.returned;
if (_local10 != 0) {
if ((_local8.x <= _local12) && (_local8.y <= _local11)) {
_local2.x = _local8.x;
_local2.y = _local8.y;
_local2.hit_time = _local8.hit_time;
var _local9 = Math.sqrt((B.w * B.w) + (B.h * B.h));
_local2.nx = (-B.h) / _local9;
_local2.ny = (-B.w) / _local9;
_local4 = COLL_TYPE_Xn | COLL_TYPE_Yn;
}
}
if (_local4 == 0) {
if ((_local2.x > _local12) || (_local2.y > _local11)) {
_local4 = _local5;
}
}
break;
case COLL_SHAPE_RAMP_Xp_Yn :
_local12 = (-B.w) + A.w;
_local11 = B.h - A.h;
_local4 = 0;
_local8 = coll_DBoxPlane(A.x - B.x, A.y - B.y, vx, vy, A.w, A.h, B.h, -B.w);
_local10 = _local8.returned;
if (_local10 != 0) {
if ((_local8.x >= _local12) && (_local8.y <= _local11)) {
_local2.x = _local8.x;
_local2.y = _local8.y;
_local2.nx = _local8.nx;
_local2.ny = _local8.ny;
_local2.hit_time = _local8.hit_time;
var _local9 = Math.sqrt((B.w * B.w) + (B.h * B.h));
_local2.nx = B.h / _local9;
_local2.ny = (-B.w) / _local9;
_local4 = COLL_TYPE_Xp | COLL_TYPE_Yn;
}
}
if (_local4 == 0) {
if ((_local2.x < _local12) || (_local2.y > _local11)) {
_local4 = _local5;
}
}
break;
case COLL_SHAPE_PLATFORM_Xp :
if ((_local5 & COLL_TYPE_Xp) != 0) {
if (vx < 0) {
_local4 = _local5;
}
}
break;
case COLL_SHAPE_PLATFORM_Yp :
if ((_local5 & COLL_TYPE_Yp) != 0) {
if (vy < 0) {
_local4 = _local5;
}
}
break;
case COLL_SHAPE_PLATFORM_Xn :
if ((_local5 & COLL_TYPE_Xn) != 0) {
if (vx > 0) {
_local4 = _local5;
}
}
break;
case COLL_SHAPE_PLATFORM_Yn :
if ((_local5 & COLL_TYPE_Yn) != 0) {
if (vy > 0) {
_local4 = _local5;
}
}
break;
case COLL_SHAPE_RAMPFORM_Xp_Yp :
if (((vx * B.h) + (vy * B.w)) < 0) {
_local12 = (-B.w) + A.w;
_local11 = (-B.h) + A.h;
_local4 = 0;
_local8 = coll_DBoxPlane(A.x - B.x, A.y - B.y, vx, vy, A.w, A.h, B.h, B.w);
_local10 = _local8.returned;
if (_local10 != 0) {
if ((_local8.x >= _local12) && (_local8.y >= _local11)) {
_local2.x = _local8.x;
_local2.y = _local8.y;
_local2.nx = _local8.nx;
_local2.ny = _local8.ny;
_local2.hit_time = _local8.hit_time;
var _local9 = Math.sqrt((B.w * B.w) + (B.h * B.h));
_local2.nx = B.h / _local9;
_local2.ny = B.w / _local9;
_local4 = COLL_TYPE_Xp | COLL_TYPE_Yp;
}
}
}
break;
case COLL_SHAPE_RAMPFORM_Xn_Yp :
if (((vx * (-B.h)) + (vy * B.w)) < 0) {
_local12 = B.w - A.w;
_local11 = (-B.h) + A.h;
_local4 = 0;
_local8 = coll_DBoxPlane(A.x - B.x, A.y - B.y, vx, vy, A.w, A.h, -B.h, B.w);
_local10 = _local8.returned;
if (_local10 != 0) {
if ((_local8.x <= _local12) && (_local8.y >= _local11)) {
_local2.x = _local8.x;
_local2.y = _local8.y;
_local2.nx = _local8.nx;
_local2.ny = _local8.ny;
_local2.hit_time = _local8.hit_time;
var _local9 = Math.sqrt((B.w * B.w) + (B.h * B.h));
_local2.nx = (-B.h) / _local9;
_local2.ny = B.w / _local9;
_local4 = COLL_TYPE_Xn | COLL_TYPE_Yp;
}
}
}
break;
case COLL_SHAPE_RAMPFORM_Xn_Yn :
if (((vx * (-B.h)) + (vy * (-B.w))) < 0) {
_local12 = B.w - A.w;
_local11 = B.h - A.h;
_local4 = 0;
_local8 = coll_DBoxPlane(A.x - B.x, A.y - B.y, vx, vy, A.w, A.h, -B.h, -B.w);
_local10 = _local8.returned;
if (_local10 != 0) {
if ((_local8.x <= _local12) && (_local8.y <= _local11)) {
_local2.x = _local8.x;
_local2.y = _local8.y;
_local2.nx = _local8.nx;
_local2.ny = _local8.ny;
_local2.hit_time = _local8.hit_time;
var _local9 = Math.sqrt((B.w * B.w) + (B.h * B.h));
_local2.nx = (-B.h) / _local9;
_local2.ny = (-B.w) / _local9;
_local4 = COLL_TYPE_Xn | COLL_TYPE_Yn;
}
}
}
break;
case COLL_SHAPE_RAMPFORM_Xp_Yn :
if (((vx * B.h) + (vy * (-B.w))) < 0) {
_local12 = (-B.w) + A.w;
_local11 = B.h - A.h;
_local4 = 0;
_local8 = coll_DBoxPlane(A.x - B.x, A.y - B.y, vx, vy, A.w, A.h, B.h, -B.w);
_local10 = _local8.returned;
if (_local10 != 0) {
if ((_local8.x >= _local12) && (_local8.y <= _local11)) {
_local2.x = _local8.x;
_local2.y = _local8.y;
_local2.nx = _local8.nx;
_local2.ny = _local8.ny;
_local2.hit_time = _local8.hit_time;
var _local9 = Math.sqrt((B.w * B.w) + (B.h * B.h));
_local2.nx = B.h / _local9;
_local2.ny = (-B.w) / _local9;
_local4 = COLL_TYPE_Xp | COLL_TYPE_Yn;
}
}
}
break;
}
_local2.returned = _local4;
if (_local4 != 0) {
_local2.x = _local2.x + B.x;
_local2.y = _local2.y + B.y;
}
}
return(_local2);
};
this.getPosX = function (gobj) {
return(gobj.x);
};
this.getPosY = function (gobj) {
return(gobj.y);
};
this.getVelX = function (gobj) {
return(gobj.vx);
};
this.getVelY = function (gobj) {
return(gobj.vy);
};
this.getDirX = function (gobj) {
return(gobj.dirx);
};
this.getDirY = function (gobj) {
return(gobj.diry);
};
this.getImpX = function (gobj) {
return(gobj.impx);
};
this.getImpY = function (gobj) {
return(gobj.impy);
};
this.getScaleX = function (gobj) {
return(gobj.scale_x);
};
this.getScaleY = function (gobj) {
return(gobj.scale_y);
};
this.getRotation = function (gobj) {
return(gobj.rotation);
};
this.getUID = function (gobj) {
return(gobj.uid);
};
this.getDestroyed = function (gobj) {
return(gobj.destroy);
};
this.getUpdate = function (gobj) {
return(gobj.update);
};
this.getTracking = function (gobj) {
return(gobj.tracking > 0);
};
this.getTrackingUID = function (gobj) {
return(gobj.tracking);
};
this.getInit = function (gobj) {
return(gobj._init);
};
this.getGameClass = function (gobj) {
return(gobj.game_class);
};
this.getGameType = function (gobj) {
return(gobj.game_type);
};
this.getClip = function (gobj) {
return(gobj.clip);
};
this.getClipName = function (gobj) {
return(gobj.clip_name);
};
this.getClipDup = function (gobj) {
return(gobj.clip_dup);
};
this.getClipFrame = function (gobj) {
return(gobj.clip_frame);
};
this.getClipColl = function (gobj) {
return(gobj.clip_coll);
};
this.getClipAnim = function (gobj) {
return(gobj.clip_anim);
};
this.getAnim = function (gobj) {
return(gobj.anim_curr);
};
this.getAnimNext = function (gobj) {
return(gobj.anim_next);
};
this.getAnimPrev = function (gobj) {
return(gobj.anim_prev);
};
this.getAnimStopped = function (gobj) {
return(gobj.anim_stop);
};
this.getAnimSpeed = function (gobj) {
return(gobj.anim_speed);
};
this.getAnimTime = function (gobj) {
return(gobj.anim_time);
};
this.getInputType = function (gobj) {
return(gobj.input_type);
};
this.getInputs = function (gobj) {
return(gobj.input);
};
this.getCollBox = function (gobj) {
var _local1 = new Object();
_local1.x = gobj.x + gobj.coll_x;
_local1.y = gobj.y + gobj.coll_y;
_local1.w = gobj.coll_w;
_local1.h = gobj.coll_h;
return(_local1);
};
this.getVelCollBox = function (gobj) {
var _local1 = new Object();
_local1.xMin = gobj.coll_x - gobj.coll_w;
_local1.xMax = gobj.coll_x + gobj.coll_w;
_local1.yMin = gobj.coll_y - gobj.coll_h;
_local1.yMax = gobj.coll_y + gobj.coll_h;
if (gobj.vx < 0) {
_local1.xMin = _local1.xMin + gobj.vx;
} else {
_local1.xMax = _local1.xMax + gobj.vx;
}
if (gobj.vy < 0) {
_local1.yMin = _local1.yMin + gobj.vy;
} else {
_local1.yMax = _local1.yMax + gobj.vy;
}
_local1.w = (_local1.xMax - _local1.xMin) / 2;
_local1.h = (_local1.yMax - _local1.yMin) / 2;
_local1.x = (gobj.x + _local1.xMin) + _local1.w;
_local1.y = (gobj.y + _local1.yMin) + _local1.h;
return(_local1);
};
this.getCollXMin = function (gobj) {
return((gobj.x + gobj.coll_x) - gobj.coll_w);
};
this.getCollXMax = function (gobj) {
return((gobj.x + gobj.coll_x) + gobj.coll_w);
};
this.getCollYMin = function (gobj) {
return((gobj.y + gobj.coll_y) - gobj.coll_h);
};
this.getCollYMax = function (gobj) {
return((gobj.y + gobj.coll_y) + gobj.coll_h);
};
this.getVelCollXMin = function (gobj) {
var _local1 = getCollXMin(gobj);
if (gobj.vx < 0) {
_local1 = _local1 + gobj.vx;
}
return(_local1);
};
this.getVelCollXMax = function (gobj) {
var _local1 = getCollXMax(gobj);
if (gobj.vx > 0) {
_local1 = _local1 + gobj.vx;
}
return(_local1);
};
this.getVelCollYMin = function (gobj) {
var _local1 = getCollYMin(gobj);
if (gobj.vy < 0) {
_local1 = _local1 + gobj.vy;
}
return(_local1);
};
this.getVelCollYMax = function (gobj) {
var _local1 = getCollYMax(gobj);
if (gobj.vy > 0) {
_local1 = _local1 + gobj.vy;
}
return(_local1);
};
this.createGameObj = function (clipprefix, dupclip, dupframe, nuid) {
var nobj = new GameObj();
nobj.uid = nuid;
nobj.clip_dup = dupclip;
nobj.clip_frame = dupframe;
nobj.clip = null;
if ((dupclip != null) && (dupclip != undefined)) {
var newclipname = (clipprefix + nuid);
var xdepth = dupclip._parent.getNextHighestDepth();
duplicateMovieClip (dupclip, newclipname, xdepth);
var newclip = eval ((dupclip._parent + ".") + newclipname);
newclip.uid = nobj.uid;
newclip._visible = false;
newclip.gotoAndStop(dupframe);
nobj.clip = newclip;
nobj.clip_name = newclipname;
nobj.clip_anim = null;
nobj.clip_coll = null;
}
return(nobj);
};
this.syncGameObjToFlash = function (gobj) {
var _local2 = gobj.clip;
if (_local2 != null) {
_local2._x = gobj.x;
_local2._y = -gobj.y;
_local2._xscale = gobj.scale_x;
_local2._yscale = gobj.scale_y;
_local2._rotation = gobj.rotation;
var _local3 = gobj.clip_anim;
if (_local3 != null) {
if (gobj.anim_curr != gobj.anim_prev) {
_local2.anim_stop = 0;
_local2.anim_start = 0;
_local3.gotoAndStop(gobj.anim_curr);
} else if (gobj.anim_speed >= 0) {
if (_local2.anim_stop != 0) {
gobj.anim_curr = gobj.anim_next;
_local2.anim_stop = 0;
_local2.anim_start = 0;
_local3.gotoAndStop(gobj.anim_curr);
} else {
gobj.anim_time = gobj.anim_time + gobj.anim_speed;
if (gobj.anim_time >= 1) {
_local3.nextFrame();
gobj.anim_time = gobj.anim_time - Math.floor(gobj.anim_time);
}
}
} else if (_local2.anim_start != 0) {
gobj.anim_curr = gobj.anim_next;
_local2.anim_stop = 0;
_local2.anim_start = 0;
_local3.gotoAndStop(gobj.anim_curr);
} else {
gobj.anim_time = gobj.anim_time + gobj.anim_speed;
if (gobj.anim_time <= 0) {
_local3.prevFrame();
gobj.anim_time = gobj.anim_time + (1 + Math.floor(-gobj.anim_time));
}
}
gobj.anim_prev = gobj.anim_curr;
}
var _local5 = gobj.clip_coll;
if (_local5 != null) {
var _local4 = _local5.getBounds(_local2);
gobj.coll_w = (_local4.xMax - _local4.xMin) / 2;
gobj.coll_h = (_local4.yMax - _local4.yMin) / 2;
gobj.coll_x = gobj.coll_w + _local4.xMin;
gobj.coll_y = -(_local4.yMax - gobj.coll_h);
} else {
var _local4 = _local2.getBounds(_local2._parent);
gobj.coll_w = (_local4.xMax - _local4.xMin) / 2;
gobj.coll_h = (_local4.yMax - _local4.yMin) / 2;
gobj.coll_x = (gobj.coll_w + _local4.xMin) - gobj.x;
gobj.coll_y = (-(_local4.yMax - gobj.coll_h)) - gobj.y;
}
return(true);
}
return(false);
};
this.setAnim = function (gobj, animname, nextname) {
gobj.anim_curr = animname;
if (nextname != undefined) {
gobj.anim_next = nextname;
}
};
this.setNextAnim = function (gobj, animname) {
gobj.anim_next = animname;
};
this.setAnimSpeed = function (gobj, speedo) {
gobj.anim_speed = speedo;
};
this.makeAbove = function (objA, objB) {
return(flashMakeAbove(objA.clip, objB.clip));
};
this.makeBelow = function (objA, objB) {
return(flashMakeBelow(objA.clip, objB.clip));
};
this.calcRelativePoint = function (gob, px, py) {
var _local5 = gob.rotation * (Math.PI/180);
var _local3 = Math.sin(_local5);
var _local2 = Math.cos(_local5);
var _local9 = (px * _local2) + (py * _local3);
var _local8 = ((-px) * _local3) + (py * _local2);
var _local7 = (gob.scale_x / 100) * _local9;
var _local6 = (gob.scale_y / 100) * _local8;
var _local11 = gob.x + _local7;
var _local10 = gob.y + _local6;
var _local1 = new Object();
_local1.a = _local5;
_local1.as = _local3;
_local1.ac = _local2;
_local1.lx = _local9;
_local1.ly = _local8;
_local1.sx = _local7;
_local1.sy = _local6;
_local1.x = _local11;
_local1.y = _local10;
return(_local1);
};
this.calcRelativeTrackingPoint = function (mtarg, gobj, xpos, ypos) {
var _local8 = xpos;
var _local7 = ypos;
var _local4 = (Math.PI/180);
while (mtarg != gobj.clip) {
var _local2 = Math.cos(mtarg._rotation * _local4);
var _local3 = Math.sin(mtarg._rotation * _local4);
_local8 = _local8 + ((mtarg._xscale * ((_local2 * xpos) + (_local3 * ypos))) + mtarg._x);
_local7 = _local7 + ((mtarg._yscale * ((_local3 * xpos) - (_local2 * ypos))) - mtarg._y);
mtarg = mtarg._parent;
}
var _local10 = new Object();
_local10.x = _local8 + gobj.x;
_local10.y = _local7 + gobj.y;
return(_local10);
};
this.calcRelativeDirectedPoint = function (gob, px, py) {
var _local2 = calcRelativePoint(gob, px, py);
if (gob.dirx != 0) {
_local2.x = _local2.x * gob.dirx;
}
if (gob.diry != 0) {
_local2.y = _local2.y * gob.diry;
}
};
this.applyImpulse = function (gobj, nimpx, nimpy) {
gobj.impx = gobj.impx + nimpx;
gobj.impy = gobj.impy + nimpy;
};
this.applyImpulseClamped = function (gobj, nimpx, nimpy, vmaxx, vmaxy) {
gobj.impx = gobj.impx + nimpx;
gobj.impy = gobj.impy + nimpy;
};
this.hitsPoint = function (gobj, px, py) {
var _local5 = (px - gobj.x) - gobj.coll_x;
var _local2 = gobj.coll_w;
if ((_local5 >= (-_local2)) && (_local5 <= _local2)) {
var _local3 = (py - gobj.y) - gobj.coll_y;
var _local4 = gobj.coll_h;
if ((_local3 >= (-_local4)) && (_local3 <= _local4)) {
return(true);
}
}
return(false);
};
this.hitsBox = function (gobj, minx, miny, maxx, maxy) {
var _local4 = gobj.x;
var _local2 = gobj.coll_x;
var _local5 = gobj.coll_w;
var _local9 = (minx - _local4) - _local2;
var _local11 = (maxx - _local4) - _local2;
if ((_local9 < _local5) && (_local11 > (-_local5))) {
var _local3 = gobj.y;
var _local7 = gobj.coll_y;
var _local6 = gobj.coll_h;
var _local8 = (miny - _local3) - _local7;
var _local10 = (maxy - _local3) - _local7;
if ((_local8 < _local6) && (_local10 > (-_local6))) {
return(true);
}
}
return(false);
};
this.hitsCornerPoints = function (gobj, cenx, ceny, bsize) {
var _local4 = new Object();
var _local2 = gobj.x + gobj.coll_x;
var _local3 = gobj.y + gobj.coll_y;
var _local6 = cenx - _local2;
var _local5 = ceny - _local3;
if (_local6 > 0) {
if (_local5 > 0) {
_local2 = _local2 + gobj.coll_w;
_local3 = _local3 + gobj.coll_h;
} else {
_local2 = _local2 + gobj.coll_w;
_local3 = _local3 - gobj.coll_h;
}
} else if (_local5 > 0) {
_local2 = _local2 - gobj.coll_w;
_local3 = _local3 + gobj.coll_h;
} else {
_local2 = _local2 - gobj.coll_w;
_local3 = _local3 - gobj.coll_h;
}
_local4.hit = false;
_local6 = cenx - _local2;
_local5 = ceny - _local3;
if ((_local6 > (-bsize)) && (_local6 < bsize)) {
if ((_local5 > (-bsize)) && (_local5 < bsize)) {
_local4.hit = true;
_local4.x = _local2;
_local4.y = _local3;
}
}
return(_local4);
};
this.hitsLine = function (gobj, x0, y0, x1, y1) {
return(false);
};
if (!this.hasOwnProperty("MAIN_CLIP")) {
this.MAIN_CLIP = null;
dbg("#ERROR Missing property: MAIN_CLIP");
}
if (!this.hasOwnProperty("MAIN_PIXELS_PER_METER")) {
this.MAIN_PIXELS_PER_METER = 32;
dbg("#ERROR Missing property: MAIN_PIXELS_PER_METER");
}
if (!this.hasOwnProperty("MAIN_FPS")) {
this.MAIN_FPS = 30;
dbg("#ERROR Missing property: MAIN_FPS");
}
if (!this.hasOwnProperty("MAIN_WIDTH")) {
this.MAIN_WIDTH = 960;
dbg("#ERROR Missing property: MAIN_WIDTH");
}
if (!this.hasOwnProperty("MAIN_HEIGHT")) {
this.MAIN_HEIGHT = 540;
dbg("#ERROR Missing property: MAIN_HEIGHT");
}
if (!this.hasOwnProperty("MAIN_GRAVITY")) {
this.MAIN_GRAVITY = 9.81;
dbg("#ERROR Missing property: MAIN_GRAVITY");
}
if (!this.hasOwnProperty("CLIP_SOUNDS")) {
this.CLIP_SOUNDS = null;
dbg("#ERROR Missing property: CLIP_SOUNDS");
}
if (!this.hasOwnProperty("CLIP_MUSIC")) {
this.CLIP_MUSIC = null;
dbg("#ERROR Missing property: CLIP_MUSIC");
}
if (!this.hasOwnProperty("CLIP_COLL")) {
this.CLIP_COLL = null;
dbg("#ERROR Missing property: CLIP_COLL");
}
if (!this.hasOwnProperty("CLIP_DUP_COLL")) {
this.CLIP_DUP_COLL = null;
dbg("#ERROR Missing property: CLIP_DUP_COLL");
}
if (!this.hasOwnProperty("CLIP_BG")) {
this.CLIP_BG = null;
dbg("#ERROR Missing property: CLIP_BG");
}
if (!this.hasOwnProperty("CLIP_DUP_BG")) {
this.CLIP_DUP_BG = null;
dbg("#ERROR Missing property: CLIP_DUP_BG");
}
if (!this.hasOwnProperty("CLIP_FG")) {
this.CLIP_FG = null;
dbg("#ERROR Missing property: CLIP_FG");
}
if (!this.hasOwnProperty("CLIP_DUP_FG")) {
this.CLIP_DUP_FG = null;
dbg("#ERROR Missing property: CLIP_DUP_FG");
}
if (!this.hasOwnProperty("CLIP_BGSCENE")) {
this.CLIP_BGSCENE = null;
dbg("#ERROR Missing property: CLIP_BGSCENE");
}
if (!this.hasOwnProperty("CLIP_DUP_DECOR")) {
this.CLIP_DUP_DECOR = null;
dbg("#ERROR Missing property: CLIP_DUP_DECOR");
}
if (!this.hasOwnProperty("CLIP_DUP_ACTOR")) {
this.CLIP_DUP_ACTOR = null;
dbg("#ERROR Missing property: CLIP_DUP_ACTOR");
}
if (!this.hasOwnProperty("CLIP_DUP_BULLET")) {
this.CLIP_DUP_BULLET = null;
dbg("#ERROR Missing property: CLIP_DUP_BULLET");
}
if (!this.hasOwnProperty("CLIP_DUP_PARTICLE")) {
this.CLIP_DUP_PARTICLE = null;
dbg("#ERROR Missing property: CLIP_DUP_PARTICLE");
}
if (CLIP_DUP_DECOR != null) {
CLIP_DUP_DECOR.stop();
CLIP_DUP_DECOR._visible = false;
}
if (CLIP_DUP_ACTOR != null) {
CLIP_DUP_ACTOR.stop();
CLIP_DUP_ACTOR._visible = false;
}
if (CLIP_DUP_BULLET != null) {
CLIP_DUP_BULLET.stop();
CLIP_DUP_BULLET._visible = false;
}
if (CLIP_DUP_PARTICLE != null) {
CLIP_DUP_PARTICLE.stop();
CLIP_DUP_PARTICLE._visible = false;
}
if (CLIP_DUP_FG != null) {
CLIP_DUP_FG.stop();
CLIP_DUP_FG._visible = false;
}
if (CLIP_DUP_BG != null) {
CLIP_DUP_BG.stop();
CLIP_DUP_BG._visible = false;
}
if (CLIP_COLL != null) {
CLIP_COLL.stop();
CLIP_COLL._visible = false;
}
this.GAMECLASS_NONE = 0;
this.GAMECLASS_COLL = 1;
this.GAMECLASS_DECOR = 2;
this.GAMECLASS_BULLET = 3;
this.GAMECLASS_ACTOR = 4;
this.m_game_paused = 1;
this.m_game_edit = 0;
this.m_game_snap = 1;
this.m_uid_curr = 1;
this.m_uid_unused = new Map();
this.m_game_objects = new Map();
this.m_go_actors = new Map();
this.m_go_bullets = new Map();
this.m_go_decor = new Map();
this.m_go_coll = new Map();
this.m_view_obj = null;
this.m_view_zoom = 1;
this.m_view_x = 0;
this.m_view_y = 0;
this.m_view_width = 96;
this.m_view_height = 54;
this.m_audio_sound_volume = 100;
this.m_audio_music_volume = 100;
this.m_shash = new SpaceHashMap();
this.m_shash.clear(8 * this.MAIN_PIXELS_PER_METER);
this.m_shash.encloseRange(-4096 / this.MAIN_PIXELS_PER_METER, 4096 / this.MAIN_PIXELS_PER_METER);
this.getCollMin = getCollXMin;
this.getCollMax = getCollXMax;
this.getVelCollMin = getVelCollXMin;
this.getVelCollMax = getVelCollXMax;
this.input_mouse_screen_x = 0;
this.input_mouse_screen_y = 0;
this.input_mouse_x = 0;
this.input_mouse_y = 0;
this.input_mouse_dx = 0;
this.input_mouse_dy = 0;
this.input_mouse_down = 0;
this.input_mouse_is_down = 0;
var mouseListener = new Object();
mouseListener.onMouseDown = function () {
input_mouse_is_down = 1;
};
mouseListener.onMouseUp = function () {
input_mouse_is_down = 0;
};
mouseListener.onMouseMove = function (newFocus) {
};
Mouse.addListener(mouseListener);
this.getMouseDown = function () {
return(input_mouse_down);
};
this.getMouseClicked = function () {
return(input_mouse_down == 1);
};
this.getMouseDX = function () {
return(input_mouse_dx);
};
this.getMouseDY = function () {
return(input_mouse_dy);
};
this.getMouseX = function () {
return(input_mouse_x);
};
this.getMouseY = function () {
return(input_mouse_y);
};
this.addNewUID = function () {
var _local1 = m_uid_curr;
if (!m_uid_unused.empty()) {
_local1 = m_uid_unused.first_key();
m_uid_unused.remove_first_key();
} else {
m_uid_curr = m_uid_curr + 1;
}
return(_local1);
};
this.removeUID = function (nuid) {
m_uid_unused.insert(nuid, nuid);
};
this.addObj = function (dupclip, dupframe) {
var _local2 = addNewUID();
var _local1 = createGameObj("cobj_", dupclip, dupframe, _local2);
_local1.game_class = GAMECLASS_NONE;
m_game_objects.insert(_local2, _local1);
return(_local1.uid);
};
this.hasObj = function (uid) {
return(m_game_objects.exists(uid));
};
this.getObj = function (uid) {
return(m_game_objects[uid]);
};
this.remObj = function (uid) {
if (hasObj(uid)) {
var _local2 = getObj(uid);
m_shash.remove(uid, String(_local2.game_class), getCollMin(_local2), getCollMax(_local2));
if (_local2.clip != null) {
removeMovieClip(_local2.clip);
}
switch (_local2.game_class) {
case GAMECLASS_COLL :
m_go_coll.remove(uid);
break;
case GAMECLASS_DECOR :
m_go_decor.remove(uid);
break;
case GAMECLASS_BULLET :
m_go_bullets.remove(uid);
break;
case GAMECLASS_ACTOR :
m_go_actors.remove(uid);
break;
}
m_game_objects.remove(uid);
removeUID(uid);
return(true);
}
return(false);
};
this.getObjData = function (uid) {
var _local2 = getObj(uid);
switch (_local2.game_class) {
case GAMECLASS_COLL :
return(m_go_coll[uid]);
case GAMECLASS_DECOR :
return(m_go_decor[uid]);
case GAMECLASS_BULLET :
return(m_go_bullets[uid]);
case GAMECLASS_ACTOR :
return(m_go_actors[uid]);
}
return(Object());
};
this.moveObj = function (gobj, x, y) {
};
this.addActor = function (xpos, ypos, types) {
var _local2 = addObj(CLIP_DUP_ACTOR, types);
var _local1 = getObj(_local2);
_local1.x = xpos;
_local1.y = ypos;
_local1.update = 1;
_local1.game_class = GAMECLASS_ACTOR;
_local1.game_type = types;
m_go_actors[_local2] = new Object();
_local1.clip.gotoAndStop(_local1.clip_frame);
_local1.anim_curr = "";
_local1.anim_next = "";
_local1.anim_prev = "";
syncGameObjToFlash(_local1);
_local1.clip_anim = _local1.clip.mc;
_local1.clip_coll = _local1.clip_anim.cbox;
_local1.clip._visible = true;
_local1._init = 1;
return(_local2);
};
this._determineCollType = function (colltype, xsize, ysize) {
var _local1 = COLL_SHAPE_BOX;
if (colltype == "rampform") {
if (xsize < 0) {
if (ysize < 0) {
_local1 = COLL_SHAPE_RAMPFORM_Xn_Yn;
} else {
_local1 = COLL_SHAPE_RAMPFORM_Xn_Yp;
}
} else if (ysize < 0) {
_local1 = COLL_SHAPE_RAMPFORM_Xp_Yn;
} else {
_local1 = COLL_SHAPE_RAMPFORM_Xp_Yp;
}
} else if (colltype == "platform") {
if (Math.abs(xsize) > Math.abs(ysize)) {
if (xsize < 0) {
_local1 = COLL_SHAPE_PLATFORM_Xn;
} else {
_local1 = COLL_SHAPE_PLATFORM_Xp;
}
} else if (ysize < 0) {
_local1 = COLL_SHAPE_PLATFORM_Yn;
} else {
_local1 = COLL_SHAPE_PLATFORM_Yp;
}
} else if (colltype == "ramp") {
if (xsize < 0) {
if (ysize < 0) {
_local1 = COLL_SHAPE_RAMP_Xn_Yn;
} else {
_local1 = COLL_SHAPE_RAMP_Xn_Yp;
}
} else if (ysize < 0) {
_local1 = COLL_SHAPE_RAMP_Xp_Yn;
} else {
_local1 = COLL_SHAPE_RAMP_Xp_Yp;
}
}
return(_local1);
};
this.addColl = function (xpos, ypos, xsize, ysize, colltype) {
var _local2 = addObj(CLIP_DUP_COLL, colltype);
var _local1 = getObj(_local2);
_local1.game_class = GAMECLASS_COLL;
_local1.game_type = _determineCollType(colltype, xsize, ysize);
collobj = new Object();
collobj.x = xpos;
collobj.y = ypos;
collobj.w = Math.abs(xsize);
collobj.h = Math.abs(ysize);
collobj.bounce = 0;
collobj.slide = 1;
collobj.coll_type_name = colltype;
collobj.type = _local1.game_type;
collobj.x = Math.floor(collobj.x / m_game_snap) * m_game_snap;
collobj.y = Math.floor(collobj.y / m_game_snap) * m_game_snap;
collobj.w = Math.floor(collobj.w / m_game_snap) * m_game_snap;
collobj.h = Math.floor(collobj.h / m_game_snap) * m_game_snap;
m_go_coll[_local2] = collobj;
_local1.x = collobj.x;
_local1.y = collobj.y;
_local1.scale_x = 100 * (collobj.w / 5);
_local1.scale_y = 100 * (collobj.h / 5);
_local1.clip._visible = true;
_local1.clip.gotoAndStop(colltype);
_local1.clip_anim = _local1.clip.mc;
_local1.clip_coll = _local1.clip_anim.cbox;
syncGameObjToFlash(_local1);
m_shash.encloseRange(collobj.x - collobj.w, collobj.x + collobj.w);
m_shash.insert(getUID(_local1), String(_local1.game_class), collobj.x - collobj.w, collobj.x + collobj.w);
return(_local2);
};
this.addBullet = function (xpos, ypos, xvel, yvel, mask, types) {
var _local6 = addObj(CLIP_DUP_BULLET, types);
var _local1 = getObj(_local6);
_local1.x = xpos;
_local1.y = ypos;
_local1.vx = xvel;
_local1.vy = yvel;
_local1.update = 1;
_local1.game_class = GAMECLASS_BULLET;
_local1.game_type = types;
_local1.clip_anim = null;
_local1.clip_coll = null;
m_go_bullets[_local6] = new Object();
var _local2 = m_go_bullets[_local6];
_local2.x = xpos;
_local2.y = ypos;
_local2.w = 2;
_local2.h = 2;
_local2.type = COLL_SHAPE_BOX;
_local2.timeout = 30;
_local2.ax = 0;
_local2.ay = 0;
_local2.arotation = 0;
_local2.target_uid = -1;
_local2.target_x = 0;
_local2.target_y = 0;
_local2.turn_rate = 5;
_local2.gravity = 0;
_local2.owner_uid = -1;
_local1.clip._visible = true;
var _local7 = Math.sqrt((_local1.vx * _local1.vx) + (_local1.vy * _local1.vy));
var _local9 = _local1.vx / _local7;
var _local8 = _local1.vy / _local7;
var _local5 = _local2.w * _local8;
var _local4 = _local2.w * _local9;
var _local3 = _local1.clip;
if (_local3 != undefined) {
_local3.clear();
_local3.lineStyle(0, 0, 0);
_local3.beginFill(16711680);
_local3.moveTo(_local5, _local4);
_local3.lineTo(_local5, -_local4);
_local3.lineTo(_local1.vx + _local5, -(_local1.vy + _local4));
_local3.lineTo(_local1.vx + _local5, -(_local1.vy - _local4));
_local3.lineTo(_local5, _local4);
_local3.endFill();
}
return(_local6);
};
this.addDecor = function (xpos, ypos, rot, xscale, yscale, types) {
var _local2 = addObj(CLIP_DUP_DECOR, types);
var _local1 = getObj(_local2);
_local1.x = xpos;
_local1.y = ypos;
_local1.rotation = rot;
_local1.scale_x = xscale;
_local1.scale_y = yscale;
_local1.update = 1;
_local1.game_class = GAMECLASS_DECOR;
_local1.game_type = types;
_local1.clip_anim = null;
_local1.clip_coll = null;
m_go_decor[_local2] = new Object();
_local1.clip.gotoAndStop(types);
_local1.clip._visible = true;
syncGameObjToFlash(_local1);
m_shash.encloseRange((_local1.x + _local1.coll_x) - _local1.coll_w, (_local1.x + _local1.coll_x) + _local1.coll_w);
m_shash.insert(getUID(_local1), String(_local1.game_class), (_local1.x + _local1.coll_x) - _local1.coll_w, (_local1.x + _local1.coll_x) + _local1.coll_w);
trace(((((((_local1.x + _local1.coll_x) + " ") + (_local1.y + _local1.coll_y)) + " ") + _local1.coll_w) + " ") + _local1.coll_h);
return(_local2);
};
this.addParticle = function (px, py, types) {
var ndepth = this.getNextHighestDepth();
var newclipname = ("ptcl_" + ndepth);
duplicateMovieClip (CLIP_DUP_PARTICLE, newclipname, ndepth);
var newclip = eval ((this + ".") + newclipname);
newclip._x = px;
newclip._y = -py;
newclip.gotoAndPlay(types);
};
this.copyObj = function (uid) {
var _local2 = -1;
var _local1 = getObj(uid);
var _local3 = getObjData(uid);
switch (Number(_local1.game_class)) {
case GAMECLASS_COLL :
_local2 = addColl(_local1.x, _local1.y, _local1.scale_x / 20, _local1.scale_y / 20, _local3.coll_type_name);
break;
case GAMECLASS_DECOR :
_local2 = addDecor(_local1.x, _local1.y, _local1.rotation, _local1.scale_x, _local1.scale_y, _local1.game_type);
break;
case GAMECLASS_ACTOR :
_local2 = addActor(_local1.x, _local1.y, _local1.game_type);
break;
case GAMECLASS_BULLET :
break;
}
return(_local2);
};
this.moveAgainstTypeLinear = function (gobj, gameclass) {
var _local23 = gobj.coll_x + gobj.x;
var _local22 = gobj.coll_y + gobj.y;
var _local32 = -gobj.coll_x;
var _local33 = -gobj.coll_y;
var _local14 = gobj.vx;
var _local13 = gobj.vy;
if ((Math.abs(_local14) + Math.abs(_local13)) == 0) {
return(undefined);
}
var _local25 = 0;
var _local24 = -1;
var _local15 = false;
var _local7 = 1;
while (!_local15) {
var _local3 = 2;
var _local17 = _local14 * _local7;
var _local16 = _local13 * _local7;
var _local21 = m_shash.get(String(gameclass), getVelCollMin(gobj), getVelCollMax(gobj));
var _local1 = new Object();
var _local19 = new Object({x:_local23, y:_local22, w:gobj.coll_w, h:gobj.coll_h, type:COLL_SHAPE_BOX});
for (cs_key in _local21) {
if (cs_key != _local24) {
var _local20 = getObj(cs_key);
var _local10 = m_go_coll[cs_key];
var _local2 = coll_DBoxToShape(_local19, _local17, _local16, _local10);
var _local4 = _local2.returned;
if ((_local4 != COLL_TYPE_NONE) && (_local4 != COLL_TYPE_INSIDE)) {
if (_local2.hit_time < _local3) {
_local3 = _local2.hit_time;
_local1.x = _local2.x;
_local1.y = _local2.y;
_local1.nx = _local2.nx;
_local1.ny = _local2.ny;
_local1.hit_time = _local2.hit_time;
_local1.hit_uid = cs_key;
_local1.bounce = 0;
_local1.slide = 1;
}
}
}
}
if ((_local3 < 1) && (_local3 >= 0)) {
_local24 = _local1.hit_uid;
_local23 = _local1.x;
_local22 = _local1.y;
var _local9 = _local1.nx;
var _local8 = _local1.ny;
var _local11 = (_local14 * _local9) + (_local13 * _local8);
var _local18 = (_local14 * _local8) - (_local13 * _local9);
var _local6 = _local1.bounce;
var _local5 = _local1.slide;
if (_local6 > 1) {
_local6 = 1;
} else if (_local6 < 0) {
_local6 = 0;
}
if (_local5 > 1) {
_local5 = 1;
} else if (_local5 < -1) {
_local5 = -1;
}
if (_local11 < 0) {
_local11 = _local11 * (-_local6);
}
_local18 = _local18 * _local5;
_local14 = (_local11 * _local9) + (_local18 * _local8);
_local13 = (_local11 * _local8) - (_local18 * _local9);
_local7 = _local7 - (_local7 * _local1.hit_time);
if (_local1.hit_time == 0) {
}
} else if (_local3 >= 1) {
_local23 = _local23 + _local17;
_local22 = _local22 + _local16;
_local7 = _local7 - 1;
_local15 = true;
}
if (_local7 <= 0) {
_local15 = true;
}
if ((_local14 == 0) && (_local13 == 0)) {
_local15 = true;
}
_local25++;
if (_local25 > 8) {
_local15 = true;
dbg("Iterated out!");
}
}
gobj.x = _local23 + _local32;
gobj.y = _local22 + _local33;
gobj.vx = _local14;
gobj.vy = _local13;
};
this.moveAgainstLevelLinear = function (gobj) {
moveAgainstTypeLinear(gobj, GAMECLASS_COLL);
};
this.moveAgainstFirstTypeLinear = function (gobj, gameclass, ignoreme) {
var _local12 = gobj.coll_x + gobj.x;
var _local10 = gobj.coll_y + gobj.y;
var _local21 = -gobj.coll_x;
var _local22 = -gobj.coll_y;
var _local16 = gobj.vx;
var _local15 = gobj.vy;
var _local5 = 2;
var _local18 = m_shash.get(String(gameclass), getVelCollMin(gobj), getVelCollMax(gobj));
var _local1 = new Object();
_local1.hit_uid = -1;
_local1.hit_time = 1;
var _local17 = new Object({x:_local12, y:_local10, w:gobj.coll_w, h:gobj.coll_h, type:COLL_SHAPE_BOX});
for (cs_key in _local18) {
if (cs_key != ignoreme) {
var _local3 = getObj(cs_key);
var _local6 = new Object();
if (gameclass == GAMECLASS_COLL) {
_local6 = m_go_coll[cs_key];
} else {
_local6 = new Object({x:_local3.x + _local3.coll_x, y:_local3.y + _local3.coll_y, w:_local3.coll_w, h:_local3.coll_h, type:COLL_SHAPE_BOX});
}
var _local2 = coll_DBoxToShape(_local17, _local16, _local15, _local6);
var _local4 = _local2.returned;
if ((_local4 != COLL_TYPE_NONE) && (_local4 != COLL_TYPE_INSIDE)) {
if (_local2.hit_time < _local5) {
_local5 = _local2.hit_time;
_local1.x = _local2.x;
_local1.y = _local2.y;
_local1.nx = _local2.nx;
_local1.ny = _local2.ny;
_local1.hit_time = _local2.hit_time;
_local1.hit_uid = cs_key;
}
}
if ((_local4 & COLL_TYPE_INSIDE) != 0) {
_local5 = 0;
_local1.x = _local12;
_local1.y = _local10;
_local1.nx = 0;
_local1.ny = 0;
_local1.hit_time = 0;
_local1.hit_uid = cs_key;
break;
}
}
}
if ((_local5 < 1) && (_local5 >= 0)) {
_local12 = _local1.x;
_local10 = _local1.y;
} else if (_local5 >= 1) {
_local12 = _local12 + _local16;
_local10 = _local10 + _local15;
_local1.hit_uid = -1;
}
gobj.x = _local12 + _local21;
gobj.y = _local10 + _local22;
return(_local1);
};
this.pointHitsFirstType = function (px, py, gameclass, ignoreuid) {
var _local2 = m_shash.get(String(gameclass), px, px);
for (var _local5 in _local2) {
var _local1 = getObj(_local5);
if (hitsPoint(_local1, px, py)) {
if (_local1.uid != ignoreuid) {
return(_local1.uid);
}
}
}
return(-1);
};
this.pointHitsFirstChar = function (px, py, ignoreuid) {
return(pointHitsFirstType(px, py, GAMECLASS_ACTOR, ignoreuid));
};
this.boxHitsFirstType = function (minx, miny, maxx, maxy, gameclass) {
var _local2 = m_shash.get(String(gameclass), minx, maxx);
for (var _local7 in _local2) {
var _local1 = getObj(_local7);
if (hitsBox(_local1, minx, miny, maxx, maxy)) {
return(_local1.uid);
}
}
return(-1);
};
this.motionPlatformChar = function (gobj) {
gobj.impy = gobj.impy - (1 * ((MAIN_PIXELS_PER_METER * MAIN_GRAVITY) / (MAIN_FPS * MAIN_FPS)));
gobj.vx = gobj.vx + gobj.impx;
gobj.vy = gobj.vy + gobj.impy;
moveAgainstLevelLinear(gobj);
gobj.impx = 0;
gobj.impy = 0;
};
this.calcDirectionVector = function (angle, speed) {
var _local1 = (Math.PI * angle) / 180;
var _local3 = Math.cos(_local1);
var _local2 = Math.sin(_local1);
return(Object({dx:_local3, dy:_local2, vx:speed * _local3, vy:speed * _local2}));
};
this.getViewObj = function () {
return(m_view_obj);
};
this.setViewObj = function (gobj) {
m_view_obj = gobj;
};
this.clearViewObj = function () {
m_view_obj = null;
};
this.getViewZoom = function () {
return(1 / m_view_zoom);
};
this.setViewZoom = function (nzoom) {
if (nzoom < 1) {
if (nzoom > 0.0625) {
m_view_zoom = nzoom;
} else {
m_view_zoom = 0.0625;
}
} else {
m_view_zoom = 1;
}
m_view_zoom = 1 / m_view_zoom;
};
this.getViewX = function () {
return(m_view_x);
};
this.getViewY = function () {
return(m_view_y);
};
this.setViewX = function (nval) {
m_view_x = nval;
};
this.setViewY = function (nval) {
m_view_y = nval;
};
this.insideView = function (gobj) {
};
this.playSound = function (snd) {
CLIP_SOUNDS.playSound(snd, m_audio_sound_volume);
};
this.playMusic = function (snd, crossfade) {
if (crossfade == undefined) {
CLIP_MUSIC.loadMusic(snd);
} else {
CLIP_MUSIC.loadMusic(snd, crossfade);
}
};
this.setSoundVolume = function (vol) {
m_audio_sound_volume = vol;
};
this.setMusicVolume = function (vol) {
m_audio_music_volume = vol;
CLIP_MUSIC.setVolumeScale(m_audio_music_volume / 100);
};
this.pauseGame = function () {
m_game_paused = 1;
};
this.unpauseGame = function () {
m_game_paused = 0;
};
this.isGamePaused = function () {
return(m_game_paused != 0);
};
this.hideGame = function () {
m_game_paused = 1;
this._visible = false;
};
this.unhideGame = function () {
this._visible = true;
};
this.isGameHidden = function () {
return(this._visible);
};
this.setGameMode = function (editmode) {
m_game_edit = editmode != 0;
};
this.getGameMode = function () {
return(m_game_edit);
};
this.clearGame = function () {
var _local2 = new Array();
for (var _local3 in m_game_objects) {
_local2.push(_local3);
}
for (var _local4 in _local2) {
if (hasObj(_local4)) {
remObj(_local4);
} else {
dbg("#ERROR - clear had invalid object!");
}
}
m_go_actors = new Map();
m_go_bullets = new Map();
m_go_decor = new Map();
m_go_coll = new Map();
m_game_objects = new Map();
m_shash.clear(8 * this.MAIN_PIXELS_PER_METER);
};
this.loadXMLLevelBegin = function (UserObject) {
pauseGame();
hideGame();
UserObject._addobjstack = new Array();
UserObject._refToUID = new Map();
UserObject.levelbounds_xmin = 0;
UserObject.levelbounds_xmax = 0;
UserObject.levelbounds_ymin = 0;
UserObject.levelbounds_ymax = 0;
};
this.loadXMLLevelData = function (N, UserObject) {
var _local1 = N.attributes;
var _local4 = 0;
switch (N.nodeName) {
case "collo" :
dbg((((((((("\tCollision Object: " + _local1.type) + " ") + _local1.x) + " ") + _local1.y) + " ") + _local1.w) + " ") + _local1.h);
var _local3 = new Object({game_class:GAMECLASS_COLL, x:Number(_local1.x), y:Number(_local1.y), w:Number(_local1.w) / 2, h:Number(_local1.h) / 2, type:_local1.type});
UserObject._addobjstack.push(_local3);
if (_local3.x < UserObject.levelbounds_xmin) {
UserObject.levelbounds_xmin = _local3.x;
}
if (_local3.x > UserObject.levelbounds_xmax) {
UserObject.levelbounds_xmax = _local3.x;
}
if (_local3.y < UserObject.levelbounds_ymin) {
UserObject.levelbounds_ymin = _local3.y;
}
if (_local3.y > UserObject.levelbounds_ymax) {
UserObject.levelbounds_ymax = _local3.y;
}
break;
case "achar" :
dbg((((("\tCharacter: " + _local1.type) + " ") + _local1.x) + " ") + _local1.y);
_local3 = new Object({game_class:GAMECLASS_ACTOR, x:Number(_local1.x), y:Number(_local1.y), type:_local1.type});
UserObject._addobjstack.push(_local3);
if (_local3.x < UserObject.levelbounds_xmin) {
UserObject.levelbounds_xmin = _local3.x;
}
if (_local3.x > UserObject.levelbounds_xmax) {
UserObject.levelbounds_xmax = _local3.x;
}
if (_local3.y < UserObject.levelbounds_ymin) {
UserObject.levelbounds_ymin = _local3.y;
}
if (_local3.y > UserObject.levelbounds_ymax) {
UserObject.levelbounds_ymax = _local3.y;
}
break;
case "decor" :
if (Number(_local1.x) < UserObject.levelbounds_xmin) {
UserObject.levelbounds_xmin = Number(_local1.x);
}
if (Number(_local1.x) > UserObject.levelbounds_xmax) {
UserObject.levelbounds_xmax = Number(_local1.x);
}
if (Number(_local1.y) < UserObject.levelbounds_ymin) {
UserObject.levelbounds_ymin = Number(_local1.y);
}
if (Number(_local1.y) > UserObject.levelbounds_ymax) {
UserObject.levelbounds_ymax = Number(_local1.y);
}
break;
default :
dbg("Unknown Node: " + Inode.nodeName);
}
if (_local1.refname != undefined) {
if (refToUID.exists(_local1.refname)) {
UserObject.dbg((("#ERROR DUPLICATE REFNAME: " + _local1.refname) + " from:") + refToUID[_local1.refname]);
} else {
UserObject._refToUID[_local1.refname] = _local4;
UserObject.dbg((("\t\tRefmap: " + _local1.refname) + " -> ") + _local4);
}
}
};
this.loadXMLLevelEnd = function (UserObject) {
if ((((UserObject.levelbounds_xmin != undefined) && (UserObject.levelbounds_xmax != undefined)) && (UserObject.levelbounds_ymin != undefined)) && (UserObject.levelbounds_ymax != undefined)) {
} else {
dbg("Level did not load correctly; Bounds were not set!");
UserObject.levelbounds_xmin = -64;
UserObject.levelbounds_xmax = 64;
UserObject.levelbounds_ymin = -64;
UserObject.levelbounds_ymax = 64;
}
m_shash.clear(8 * MAIN_PIXELS_PER_METER);
m_shash.encloseRange((UserObject.levelbounds_xmin - (8 * MAIN_PIXELS_PER_METER)) / m_shash.getBinSize(), (UserObject.levelbounds_xmax + (8 * MAIN_PIXELS_PER_METER)) / m_shash.getBinSize());
var _local7 = 0;
var _local6 = UserObject._addobjstack.length;
var _local4 = 0;
while (_local4 < _local6) {
var _local1 = UserObject._addobjstack[_local4];
var _local2 = -1;
switch (_local1.game_class) {
case GAMECLASS_COLL :
_local2 = addColl(_local1.x, _local1.y, _local1.w, _local1.h, _local1.type);
break;
case GAMECLASS_ACTOR :
_local2 = addActor(_local1.x, _local1.y, _local1.type);
break;
}
var _local3 = getObj(_local2);
_local3.vx = 0;
_local3.vy = 0;
_local4++;
}
UserObject._addobjstack = new Array();
unhideGame();
unpauseGame();
};
this.loadXMLLevelError = function (tracestring, UserObject) {
UserObject.dgb(tracestring);
};
this.loadXMLLevel = function (filename) {
flashXMLLoad(filename, loadXMLLevelData, loadXMLLevelBegin, loadXMLLevelEnd, loadXMLLevelError);
};
this.saveXMLLevel = function () {
var _local5 = "<?xml version=\"1.0\" encoding=\"UTF-8\" ?>\n";
_local5 = _local5 + "<level >\n";
_local5 = _local5 + "\n<!-- Level parameters: -->\n";
_local5 = _local5 + "\n<!-- Collision blocks: -->\n";
for (okey in m_go_coll) {
var _local4 = getObj(okey);
var _local6 = m_go_coll[okey];
var _local3 = "<collo ";
_local3 = _local3 + (("x=\"" + String(_local6.x)) + "\" ");
_local3 = _local3 + (("y=\"" + String(_local6.y)) + "\" ");
var _local2 = 2 * _local6.w;
var _local1 = 2 * _local6.h;
switch (_local6.type) {
case COLL_SHAPE_RAMPFORM_Xn_Yn :
_local2 = -_local2;
_local1 = -_local1;
break;
case COLL_SHAPE_RAMPFORM_Xn_Yp :
_local2 = -_local2;
break;
case COLL_SHAPE_RAMPFORM_Xp_Yn :
_local1 = -_local1;
break;
case COLL_SHAPE_RAMPFORM_Xp_Yp :
break;
case COLL_SHAPE_RAMP_Xn_Yn :
_local2 = -_local2;
_local1 = -_local1;
break;
case COLL_SHAPE_RAMP_Xn_Yp :
_local2 = -_local2;
break;
case COLL_SHAPE_RAMP_Xp_Yn :
_local1 = -_local1;
break;
case COLL_SHAPE_RAMP_Xp_Yp :
break;
case COLL_SHAPE_PLATFORM_Xn :
_local2 = -_local2;
break;
case COLL_SHAPE_PLATFORM_Xp :
break;
case COLL_SHAPE_PLATFORM_Yn :
_local1 = -_local1;
break;
case COLL_SHAPE_PLATFORM_Yp :
break;
}
_local3 = _local3 + (("w=\"" + String(_local2)) + "\" ");
_local3 = _local3 + (("h=\"" + String(_local1)) + "\" ");
_local3 = _local3 + (("type=\"" + String(_local6.coll_type_name)) + "\" ");
_local3 = _local3 + "/>\n";
_local5 = _local5 + _local3;
}
_local5 = _local5 + "\n<!-- Decorations: -->\n";
_local5 = _local5 + "\n<!-- Creatures/Characters: -->\n";
for (obj_key in m_go_actors) {
var _local4 = getObj(obj_key);
var _local6 = m_go_actors[obj_key];
var _local3 = "<achar ";
_local3 = _local3 + (("x=\"" + String(_local4.x)) + "\" ");
_local3 = _local3 + (("y=\"" + String(_local4.y)) + "\" ");
_local3 = _local3 + (("rot=\"" + String(_local4.rotation)) + "\" ");
_local3 = _local3 + (("type=\"" + String(_local4.game_type)) + "\" ");
_local3 = _local3 + "/>\n";
_local5 = _local5 + _local3;
}
_local5 = _local5 + "\n<!-- Items: -->\n";
_local5 = _local5 + "\n<!-- Triggers: -->\n";
_local5 = _local5 + "</level>\n";
System.setClipboard(_local5);
return(_local5);
};
this.syncinput = function () {
var _local3 = input_mouse_screen_x;
var _local2 = input_mouse_screen_y;
input_mouse_screen_x = _root._xmouse;
input_mouse_screen_y = -_root._ymouse;
input_mouse_dx = input_mouse_screen_x - _local3;
input_mouse_dy = input_mouse_screen_y - _local2;
input_mouse_x = _xmouse;
input_mouse_y = -_ymouse;
if (input_mouse_is_down) {
input_mouse_down = input_mouse_down + 1;
} else {
input_mouse_down = 0;
}
};
this.rungame = function () {
if (getGameMode() == 0) {
var _local6 = new Array();
for (obj_key in m_go_actors) {
var _local1 = getObj(obj_key);
if (_local1.destroy == 0) {
if (_local1._init == 0) {
_local1.clip.gotoAndStop(_local1.clip_frame);
_local1._init = 1;
} else if (_local1._init == 1) {
if (_local1.clip != null) {
_local1.anim_curr = "";
_local1.anim_next = "";
_local1.anim_prev = "";
_local1.clip_anim = _local1.clip.mc;
_local1.clip_coll = _local1.clip_anim.cbox;
_local1.clip._visible = true;
_local1.clip.init(_local1);
syncGameObjToFlash(_local1);
}
_local1._init = 2;
} else {
_local1.clip_coll = _local1.clip_anim.cbox;
_local1.clip.runAI(_local1);
}
} else {
_local6.push(obj_key);
}
}
var _local12 = _local6.length;
while (_local12 > 0) {
_local12--;
key = _local6.pop();
remObj(key);
}
for (obj_key in m_go_actors) {
var _local1 = getObj(obj_key);
if (_local1._init > 1) {
m_shash.remove(getUID(_local1), String(_local1.game_class), getCollMin(_local1), getCollMax(_local1));
_local1.clip.run(_local1);
if (!syncGameObjToFlash(_local1)) {
}
_local1.clip_anim = _local1.clip.mc;
_local1.clip_coll = _local1.clip_anim.cbox;
m_shash.insert(getUID(_local1), String(_local1.game_class), getCollMin(_local1), getCollMax(_local1));
_local1.update = 0;
}
}
_local6 = new Array();
for (obj_key in m_go_bullets) {
var _local1 = getObj(obj_key);
var _local5 = m_go_bullets[obj_key];
_local1.coll_x = 0;
_local1.coll_y = 0;
_local1.coll_w = _local5.w;
_local1.coll_h = _local5.h;
_local5.timeout--;
if (_local5.timeout < 0) {
_local1.destroy = 1;
_local6.push(getUID(_local1));
} else {
var _local9 = 1;
var _local8 = _local1.x;
var _local7 = _local1.y;
var _local2 = moveAgainstFirstTypeLinear(_local1, GAMECLASS_ACTOR, _local5.owner_uid);
_local1.x = _local8;
_local1.y = _local7;
var _local3 = moveAgainstFirstTypeLinear(_local1, GAMECLASS_COLL);
_local1.x = _local8;
_local1.y = _local7;
if (_local3.hit_uid >= 0) {
if (_local3.hit_time < _local2.hit_time) {
_local2.x = _local3.x;
_local2.y = _local3.y;
_local2.nx = _local3.nx;
_local2.ny = _local3.ny;
_local2.hit_time = _local3.hit_time;
_local2.hit_uid = _local3.hit_uid;
_local9 = 0;
}
}
if (_local2.hit_uid >= 0) {
if (_local9 == 1) {
addParticle(_local2.x, _local2.y, "FlashSplashRed");
_local1.destroy = 1;
_local6.push(getUID(_local1));
} else {
_local1.destroy = 1;
_local6.push(getUID(_local1));
addParticle(_local2.x, _local2.y, "FlashSplash");
}
} else {
_local1.x = _local8 + _local1.vx;
_local1.y = _local7 + _local1.vy;
}
}
if (_local1.destroy == 0) {
if (!syncGameObjToFlash(_local1)) {
}
}
}
_local12 = _local6.length;
while (_local12 > 0) {
_local12--;
key = _local6.pop();
remObj(key);
}
} else {
for (obj_key in m_go_actors) {
var _local1 = getObj(obj_key);
if (_local1._init == 0) {
_local1.clip.gotoAndStop(_local1.clip_frame);
_local1._init = 1;
} else if (_local1._init == 1) {
if (_local1.clip != null) {
_local1.clip_anim = _local1.clip.mc;
_local1.clip_coll = _local1.clip_anim.cbox;
_local1.clip._visible = true;
syncGameObjToFlash(_local1);
_local1.clip_anim.stop();
}
_local1._init = 2;
} else {
m_shash.remove(obj_key, String(_local1.game_class), getCollMin(_local1), getCollMax(_local1));
_local1.clip_anim = null;
syncGameObjToFlash(_local1);
_local1.clip_anim = _local1.clip.mc;
_local1.clip_coll = _local1.clip_anim.cbox;
_local1.clip_anim.stop();
m_shash.encloseRange(getCollMin(_local1) / m_shash.getBinSize(), getCollMax(_local1) / m_shash.getBinSize());
m_shash.insert(obj_key, String(_local1.game_class), getCollMin(_local1), getCollMax(_local1));
}
}
for (okey in m_go_coll) {
var _local1 = getObj(okey);
var _local4 = m_go_coll[okey];
m_shash.remove(getUID(_local1), String(_local1.game_class), getCollMin(_local1), getCollMax(_local1));
syncGameObjToFlash(_local1);
_local1.x = Math.floor(_local1.x / m_game_snap) * m_game_snap;
_local1.y = Math.floor(_local1.y / m_game_snap) * m_game_snap;
_local1.coll_w = Math.floor(_local1.coll_w / m_game_snap) * m_game_snap;
_local1.coll_h = Math.floor(_local1.coll_h / m_game_snap) * m_game_snap;
_local1.coll_x = Math.floor(_local1.coll_x / m_game_snap) * m_game_snap;
_local1.coll_y = Math.floor(_local1.coll_y / m_game_snap) * m_game_snap;
_local4.type = _determineCollType(_local4.coll_type_name, _local1.scale_x, _local1.scale_y);
_local1.game_type = _local4.type;
var _local11 = 100;
var _local10 = 100;
if (_local1.scale_x < 0) {
_local11 = -100;
}
if (_local1.scale_y < 0) {
_local10 = -100;
}
_local1.scale_x = _local11 * (_local1.coll_w / 5);
_local1.scale_y = _local10 * (_local1.coll_h / 5);
_local4.w = _local1.coll_w;
_local4.h = _local1.coll_h;
_local4.x = _local1.coll_x + _local1.x;
_local4.y = _local1.coll_y + _local1.y;
m_shash.encloseRange(getCollMin(_local1) / m_shash.getBinSize(), getCollMax(_local1) / m_shash.getBinSize());
m_shash.insert(getUID(_local1), String(_local1.game_class), getCollMin(_local1), getCollMax(_local1));
}
}
};
this.updategame = function () {
if (getViewObj() != null) {
var _local2 = getViewObj();
m_view_x = getPosX(_local2);
m_view_y = getPosY(_local2);
}
this._xscale = 100 * m_view_zoom;
this._yscale = 100 * m_view_zoom;
this._x = (-m_view_x) * m_view_zoom;
this._y = m_view_y * m_view_zoom;
this._x = this._x + (MAIN_WIDTH / 2);
this._y = this._y + (MAIN_HEIGHT / 2);
CLIP_MUSIC.update();
};
this.edit_selected_stack = new Array();
this.edit_selected_stack_index = 0;
this.edit_select_outline = _parent.sel_outline;
this.edit_TransformObjects = function (objarray, ind_move, ind_rotate, ind_scale) {
var _local4 = 0;
var _local9 = objarray.length;
while (_local4 < _local9) {
var _local2 = objarray[_local4];
_local4++;
var _local8 = 4;
if (hasObj(_local2)) {
var _local1 = getObj(_local2);
if (ind_move) {
_local1.x = _local1.x + ((getViewZoom() * 1) * getMouseDX());
_local1.y = _local1.y + ((getViewZoom() * 1) * getMouseDY());
if (getGameClass(_local1) == GAMECLASS_COLL) {
_local1.x = getMouseX();
_local1.y = getMouseY();
}
}
if (ind_rotate) {
if (getGameClass(_local1) != GAMECLASS_COLL) {
var _local6 = getMouseX() - _local1.x;
var _local5 = getMouseY() - _local1.y;
var _local3 = Math.sqrt((_local6 * _local6) + (_local5 * _local5));
_local6 = _local6 / _local3;
_local5 = _local5 / _local3;
_local1.rotation = (Math.atan2(_local6, _local5) * 180) / Math.PI;
}
}
if (ind_scale) {
if (getGameClass(_local1) == GAMECLASS_COLL) {
var _local6 = getMouseX() - _local1.x;
var _local5 = getMouseY() - _local1.y;
_local1.scale_x = _local6 * 20;
_local1.scale_y = _local5 * 20;
} else {
var _local7 = (getMouseDY() * 0.0625) + 1;
_local1.scale_x = _local1.scale_x * _local7;
_local1.scale_y = _local1.scale_x;
}
}
syncGameObjToFlash(_local1);
}
}
};
this.onEnterFrame = function () {
syncinput();
var _local3 = _parent.cursor;
edit_select_outline = _parent.sel_outline;
if (getGameMode() == 0) {
edit_select_outline._visible = false;
_local3._visible = false;
if (isGamePaused()) {
} else {
rungame();
}
} else {
edit_select_outline._visible = false;
_local3._visible = true;
_local3._x = _parent._xmouse;
_local3._y = _parent._ymouse;
_local3.gotoAndStop("point");
var EG = _parent.editgui;
if (EG != undefined) {
var _local21 = Number(Key.isDown("Z".charCodeAt(0)));
var _local12 = Number(Key.isDown(16));
var _local31 = Number(Key.isDown("X".charCodeAt(0)));
var _local23 = Number(Key.isDown("A".charCodeAt(0)));
var _local22 = Number(Key.isDown("G".charCodeAt(0)));
var _local27 = Number(Key.isDown("R".charCodeAt(0)));
var _local30 = Number(Key.isDown("S".charCodeAt(0)));
var _local10 = getMouseDown();
clearViewObj();
var _local9 = _local22;
var _local6 = _local27;
var _local7 = _local30;
var _local19 = (_local9 + _local6) + _local7;
if (_local21) {
if (_local10) {
} else if (_local12) {
_local3.gotoAndStop("zoom");
setViewZoom(getViewZoom() * (1 + (0.01 * getMouseDY())));
} else {
_local3.gotoAndStop("pan");
setViewX(getViewX() - ((getViewZoom() * 1) * getMouseDX()));
setViewY(getViewY() - ((getViewZoom() * 1) * getMouseDY()));
}
} else if (_local19 != 0) {
if (_local9) {
_local3.gotoAndStop("move");
_local6 = 0;
_local7 = 0;
} else if (_local6) {
_local3.gotoAndStop("rotate");
_local9 = 0;
_local7 = 0;
} else if (_local7) {
_local3.gotoAndStop("scale");
_local9 = 0;
_local6 = 0;
}
if (edit_selected_stack.length > 0) {
if (edit_selected_stack_index >= 0) {
var _local18 = new Array();
_local18.push(edit_selected_stack[edit_selected_stack_index]);
edit_TransformObjects(_local18, _local9, _local6, _local7);
} else {
edit_TransformObjects(edit_selected_stack, _local9, _local6, _local7);
}
}
} else if (_local23) {
_local3.gotoAndStop("add");
if (_local12) {
if (_local10 == 1) {
if (edit_selected_stack.length > 0) {
if (edit_selected_stack_index >= 0) {
var _local26 = edit_selected_stack[edit_selected_stack_index];
var _local15 = copyObj(_local26);
if (_local15 >= 0) {
var _local4 = getObj(_local15);
_local4.x = getMouseX();
_local4.y = getMouseY();
edit_selected_stack = new Array();
edit_selected_stack.push(_local15);
edit_selected_stack_index = 0;
}
}
}
}
} else if (_local10 == 1) {
var _local13 = EG.getSelectionType();
if (_local13.length > 0) {
var _local20 = -1;
if (EG.text_mode == "Decor") {
_local20 = addDecor(getMouseX(), getMouseY(), 0, 100, 100, _local13);
} else if (EG.text_mode == "Shape") {
_local20 = addColl(getMouseX(), getMouseY(), MAIN_PIXELS_PER_METER, MAIN_PIXELS_PER_METER, _local13);
} else if (EG.text_mode == "Actor") {
_local20 = addActor(getMouseX(), getMouseY(), _local13);
}
if (_local20 >= 0) {
var _local4 = getObj(_local20);
edit_selected_stack = new Array();
edit_selected_stack.push(_local20);
edit_selected_stack_index = 0;
}
}
}
} else if (_local31) {
_local3.gotoAndStop("delete");
if (_local10 == 1) {
if (_local12) {
} else {
if (edit_selected_stack_index >= 0) {
remObj(edit_selected_stack[edit_selected_stack_index]);
edit_selected_stack.splice(edit_selected_stack_index, 1);
}
edit_selected_stack = new Array();
edit_selected_stack_index = -1;
}
}
} else if (_local12) {
_local3.gotoAndStop("select");
if (_local10 == 1) {
if ((getMouseDX() == 0) && (getMouseDY() == 0)) {
edit_selected_stack_index++;
if (edit_selected_stack_index >= edit_selected_stack.length) {
edit_selected_stack_index = 0;
}
}
} else {
var _local11 = GAMECLASS_NONE;
if (EG.text_mode == "Decor") {
_local11 = GAMECLASS_DECOR;
} else if (EG.text_mode == "Shape") {
_local11 = GAMECLASS_COLL;
} else if (EG.text_mode == "Actor") {
_local11 = GAMECLASS_ACTOR;
}
var _local5 = 0;
edit_selected_stack = new Array();
var _local8 = m_shash.get(String(_local11), getMouseX(), getMouseX());
for (xi in _local8) {
var _local2 = getObj(xi);
if (hitsPoint(_local2, getMouseX(), getMouseY())) {
edit_selected_stack.push(xi);
if (edit_selected_stack_index < 0) {
edit_selected_stack_index = 0;
}
_local5++;
}
}
if (_local5 != 0) {
} else {
edit_selected_stack_index = -1;
}
}
}
if (EG.btn_quit.onPress == undefined) {
EG.btn_quit.onPress = function () {
_parent.gotoAndPlay("export");
};
}
if (EG.btn_save.onPress == undefined) {
EG.btn_save.onPress = function () {
var _local1 = saveXMLLevel();
};
}
if (EG.btn_load.onPress == undefined) {
EG.btn_load.onPress = function () {
clearGame();
loadXMLLevel("levels/" + EG.text_filenameclip.text);
};
}
if (EG.btn_play.onPress == undefined) {
EG.btn_play.onPress = function () {
var _local2 = addActor(0, 10, "default");
var _local1 = getObj(_local2);
_local1.input_type = 1;
setViewZoom(1);
setViewObj(_local1);
setGameMode(0);
unhideGame();
unpauseGame();
};
}
if (EG.btn_mode_left.onPress == undefined) {
EG.btn_mode_left.onPress = function () {
if (EG.text_mode == "Actor") {
EG.text_mode = "Decor";
EG.obfield.loadMapData("Decor", EG.mapDecor);
} else if (EG.text_mode == "Decor") {
EG.text_mode = "Shape";
EG.obfield.loadMapData("Shape", EG.mapShape);
} else {
EG.text_mode = "Actor";
EG.obfield.loadMapData("Actors", EG.mapActor);
}
};
EG.btn_mode_left.onPress();
}
if (EG.btn_mode_right.onPress == undefined) {
EG.btn_mode_right.onPress = function () {
if (EG.text_mode == "Actor") {
EG.text_mode = "Shape";
EG.obfield.loadMapData("Shape", EG.mapShape);
} else if (EG.text_mode == "Shape") {
EG.text_mode = "Decor";
EG.obfield.loadMapData("Decor", EG.mapDecor);
} else {
EG.text_mode = "Actor";
EG.obfield.loadMapData("Actors", EG.mapActor);
}
};
}
EG.text_objtype = EG.getSelectionType();
rungame();
if (edit_selected_stack.length > 0) {
if (edit_selected_stack_index >= 0) {
var _local4 = getObj(edit_selected_stack[edit_selected_stack_index]);
var _local29 = (_local4.x - _local4.coll_w) + _local4.coll_x;
var _local28 = -((_local4.y + _local4.coll_h) + _local4.coll_y);
edit_select_outline._x = (_local29 * (_xscale / 100)) + _x;
edit_select_outline._y = (_local28 * (_yscale / 100)) + _y;
edit_select_outline._xscale = (_local4.coll_w / 0.32) * (_xscale / 100);
edit_select_outline._yscale = (_local4.coll_h / 0.32) * (_yscale / 100);
edit_select_outline._visible = true;
var _local24 = new flash.geom.Transform(edit_select_outline);
var _local25 = new flash.geom.ColorTransform((Math.random() / 4) + 0.75, (Math.random() / 4) + 0.75, (Math.random() / 4) + 0.75, 1, 0, 0, 0, 0);
_local24.colorTransform = _local25;
}
}
}
}
var _local14 = _parent.sound_gui;
if (_local14 != undefined) {
if (_local14.changed) {
setSoundVolume(_local14.volume_sounds);
setMusicVolume(_local14.volume_music);
}
}
var _local16 = _parent.zoom_slider;
if (_local16 != undefined) {
if (_local16.changed) {
setViewZoom(_local16.value);
}
}
if (_parent.passtextclip != undefined) {
password_entered = _parent.passtextclip.text;
}
if (_parent.locker != undefined) {
_parent.locker.password = password_entered;
}
updategame();
CLIP_COLL._visible = true;
if (Key.isDown(45)) {
var _local17 = Math.random();
if (_local17 > 0.5) {
if (_local17 > 0.75) {
playSound("FL_Item Coin Up.wav");
} else {
playSound("FL_Itemgotglitter.wav");
}
} else if (_local17 > 0.25) {
playSound("FL_bjumper.wav");
} else {
playSound("Space Gun 06.wav");
}
}
};
stop();
Symbol 186 MovieClip Frame 1
var bmsize = 256;
var bitmapData_1 = (new flash.display.BitmapData(bmsize, bmsize, false, 13421772));
var bitmapData_2 = (new flash.display.BitmapData(bmsize, bmsize, false, 16711680));
var mc_1 = this.createEmptyMovieClip("mc_1", this.getNextHighestDepth());
mc_1.attachBitmap(bitmapData_1, this.getNextHighestDepth());
var mc_2 = this.createEmptyMovieClip("mc_2", this.getNextHighestDepth());
mc_2.attachBitmap(bitmapData_2, this.getNextHighestDepth());
var blurfilter = (new flash.filters.BlurFilter(1.1, 1.1, 1));
bitmapData_2.perlinNoise(bmsize, bmsize, 4, randomNum, false, true, 7, false, null);
spazcount = 0;
spazmode = 0;
spazfilter = 1;
this.onEnterFrame = function () {
if (spazcount == 0) {
spazcount = 150 + Math.floor(Math.random() * 60);
spazmode = Math.floor(Math.random() * 4);
}
spazcount--;
switch (spazfilter) {
case 0 :
bitmapData_2.applyFilter(bitmapData_2, bitmapData_2.rectangle, new flash.geom.Point(0, 0), blurfilter);
break;
default :
var _local2 = [0, 1, 0, 1, 6, 1, 0, 1, -1];
var _local3 = new flash.filters.ConvolutionFilter(3, 3, _local2, 9);
bitmapData_2.applyFilter(bitmapData_2, bitmapData_2.rectangle, new flash.geom.Point(0, 0), _local3);
}
var _local1 = 4;
switch (spazmode & 255) {
case 1 :
var _local4 = Math.floor(32767 * Math.random());
bitmapData_1.noise(_local4, 0, 255, 7, false);
_local1 = 8;
break;
case 2 :
_local4 = Math.floor(32767 * Math.random());
bitmapData_1.perlinNoise(bmsize, bmsize, 4, _local4, false, true, 7, true, null);
_local1 = 8;
break;
case 3 :
_local4 = Math.floor(32767 * Math.random());
bitmapData_1.perlinNoise(bmsize, bmsize, 4, _local4, false, true, 7, false, null);
_local1 = 8;
break;
default :
_local4 = Math.floor(32767 * Math.random());
bitmapData_1.noise(_local4, 0, 255, 1, true);
_local1 = 8;
}
bitmapData_2.merge(bitmapData_1, new flash.geom.Rectangle(0, 0, bmsize, bmsize), new flash.geom.Point(0, 0), _local1, _local1, _local1, 0);
};
stop();
Symbol 189 Button
on (press) {
var randy = Math.random();
if (randy > 0.333) {
if (randy > 0.666) {
g.playSound("FL_Item Coin Up.wav");
} else {
g.playSound("FL_Itemgotglitter.wav");
}
} else {
g.playSound("FL_bjumper.wav");
}
}
Symbol 195 Button
on (press) {
g.playSound("FL_Itemgotglitter.wav");
g.clearGame();
g.loadXMLLevel("levels/test.xml");
var guid = g.addActor(0, 10, "default");
var gobj = g.getObj(guid);
gobj.input_type = 1;
g.setViewZoom(1);
g.setViewObj(gobj);
g.setGameMode(0);
g.unhideGame();
g.unpauseGame();
g.playMusic("./music/FlashSimplePLatformer.mp3");
gotoAndPlay ("game");
}
Symbol 197 Button
on (press) {
gotoAndPlay ("edit");
}
Symbol 206 Button
on (press) {
mouse_down = 1;
}
on (release) {
mouse_down = 0;
}
on (releaseOutside) {
mouse_down = 0;
}
Symbol 207 MovieClip Frame 1
this.value = 1;
this.changed = 0;
this.mouse_down = 0;
this.onEnterFrame = function () {
if (mouse_down) {
var _local2 = 48;
var _local1 = _xmouse;
if (_local1 > _local2) {
_local1 = _local2;
}
if (_local1 < 0) {
_local1 = 0;
}
rmask._x = _local1 - _local2;
value = _local1 / _local2;
changed = 1;
}
};
stop();
Symbol 208 Button
on (press) {
m_sound_muted = !m_sound_muted;
changed = 1;
}
Symbol 209 Button
on (press) {
m_music_muted = !m_music_muted;
changed = 1;
}
Symbol 211 MovieClip Frame 1
this.volume_sounds = sound_muted * sound_volume;
this.volume_music = music_muted * music_volume;
this.changed = 1;
this.m_position_x = this._x;
this.m_position_y = this._y;
this.m_music_volume = 100;
this.m_sound_volume = 100;
this.m_music_muted = 0;
this.m_sound_muted = 0;
this.onEnterFrame = function () {
if (sslider.changed) {
m_sound_volume = sslider.value * 100;
sslider.changed = 0;
changed = 1;
}
if (mslider.changed) {
m_music_volume = mslider.value * 100;
mslider.changed = 0;
changed = 1;
}
if (changed != 0) {
volume_sounds = (!m_sound_muted) * m_sound_volume;
volume_music = (!m_music_muted) * m_music_volume;
if (volume_sounds < 0) {
volume_sounds = 0;
} else if (volume_sounds > 100) {
volume_sounds = 100;
}
if (volume_music < 0) {
volume_music = 0;
} else if (volume_music > 100) {
volume_music = 100;
}
changed = 1;
}
if (volume_music <= 0) {
mcone.gotoAndStop("off");
} else {
mcone.gotoAndStop("on");
}
if (volume_sounds <= 0) {
scone.gotoAndStop("off");
} else {
scone.gotoAndStop("on");
}
};
stop();
Symbol 211 MovieClip Frame 2
stop();
Symbol 229 MovieClip Frame 1
stop();
Symbol 229 MovieClip Frame 6
stop();
Symbol 229 MovieClip Frame 15
stop();
Symbol 229 MovieClip Frame 22
stop();
Symbol 234 MovieClip Frame 1
function sortdarray(a, b) {
var _local2 = a.name;
var _local1 = b.name;
if (_local2 < _local1) {
return(-1);
}
if (_local2 > _local1) {
return(1);
}
return(0);
}
function loadMapData(typestr, rmap) {
this.darray = new Array();
for (var _local7 in rmap) {
var _local4 = rmap[_local7];
var _local2 = new Object();
_local2.name = _local4.name;
_local2.frame = _local4.frame;
_local2.type = typestr;
_local2.anim = 0;
_local2.shaders = [];
this.darray.push(_local2);
}
this.darray.sort(sortdarray);
curpow = 1;
curL = this.darray.length;
maxx = Math.ceil(Math.sqrt(curL));
total_size_x = maxx;
total_size_y = total_size_x;
for (sci in sclips) {
var _local3 = sclips[sci];
_local3._prevtype = null;
_local3._prevname = null;
_local3._prevframe = null;
_local3.gotoAndStop(1);
}
return(0);
}
var sclips = Array(f.s0, f.s1, f.s2, f.s3, f.s4, f.s5, f.s6, f.s7, f.s8);
for (sci in sclips) {
var sc = sclips[sci];
sc._prevtype = null;
sc._prevname = null;
sc._prevframe = null;
}
var vsize = 48;
var ssize = 72;
var smousedown = 0;
var center_x = 0;
var center_y = 0;
var prev_vx = 0;
var prev_vy = 0;
var total_size_x = 0;
var total_size_y = 0;
var darray = new Array();
b.onPress = function () {
smousedown = 1;
};
b.onRelease = function () {
smousedown = 0;
};
b.onReleaseOutside = function () {
smousedown = 0;
};
b._xmouse_prev = b._xmouse;
b._ymouse_prev = b._ymouse;
this.clampValue = function (value, min, max) {
var _local1 = value;
if (_local1 > max) {
_local1 = _local1 - (Math.floor((_local1 - min) / (max - min)) * (max - min));
} else if (_local1 < min) {
_local1 = _local1 - (Math.floor((_local1 + max) / (max - min)) * (max - min));
}
return(_local1);
};
this.onEnterFrame = function () {
var _local25 = b._xmouse / 4;
var _local24 = b._ymouse / 4;
_local25 = (b._xmouse - b._xmouse_prev) * 2;
_local24 = (b._ymouse - b._ymouse_prev) * 2;
b._xmouse_prev = b._xmouse;
b._ymouse_prev = b._ymouse;
if (smousedown) {
center_x = center_x + _local25;
center_y = center_y + _local24;
prev_vx = _local25;
prev_vy = _local24;
f._xscale = f._xscale + ((100 - f._xscale) / 5);
f._yscale = f._yscale + ((100 - f._yscale) / 5);
}
if (total_size_x > 0) {
while (center_x < 0) {
center_x = center_x + (total_size_x * vsize);
}
while (center_x >= (total_size_x * vsize)) {
center_x = center_x - (total_size_x * vsize);
}
}
if (total_size_y > 0) {
while (center_y < 0) {
center_y = center_y + (total_size_y * vsize);
}
while (center_y > (total_size_y * vsize)) {
center_y = center_y - (total_size_y * vsize);
}
}
var _local22 = Math.round(center_x / vsize);
var _local21 = Math.round(center_y / vsize);
if (!smousedown) {
center_x = center_x + (((_local22 * vsize) - center_x) / 8);
center_y = center_y + (((_local21 * vsize) - center_y) / 8);
prev_vx = prev_vx * 0.95;
prev_vy = prev_vy * 0.95;
f._xscale = f._xscale + ((200 - f._xscale) / 10);
f._yscale = f._yscale + ((200 - f._yscale) / 10);
}
var _local23 = this.darray.length;
var _local19 = 100000 /* 0x0186A0 */;
var _local20 = 0;
var _local16 = 0;
for (sci in sclips) {
var _local2 = sclips[sci];
var _local5 = clampValue((int(_local16 % 3) * vsize) + center_x, -ssize, ssize);
var _local4 = clampValue((int(_local16 / 3) * vsize) + center_y, -ssize, ssize);
_local2._x = _local5;
_local2._y = _local4;
var _local15 = (_local5 * _local5) + (_local4 * _local4);
if (_local15 < _local19) {
_local19 = _local15;
_local20 = sci;
}
var _local18 = ((Math.round(_local5 / vsize) + total_size_x) - _local22) % total_size_x;
var _local17 = ((Math.round(_local4 / vsize) + total_size_y) - _local21) % total_size_y;
var _local12 = _local18 + (_local17 * total_size_x);
_local12 = _local12 % _local23;
_local2._dataindex = _local12;
var _local10 = this.darray[_local12];
var _local6 = _local10.type;
var _local11 = _local10.frame;
var _local7 = _local10.name;
if (_local2._prevtype != _local6) {
_local2.gotoAndStop(_local6);
_local2._prevtype = _local6;
_local2._prevname = null;
} else if (_local2._prevname != _local7) {
_local2.mc.gotoAndStop(_local7);
_local2._prevname = _local7;
_local2._prevframe = null;
} else if (_local2._prevframe != _local11) {
_local2.mc.mc.gotoAndStop(_local11);
_local2._prevframe = _local11;
}
if (_local2.mc != null) {
if ((_local2._prevtype == _local6) && (_local2._prevname == _local7)) {
_local2.mc._visible = true;
_local2.mc.mc._visible = true;
var _local3 = _local2.mc.getBounds(_local2);
var _local14 = _local3.xMax - _local3.xMin;
var _local13 = _local3.yMax - _local3.yMin;
if ((_local14 > 0) && (_local13 > 0)) {
var _local9 = 100;
var _local8 = 100;
if (_local14 > 0) {
_local9 = _local2.mc._xscale * (vsize / _local14);
}
if (_local13 > 0) {
_local8 = _local2.mc._yscale * (vsize / _local13);
}
if (_local9 < _local8) {
_local2.mc._xscale = _local9;
_local2.mc._yscale = _local9;
} else {
_local2.mc._xscale = _local8;
_local2.mc._yscale = _local8;
}
_local3 = _local2.mc.getBounds(_local2);
_local2.mc._x = -((_local3.xMin - _local2.mc._x) + ((_local3.xMax - _local3.xMin) / 2));
_local2.mc._y = -((_local3.yMin - _local2.mc._y) + ((_local3.yMax - _local3.yMin) / 2));
}
} else {
_local2.mc._visible = false;
}
}
_local16++;
}
this.current_name = this.darray[sclips[_local20]._dataindex].name;
this.current_type = this.darray[sclips[_local20]._dataindex].type;
this.current_frame = this.darray[sclips[_local20]._dataindex].frame;
tloc.text = ((_local22 % total_size_x) + ",") + (_local21 % total_size_y);
tname.text = this.current_name;
};
this.getCurrName = function () {
return(this.current_name);
};
Symbol 235 MovieClip Frame 1
this.getSelectionType = function () {
return(obfield.getCurrName());
};
this.mapActor = new Map();
mapActor.default = {name:"default", frame:"idle"};
mapActor.gbiped = {name:"gbiped", frame:"idle"};
mapActor.Trapper = {name:"Trapper", frame:"idle"};
mapActor.GBmpDino = {name:"GBmpDino", frame:"idle"};
mapActor.GTestSnake = {name:"GTestSnake", frame:"idle"};
mapActor.Terrorchid = {name:"Terrorchid", frame:"idle"};
this.mapDecor = new Map();
mapDecor["Palm Tree"] = {name:"Palm Tree", frame:"Palm Tree"};
this.mapShape = new Map();
mapShape.Block = {name:"block", frame:""};
mapShape.Ramp = {name:"ramp", frame:""};
mapShape.Platform = {name:"platform", frame:""};
mapShape.Rampform = {name:"rampform", frame:""};
stop();
Symbol 237 MovieClip Frame 1
this.cryptkey = "Herald";
this.showcount = 0;
this.onEnterFrame = function () {
if (this.showcount > 2) {
if (this.password != this.cryptkey) {
trace(((((" Password incorrect! " + this.password) + " ") + this.cryptkey) + " ") + this.showcount);
this.showcount = 0;
_root.gotoAndPlay(1);
}
}
this.showcount++;
};