Frame 1
game.main(this);
Symbol 20480 MovieClip [__Packages.lineHandler] Frame 0
class lineHandler
{
var myArray, mymc, sectorSize, min, max;
function lineHandler () {
console.write("new lineHandler", "lineHandler::lineHandler", "lineHandler.as", 92);
myArray = new Array();
mymc = _root.createEmptyMovieClip("lineLayer", _root.getNextHighestDepth());
sectorSize = 50;
min = new cartesian(0, 0);
max = new cartesian(0, 0);
}
function updateMC() {
mymc.clear();
var _local2 = Math.floor(_root.cam.pos.x / sectorSize);
var _local3 = Math.floor(_root.cam.pos.y / sectorSize);
var _local4 = _local2;
for ( ; _local4 < (_local2 + 12) ; _local4++) {
var _local5 = _local3;
for ( ; _local5 < (_local3 + 10) ; _local5++) {
myArray[_local4][_local5].unHit();
}
}
var _local6 = _local2;
for ( ; _local6 < (_local2 + 12) ; _local6++) {
var _local7 = _local3;
for ( ; _local7 < (_local3 + 10) ; _local7++) {
myArray[_local6][_local7].updateMC();
}
}
}
function addRef(pX, pY, pObj) {
var _local5 = Math.floor(pX / sectorSize);
var _local6 = Math.floor(pY / sectorSize);
min.x = Math.min(_local5, min.x);
min.y = Math.min(_local6, min.y);
max.x = Math.max(_local5, max.x);
max.y = Math.max(_local6, max.y);
if (myArray[_local5] == undefined) {
myArray[_local5] = new Array();
}
if (myArray[_local5][_local6] == undefined) {
myArray[_local5][_local6] = new sector(_local5, _local6);
}
myArray[_local5][_local6].plus(pObj);
}
function checkMass(pObj) {
var _local3 = Math.floor((pObj.pos.x / sectorSize) - 0.5);
var _local4 = Math.floor((pObj.pos.y / sectorSize) - 0.5);
myArray[_local3][_local4].unHit();
myArray[_local3 + 1][_local4].unHit();
myArray[_local3 + 1][_local4 + 1].unHit();
myArray[_local3][_local4 + 1].unHit();
myArray[_local3][_local4].checkMass(pObj);
myArray[_local3 + 1][_local4].checkMass(pObj);
myArray[_local3 + 1][_local4 + 1].checkMass(pObj);
myArray[_local3][_local4 + 1].checkMass(pObj);
}
function erase(pPos) {
var _local3 = Math.floor((pPos.x / sectorSize) - 0.5);
var _local4 = Math.floor((pPos.y / sectorSize) - 0.5);
myArray[_local3][_local4].erase(pPos);
myArray[_local3 + 1][_local4].erase(pPos);
myArray[_local3 + 1][_local4 + 1].erase(pPos);
myArray[_local3][_local4 + 1].erase(pPos);
}
//ASSetPropFlags(_local1, null, 1);
}
Symbol 20481 MovieClip [__Packages.fpsCounter] Frame 0
class fpsCounter
{
var count2, count, lastTimer;
function fpsCounter () {
count2 = 0;
count = 0;
lastTimer = getTimer();
_root.createEmptyMovieClip("fpsLayer", _root.getNextHighestDepth());
_root.fpsLayer.createTextField("textfield", 1, 10, 1, 70, 15);
var _local2 = new TextFormat();
_local2.font = "_sans";
_local2.size = 10;
_local2.color = 11184810 /* 0xAAAAAA */;
_root.fpsLayer.textfield.setNewTextFormat(_local2);
_root.fpsLayer.textfield.selectable = false;
_root.fpsLayer._x = 430;
_root.fpsLayer._y = 380;
report();
}
function report() {
var _local2 = getTimer() - lastTimer;
if (_local2 > 0) {
var _local3 = Math.round((sampleRate * (1000 / _local2)) * 100) / 100;
lastTimer = getTimer();
_root.fpsLayer.textfield.text = "FPS:" + _local3;
_root.fpsLayer.clear();
}
}
function advance() {
count++;
if (count >= sampleRate) {
report();
count = 0;
}
}
//ASSetPropFlags(_local1, null, 1);
var sampleRate = 50;
}
Symbol 20482 MovieClip [__Packages.sector] Frame 0
class sector
{
var myArray, i, j;
function sector (pI, pJ) {
myArray = new Array();
i = pI;
j = pJ;
}
function unHit() {
var _local2 = 0;
for ( ; _local2 < myArray.length ; _local2++) {
myArray[_local2].hit = false;
}
}
function checkMass(pObj) {
var _local3 = 0;
for ( ; _local3 < myArray.length ; _local3++) {
myArray[_local3].checkMass(pObj);
}
}
function updateMC() {
var _local2 = 0;
for ( ; _local2 < myArray.length ; _local2++) {
myArray[_local2].updateMC();
if (myArray[_local2].active == false) {
myArray.splice(_local2, 1);
}
}
}
function erase(pPos) {
var _local3 = 0;
for ( ; _local3 < myArray.length ; _local3++) {
if (myArray[_local3].erase(pPos) == 1) {
myArray.splice(_local3, 1);
}
}
}
function plus(pObj) {
if (myArray.length < 8) {
myArray.push(pObj);
}
}
//ASSetPropFlags(_local1, null, 1);
}
Symbol 20483 MovieClip [__Packages.vehicle] Frame 0
class vehicle
{
var mymc, headWheel, leftWheel, rightWheel, baseSpring, rightSpring, leftSpring, dir, dead, letGoX, letGoSpace, n, a3, a1, a2;
function vehicle () {
console.write("new vehicle", "vehicle::vehicle", "vehicle.as", 128);
var _local2 = _root.getNextHighestDepth();
mymc = _root.createEmptyMovieClip("vehicle_" + _local2, _local2);
mymc._alpha = 0;
headWheel = new head(new cartesian(0, 0), 2, this);
leftWheel = new wheel(new cartesian(-20, 30), 1, this);
rightWheel = new wheel(new cartesian(20, 30), 1, this);
baseSpring = new chasse(leftWheel, rightWheel, 35, 1, this);
rightSpring = new muscle(rightWheel, headWheel, 35, 2, this);
leftSpring = new muscle(leftWheel, headWheel, 35, 1, this);
leftSpring.myKey1 = Key.LEFT;
leftSpring.myKey2 = Key.RIGHT;
rightSpring.myKey2 = Key.LEFT;
rightSpring.myKey1 = Key.RIGHT;
dir = -1;
dead = false;
swap();
updateMC();
}
function swap() {
dir = dir * -1;
leftWheel.motor = Math.floor(dir + 1) / 2;
rightWheel.motor = (-Math.floor(1 - dir)) / 2;
leftSpring.mymc.gotoAndStop((-dir) + 3);
rightSpring.mymc.gotoAndStop(dir + 3);
leftSpring.mymc._yscale = 50 * dir;
rightSpring.mymc._yscale = 50 * dir;
leftSpring.mymc.swapDepths(rightSpring.mymc);
}
function advance() {
if (Key.isDown(Key.UP)) {
leftSpring.trueLength = 35 + (4 * dir);
rightSpring.trueLength = 35 - (4 * dir);
} else {
leftSpring.trueLength = 35;
rightSpring.trueLength = 35;
}
leftWheel.advance();
rightWheel.advance();
headWheel.advance();
leftSpring.advance();
rightSpring.advance();
baseSpring.advance();
if (Key.isDown(88) && (letGoX)) {
letGoX = false;
swap();
}
if (Key.isDown(88) == false) {
letGoX = true;
}
if (Key.isDown(Key.SPACE) && (letGoSpace)) {
_root.restart();
}
if (Key.isDown(Key.SPACE) == false) {
letGoSpace = true;
}
}
function updateMC() {
leftWheel.updateMC();
rightWheel.updateMC();
headWheel.updateMC();
leftSpring.updateMC();
rightSpring.updateMC();
baseSpring.updateMC();
mymc.clear();
mymc.lineStyle(4, 6710886);
if (dir == 1) {
n = new cartesian(baseSpring.s.y, -baseSpring.s.x);
a3 = rightWheel.pos.ADD(n.FACTOR(0.85)).SUB(baseSpring.s.FACTOR(0.15));
a1 = headWheel.pos.SUB(baseSpring.s.FACTOR(0.15)).ADD(leftSpring.s.FACTOR(0.1));
a2 = a1.ADD(a3).FACTOR(0.5).ADD(leftSpring.s.FACTOR(-0.1));
} else {
n = new cartesian(baseSpring.s.y, -baseSpring.s.x);
a3 = leftWheel.pos.ADD(n.FACTOR(0.85)).SUB(baseSpring.s.FACTOR(-0.15));
a1 = headWheel.pos.SUB(baseSpring.s.FACTOR(-0.15)).ADD(rightSpring.s.FACTOR(0.1));
a2 = a1.ADD(a3).FACTOR(0.5).ADD(rightSpring.s.FACTOR(-0.1));
}
mymc.moveTo(a1.x - _root.cam.pos.x, a1.y - _root.cam.pos.y);
mymc.lineTo(a2.x - _root.cam.pos.x, a2.y - _root.cam.pos.y);
mymc.lineTo(a3.x - _root.cam.pos.x, a3.y - _root.cam.pos.y);
if (dead) {
mymc._alpha = mymc._alpha + -2;
if (mymc._alpha < 4) {
_root.restart();
}
} else {
mymc._alpha = mymc._alpha + ((100 - mymc._alpha) * 0.05);
}
}
function die() {
if (dead == false) {
dead = true;
_root.gui.showDeadDialog();
leftSpring.springConstant = 0.08;
rightSpring.springConstant = 0.08;
leftSpring.dampConstant = 0.1;
rightSpring.dampConstant = 0.1;
}
leftWheel.motor = 0;
rightWheel.motor = 0;
}
//ASSetPropFlags(_local1, null, 1);
}
Symbol 20484 MovieClip [__Packages.mass] Frame 0
class mass
{
var pos, posOld, vel, radius, parent, mymc;
function mass (pPos, pFrame, pParent) {
pos = new cartesian(0, 0);
posOld = new cartesian(0, 0);
vel = new cartesian(0, 0);
pos.EQU(pPos);
posOld.EQU(pPos);
radius = 10;
parent = pParent;
var _local5 = parent.mymc.getNextHighestDepth();
mymc = parent.mymc.attachMovie("mass", "mass_" + _local5, _local5);
mymc.gotoAndStop(pFrame);
updateMC();
}
function updateMC() {
mymc._x = pos.x - _root.cam.pos.x;
mymc._y = pos.y - _root.cam.pos.y;
mymc._xscale = radius * 2.5;
mymc._yscale = radius * 2.5;
}
function rotate(pDir) {
mymc._rotation = mymc._rotation + (pDir.getUnit().DOT(vel) * 3);
}
function drive(pDir) {
}
function lineForce(pDir) {
pos.INC(pDir);
}
function springForce(pDir) {
vel.INC(pDir);
}
function advance() {
vel.y = vel.y + _root.console.gravity;
vel.EQU(vel.FACTOR(_root.console.viscosity));
pos.INC(vel);
_root.lines.checkMass(this);
_root.targets.checkMass(this);
vel.EQU(pos.SUB(posOld));
posOld.EQU(pos);
}
//ASSetPropFlags(_local1, null, 1);
}
Symbol 20485 MovieClip [__Packages.soupMath] Frame 0
#initclip
if (!soupMath) {
//(_global.soupMath = function () {
super();
}) extends Math
var _local1 = (_global.soupMath /* register */).prototype;
(_global.soupMath /* register */).toRads = function (p) {
return((p * Math.PI) / 180);
};
(_global.soupMath /* register */).toDegs = function (p) {
return((p * 180) / Math.PI);
};
(_global.soupMath /* register */).mod = function (p1, p2) {
return((Math.abs(p1 / p2) - Math.floor(Math.abs(p1 / p2))) * p2);
};
(_global.soupMath /* register */).mod2Pi = function (p) {
return((((p / (Math.PI * 2)) - Math.floor(p / (Math.PI * 2))) * Math.PI) * 2);
};
(_global.soupMath /* register */).modSpecial = function (p) {
if (p == 0) {
return(0);
}
return((p / Math.abs(p)) * soupMath.mod(Math.abs(p), Math.PI));
};
(_global.soupMath /* register */).rand = function (p) {
return((Math.random() - Math.random()) * p);
};
ASSetPropFlags(_local1, null, 1);
}
#endinitclip
Symbol 20486 MovieClip [__Packages.bikeGUI] Frame 0
class bikeGUI
{
var tools, mymc, dialog, penButton, targetButton, eraseButton, handButton, playButton, stopButton, clearButton, saveButton, loadButton, threeDButton, helpButton, letGoSlash, targetInfo;
function bikeGUI () {
Mouse.addListener(this);
tools.allowDraw = true;
console.write("new GUI", "bikeGUI::bikeGUI", "bikeGUI.as", 404);
tools = new drawingTools();
mymc = _root.createEmptyMovieClip("gui", _root.getNextHighestDepth());
graphics.rectFillLight(0, 0, 28, 400, mymc);
graphics.rect(0, 0, 499, 399, mymc);
createButtons();
createTargetInfo();
showSplash();
}
function closeDialog() {
dialog.removeMovieClip();
tools.allowDraw = true;
_root.cam.focus = 1;
}
function showLoadDialog() {
closeDialog();
tools.allowDraw = false;
dialog = mymc.createEmptyMovieClip("dialog", mymc.getNextHighestDepth());
dialog._x = 100;
dialog._y = 50;
graphics.rectFill(0, 0, 300, 300, dialog);
graphics.title("Load Map", 5, 5, 280, 40, dialog);
graphics.label("Copy the map code, paste it into the box (Ctrl+V) and press OK.", 5, 25, 290, 35, dialog);
graphics.inputBox("inputBox", 5, 65, 290, 195, dialog);
graphics.smallButton("okButton", "Load", 5, 270, dialog);
graphics.smallButton("cancelButton", "Close", 65, 270, dialog);
dialog.okButton.onPress = function () {
if (this._parent.inputBox.text.length > 5) {
parser.parseMap(this._parent.inputBox.text);
}
_root.gui.closeDialog();
};
dialog.cancelButton.onPress = function () {
_root.gui.closeDialog();
};
}
function showSaveDialog() {
closeDialog();
tools.allowDraw = false;
dialog = mymc.createEmptyMovieClip("dialog", mymc.getNextHighestDepth());
dialog._x = 100;
dialog._y = 50;
graphics.rectFill(0, 0, 300, 300, dialog);
graphics.title("Save Map", 5, 5, 280, 40, dialog);
graphics.label("Copy the map code (Ctrl-C), and paste it into an email, forum or instant message.", 5, 25, 290, 35, dialog);
graphics.inputBox("inputBox", 5, 65, 290, 195, dialog);
graphics.smallButton("okButton", "Copy", 5, 270, dialog);
graphics.smallButton("cancelButton", "Close", 65, 270, dialog);
dialog.inputBox.text = parser.export(_root.lines, _root.targets);
dialog.okButton.onPress = function () {
System.setClipboard(this._parent.inputBox.text);
};
dialog.cancelButton.onPress = function () {
_root.gui.closeDialog();
};
}
function showClearDialog() {
closeDialog();
tools.allowDraw = false;
dialog = mymc.createEmptyMovieClip("dialog", mymc.getNextHighestDepth());
dialog._x = 100;
dialog._y = 150;
graphics.rectFill(0, 0, 300, 100, dialog);
graphics.title("Clear Map", 5, 5, 280, 40, dialog);
graphics.label("Are you sure you want to clear the map?", 5, 25, 290, 35, dialog);
graphics.smallButton("okButton", "Yes", 5, 70, dialog);
graphics.smallButton("cancelButton", "No", 65, 70, dialog);
dialog.okButton.onPress = function () {
_root.newMap();
new line(new cartesian(-50, 50), new cartesian(50, 50));
_root.gui.closeDialog();
};
dialog.cancelButton.onPress = function () {
_root.gui.closeDialog();
};
}
function showDeadDialog() {
closeDialog();
tools.allowDraw = false;
dialog = mymc.createEmptyMovieClip("dialog", mymc.getNextHighestDepth());
dialog._x = 100;
dialog._y = 150;
graphics.rectFill(0, 0, 300, 100, dialog);
graphics.title("Ouch!", 5, 5, 280, 40, dialog);
graphics.label("Level failed. (Press Space)", 5, 25, 290, 35, dialog);
graphics.smallButton("okButton", "Retry", 5, 70, dialog);
dialog.okButton.onPress = function () {
_root.restart();
_root.gui.closeDialog();
};
}
function showWinDialog() {
closeDialog();
tools.allowDraw = false;
dialog = mymc.createEmptyMovieClip("dialog", mymc.getNextHighestDepth());
dialog._x = 100;
dialog._y = 150;
graphics.rectFill(0, 0, 300, 100, dialog);
graphics.title("Level Complete!", 5, 5, 280, 40, dialog);
graphics.label("You beat the level!", 5, 25, 290, 35, dialog);
graphics.smallButton("okButton", "Retry", 5, 70, dialog);
dialog.okButton.onPress = function () {
_root.restart();
_root.gui.closeDialog();
};
}
function showConsoleInput() {
_root.gamePause = true;
closeDialog();
tools.allowDraw = false;
dialog = mymc.createEmptyMovieClip("dialog", mymc.getNextHighestDepth());
dialog._x = 100;
dialog._y = 150;
graphics.rectFill(0, 0, 300, 100, dialog);
graphics.title("Console", 5, 5, 280, 40, dialog);
graphics.consoleBox("inputBox", 5, 30, 290, 35, dialog);
graphics.smallButton("okButton", "OK", 5, 70, dialog);
Key.addListener(dialog);
Selection.setFocus("_root.gui.dialog.inputBox");
dialog.okButton.onPress = function () {
_root.gamePause = false;
_root.console.command(this.inputBox.text);
_root.gui.closeDialog();
};
dialog.onKeyUp = function () {
if (Key.getCode() == 13) {
_root.gamePause = false;
_root.console.command(this.inputBox.text);
_root.gui.closeDialog();
}
};
}
function showHelp() {
closeDialog();
tools.allowDraw = false;
dialog = mymc.createEmptyMovieClip("dialog", mymc.getNextHighestDepth());
dialog._x = 100;
dialog._y = 50;
graphics.rectFill(0, 0, 300, 300, dialog);
graphics.title("Help", 5, 5, 80, 90, dialog);
var _local2 = new String();
_local2 = "Accelerate:\t\tUP\nBrake:\t\t\tDOWN\nLean:\t\t\t\tLEFT/RIGHT\nTurn Around:\t\tX\n";
_local2 = _local2 + "Quick Camera:\tCTRL\nQuick Draw:\t\tSHIFT\n\n";
_local2 = _local2 + "Use the mouse to draw a map, create some stars, then try to collect them all.\n ----- ";
dialog.attachMovie("parroe", "parroe", dialog.getNextHighestDepth(), {_x:10, _y:180});
dialog.parroe.onPress = function () {
getURL ("http://www.parroe.devisland.net", "_self");
};
dialog.attachMovie("oml", "oml", dialog.getNextHighestDepth(), {_x:100, _y:180});
dialog.oml.onPress = function () {
getURL ("http://www.onemorelevel.com", "_self");
};
dialog.attachMovie("swfmill", "swfmill", dialog.getNextHighestDepth(), {_x:10, _y:215});
dialog.swfmill.onPress = function () {
getURL ("http://www.swfmill.org", "_self");
};
dialog.attachMovie("cinnaminta", "cinnaminta", dialog.getNextHighestDepth(), {_x:190, _y:180});
dialog.cinnaminta.onPress = function () {
getURL ("http://www.cinnaminta.com", "_self");
};
dialog.attachMovie("mtasc", "mtasc", dialog.getNextHighestDepth(), {_x:100, _y:215});
dialog.mtasc.onPress = function () {
getURL ("http://www.mtasc.org", "_self");
};
dialog.attachMovie("props", "props", dialog.getNextHighestDepth(), {_x:190, _y:215});
graphics.label(_local2, 5, 25, 290, 245, dialog);
graphics.smallButton("cancelButton", "Close", 5, 270, dialog);
dialog.cancelButton.onPress = function () {
_root.gui.closeDialog();
};
}
function showSplash() {
var _local2 = mymc.attachMovie("splash", "splash", mymc.getNextHighestDepth());
_local2._x = 125;
_local2._y = 50;
_local2.count = 0;
_local2.onEnterFrame = function () {
this.count++;
if (this.count > 200) {
this._alpha = this._alpha + -5;
}
if (this._alpha < 5) {
this.removeMovieClip();
}
};
_local2.onPress = function () {
this.count = 200;
};
}
function createButtons() {
penButton = mymc.attachMovie("penButton", "penButton", 1, {_x:0, _y:0});
targetButton = mymc.attachMovie("targetButton", "targetButton", 2, {_x:0, _y:26});
eraseButton = mymc.attachMovie("eraseButton", "eraseButton", 3, {_x:0, _y:52});
handButton = mymc.attachMovie("handButton", "handButton", 4, {_x:0, _y:78});
playButton = mymc.attachMovie("playButton", "playButton", 6, {_x:0, _y:114});
stopButton = mymc.attachMovie("stopButton", "stopButton", 7, {_x:0, _y:140});
clearButton = mymc.attachMovie("clearButton", "clearButton", 5, {_x:0, _y:176});
saveButton = mymc.attachMovie("saveButton", "saveButton", 8, {_x:0, _y:202});
loadButton = mymc.attachMovie("loadButton", "loadButton", 9, {_x:0, _y:228});
threeDButton = mymc.attachMovie("threeDButton", "threeDButton", 10, {_x:0, _y:264});
helpButton = mymc.attachMovie("helpButton", "helpButton", 11, {_x:0, _y:290});
penButton.onPress = function () {
_root.gui.tools.tool = 1;
_root.cam.focus = -1;
};
targetButton.onPress = function () {
_root.gui.tools.tool = 4;
_root.cam.focus = -1;
};
eraseButton.onPress = function () {
_root.gui.tools.tool = 2;
_root.cam.focus = -1;
};
handButton.onPress = function () {
_root.gui.tools.tool = 3;
_root.cam.focus = -1;
};
clearButton.onPress = function () {
_root.gui.showClearDialog();
};
playButton.onPress = function () {
_root.pauseGame = false;
_root.cam.focus = 1;
};
stopButton.onPress = function () {
_root.restart();
_root.cam.focus = 1;
};
saveButton.onPress = function () {
_root.gui.showSaveDialog();
};
loadButton.onPress = function () {
_root.gui.showLoadDialog();
};
threeDButton.onPress = function () {
if (_root.cam.mode3d) {
_root.cam.mode3d = false;
} else {
_root.cam.mode3d = true;
}
};
helpButton.onPress = function () {
_root.gui.showHelp();
};
}
function onMouseDown() {
if ((_root._xmouse > 40) && (tools.allowDraw)) {
tools.mouseDown();
}
}
function onMouseUp() {
if ((_root._xmouse > 40) && (tools.allowDraw)) {
tools.mouseUp();
}
}
function advance() {
if (_root._xmouse > 40) {
tools.advance();
} else {
tools.mymc.clear();
}
if (Key.isDown(191) && (letGoSlash)) {
letGoSlash = false;
_root.console.show();
showConsoleInput();
}
if (Key.isDown(191) == false) {
letGoSlash = true;
}
}
function updateMC() {
if (tools.tool == 1) {
penButton._x = penButton._x + ((15 - penButton._x) * 0.7);
} else {
penButton._x = penButton._x + ((-penButton._x) * 0.7);
}
if (tools.tool == 4) {
targetButton._x = targetButton._x + ((15 - targetButton._x) * 0.7);
} else {
targetButton._x = targetButton._x + ((-targetButton._x) * 0.7);
}
if (tools.tool == 2) {
eraseButton._x = eraseButton._x + ((15 - eraseButton._x) * 0.7);
} else {
eraseButton._x = eraseButton._x + ((-eraseButton._x) * 0.7);
}
if ((tools.tool == 3) || (Key.isDown(Key.CONTROL))) {
handButton._x = handButton._x + ((15 - handButton._x) * 0.7);
} else {
handButton._x = handButton._x + ((-handButton._x) * 0.7);
}
targetInfo.label_1.text = (_root.targets.hit + " / ") + _root.targets.count;
}
function createTargetInfo() {
targetInfo = mymc.createEmptyMovieClip("targetInfo", mymc.getNextHighestDepth());
targetInfo._x = 430;
targetInfo._y = 5;
targetInfo.attachMovie("targetLogo", "targetImage", 0, {_x:3, _y:3});
targetInfo.targetImage.stop();
graphics.label("0 / 0", 20, 1, 70, 20, targetInfo);
}
//ASSetPropFlags(_local1, null, 1);
}
Symbol 20487 MovieClip [__Packages.game] Frame 0
class game
{
function game () {
}
static function main(mc) {
var _local3 = "http://www.parroe.devisland.net/";
if (_root._url.substr(0, _local3.length) != _local3) {
_root._yscale = -100;
_root._y = 400;
}
Stage.scaleMode = "noScale";
_root._quality = "med";
console.write("Free Rider SE\nPete Shadbolt\n--", "game::main", "FR1SE.as", 18);
_root.console = new console();
_root.cam = new cameraHandler();
_root.targets = new targetHandler();
_root.lines = new lineHandler();
_root.bike = new vehicle();
_root.gui = new bikeGUI();
_root.fps = new fpsCounter();
_root.gamePause = false;
_root.restart = function () {
console.write("RESTART", "game::main", "FR1SE.as", 32);
_root.bike.mymc.removeMovieClip();
_root.bike = new vehicle();
_root.bike.mymc.swapDepths(_root.gui.mymc);
_root.targets.restart();
_root.gui.closeDialog();
};
_root.newMap = function () {
console.write("NEW MAP", "game::main", "FR1SE.as", 42);
_root.lines.mymc.removeMovieClip();
_root.targets.mymc.removeMovieClip();
_root.gui.tools.mymc.removeMovieClip();
_root.lines = new lineHandler();
_root.targets = new targetHandler();
_root.gui.tools = new drawingTools();
_root.restart();
};
var _local4 = new line(new cartesian(-50, 50), new cartesian(50, 50));
_root.onEnterFrame = function () {
if (_root.gamePause == false) {
_root.bike.advance();
_root.cam.advance();
_root.gui.advance();
_root.bike.updateMC();
_root.lines.updateMC();
_root.targets.updateMC();
_root.gui.updateMC();
_root.fps.advance();
}
};
}
//ASSetPropFlags(_local1, null, 1);
}
Symbol 20488 MovieClip [__Packages.spring] Frame 0
class spring
{
var m1, m2, length, dampConstant, springConstant, parent, mymc, s, dist, tens, damp;
function spring (pM1, pM2, pL, pFrame, pParent) {
m1 = pM1;
m2 = pM2;
length = pL;
dampConstant = _root.console.dampConstant;
springConstant = _root.console.springConstant;
parent = pParent;
var _local7 = parent.mymc.getNextHighestDepth();
mymc = parent.mymc.attachMovie("spring", "spring_" + _local7, _local7);
mymc.gotoAndStop(pFrame);
mymc._xscale = 50;
mymc._yscale = 450;
}
function updateMC() {
var _local2 = m1.pos.ADD(m2.pos).FACTOR(0.5);
mymc._x = _local2.x - _root.cam.pos.x;
mymc._y = _local2.y - _root.cam.pos.y;
mymc._rotation = s.getPolar().aDegs();
if (springConstant == 0) {
mymc._alpha = mymc._alpha + ((-mymc._alpha) * 0.2);
} else {
mymc._alpha = 100;
}
}
function advance() {
s = m2.pos.SUB(m1.pos);
dist = s.getLength();
tens = s.FACTOR(((dist - length) * springConstant) / dist);
damp = m2.vel.SUB(m1.vel).DOT(s.getUnit()) * dampConstant;
tens.INC(s.FACTOR(damp / dist));
m2.springForce(tens.FACTOR(-1));
m1.springForce(tens);
}
//ASSetPropFlags(_local1, null, 1);
}
Symbol 20489 MovieClip [__Packages.muscle] Frame 0
#initclip
if (!muscle) {
//(_global.muscle = function (pM1, pM2, pL, pFrame, pParent) {
super(pM1, pM2, pL, pFrame, pParent);
this.trueLength = pL;
}) extends spring
var _local1 = (_global.muscle /* register */).prototype;
_local1.advance = function () {
this.s = this.m2.pos.SUB(this.m1.pos);
this.dist = this.s.getLength();
if ((Key.isDown(this.myKey1) == false) && (Key.isDown(this.myKey2) == false)) {
this.length = this.length + ((this.trueLength - this.length) * 0.1);
}
if (Key.isDown(this.myKey1)) {
this.length = this.length + (((this.trueLength - 5) - this.length) * 0.15);
}
if (Key.isDown(this.myKey2)) {
this.length = this.length + (((this.trueLength + 5) - this.length) * 0.15);
}
this.tens = this.s.FACTOR(((this.dist - this.length) * this.springConstant) / this.dist);
this.damp = this.m2.vel.SUB(this.m1.vel).DOT(this.s.getUnit()) * this.dampConstant;
this.tens.INC(this.s.FACTOR(this.damp / this.dist));
this.m2.springForce(this.tens.FACTOR(-1));
this.m1.springForce(this.tens);
};
ASSetPropFlags(_local1, null, 1);
}
#endinitclip
Symbol 20490 MovieClip [__Packages.line] Frame 0
class line
{
var p1, p2, P1ToP2, hit, d, objToP1, objToP2, l, active, u, ld;
function line (pP1, pP2) {
p1 = new cartesian(0, 0);
p2 = new cartesian(0, 0);
P1ToP2 = new cartesian(0, 0);
p1.EQU(pP1);
p2.EQU(pP2);
hit = false;
d = new cartesian(0, 0);
objToP1 = new cartesian(0, 0);
objToP2 = new cartesian(0, 0);
createReferences();
updateMC();
}
function createReferences() {
P1ToP2 = p2.SUB(p1);
l = P1ToP2.getLength();
if ((l < 5) || ((p1.getLength() > 5000) || (p2.getLength() > 5000))) {
active = false;
}
var _local2;
var _local3;
var _local4 = new cartesian(0, 0);
var _local5 = 0;
for ( ; _local5 < l ; _local5++) {
_local4 = p1.ADD(P1ToP2.FACTOR(_local5 / l));
if ((Math.floor(_local4.x / _root.lines.sectorSize) != _local2) || (Math.floor(_local4.y / _root.lines.sectorSize) != _local3)) {
_local2 = Math.floor(_local4.x / _root.lines.sectorSize);
_local3 = Math.floor(_local4.y / _root.lines.sectorSize);
_root.lines.addRef(_local4.x, _local4.y, this);
}
}
}
function checkMass(pObj) {
if (hit == true) {
return(0);
}
hit = true;
objToP1 = pObj.pos.SUB(p1);
objToP2 = pObj.pos.SUB(p2);
u = objToP1.DOT(P1ToP2) / Math.pow(l, 2);
if ((u > 0) && (u < 1)) {
d = objToP1.SUB(P1ToP2.FACTOR(u));
ld = d.getLength();
if (ld <= pObj.radius) {
var _local3 = new cartesian((-d.y) / ld, d.x / ld);
pObj.rotate(_local3);
pObj.drive(_local3);
if (pObj.vel.DOT(d.FACTOR(1 / ld)) > 10) {
ld = ld * -1;
}
pObj.lineForce(d.FACTOR((pObj.radius - ld) / ld));
return(1);
}
}
d = objToP1;
ld = d.getLength();
if (ld <= pObj.radius) {
var _local4 = new cartesian((-d.y) / ld, d.x / ld);
pObj.rotate(_local4);
pObj.drive(_local4);
pObj.lineForce(d.FACTOR((pObj.radius - ld) / ld));
return(1);
}
d = objToP2;
ld = d.getLength();
if (ld <= pObj.radius) {
var _local5 = new cartesian((-d.y) / ld, d.x / ld);
pObj.rotate(_local5);
pObj.drive(_local5);
pObj.lineForce(d.FACTOR((pObj.radius - ld) / ld));
return(1);
}
return(0);
}
function erase(pPos) {
var _local5 = new cartesian(0, 0);
var _local3 = pPos.SUB(p1).DOT(P1ToP2) / Math.pow(l, 2);
if ((_local3 > 0) && (_local3 < 1)) {
_local5 = pPos.SUB(P1ToP2.FACTOR(_local3).ADD(p1));
var _local4 = _local5.getLength();
if (_local4 <= 10) {
active = false;
return(1);
}
}
return(0);
}
function updateMC() {
if (hit == false) {
hit = true;
var _local2 = p1.SUB(_root.cam.pos);
var _local3 = p2.SUB(_root.cam.pos);
if (_root.cam.mode3d == false) {
_root.lines.mymc.lineStyle(1, 0, 100);
_root.lines.mymc.moveTo(_local2.x, _local2.y);
_root.lines.mymc.lineTo(_local3.x, _local3.y);
} else {
var _local4 = new cartesian(_local2.x - 250, _local2.y - 200);
_local4 = _local4.FACTOR(0.05);
var _local5 = new cartesian(_local3.x - 250, _local3.y - 200);
_local5 = _local5.FACTOR(0.05);
var _local6 = 50 * Math.abs(P1ToP2.y / l);
_root.lines.mymc.beginFill(11081166, _local6);
_root.lines.mymc.lineStyle(2, 0, 100);
_root.lines.mymc.moveTo(_local2.x + _local4.x, _local2.y + _local4.y);
_root.lines.mymc.lineTo(_local3.x + _local5.x, _local3.y + _local5.y);
_root.lines.mymc.lineStyle(0, 0, 40);
_root.lines.mymc.lineTo(_local3.x - _local5.x, _local3.y - _local5.y);
_root.lines.mymc.lineStyle(0, 0, 100);
_root.lines.mymc.lineTo(_local2.x - _local4.x, _local2.y - _local4.y);
_root.lines.mymc.lineStyle(0, 0, 40);
_root.lines.mymc.lineTo(_local2.x + _local4.x, _local2.y + _local4.y);
_root.lines.mymc.endFill();
}
}
}
//ASSetPropFlags(_local1, null, 1);
}
Symbol 20491 MovieClip [__Packages.cartesian] Frame 0
class cartesian
{
var x, y;
function cartesian (pX, pY) {
x = pX;
y = pY;
}
function report() {
return((((" [x:" + (Math.round(x * 10) / 10)) + " y:") + (Math.round(y * 10) / 10)) + "]");
}
function getPolar() {
return(new polar(Math.sqrt(Math.pow(x, 2) + Math.pow(y, 2)), Math.atan2(y, x)));
}
function getUnit() {
return(FACTOR(1 / getLength()));
}
function getLength() {
return(Math.sqrt(Math.pow(x, 2) + Math.pow(y, 2)));
}
function EQU(p) {
x = p.x;
y = p.y;
return(p);
}
function TEND(pTarget, pSpeed) {
x = x + ((pTarget.x - x) / pSpeed);
y = y + ((pTarget.y - y) / pSpeed);
return(pTarget);
}
function FACTOR(p) {
return(new cartesian(x * p, y * p));
}
function OFFSET(pX, pY) {
return(new cartesian(x + pX, y + pY));
}
function ADD(p) {
return(new cartesian(x + p.x, y + p.y));
}
function SUB(p) {
return(new cartesian(x - p.x, y - p.y));
}
function INC(p) {
x = x + p.x;
y = y + p.y;
return(new cartesian(x + p.x, y + p.y));
}
function DOT(p) {
return((x * p.x) + (y * p.y));
}
//ASSetPropFlags(_local1, null, 1);
}
Symbol 20492 MovieClip [__Packages.chasse] Frame 0
#initclip
if (!chasse) {
//(_global.chasse = function (pM1, pM2, pL, pFrame, pParent) {
super(pM1, pM2, pL, pFrame, pParent);
this.mymc._xscale = 49;
this.mymc._yscale = 54;
}) extends spring
var _local1 = (_global.chasse /* register */).prototype;
_local1.updateMC = function () {
var _local2 = this.m1.pos.ADD(this.m2.pos).FACTOR(0.5);
this.mymc._x = _local2.x - _root.cam.pos.x;
this.mymc._y = _local2.y - _root.cam.pos.y;
this.mymc._rotation = this.s.getPolar().aDegs();
this.mymc._xscale = this.mymc._xscale + (((((this.parent.dir * this.s.getLength()) / this.length) * 47) - this.mymc._xscale) * 0.15);
};
_local1.advance = function () {
this.s = this.m2.pos.SUB(this.m1.pos);
this.dist = this.s.getLength();
if (Key.isDown(Key.LEFT)) {
var _local2 = this.s.FACTOR(0.3 / this.dist);
_local2 = new cartesian(-_local2.y, _local2.x);
this.m1.pos.INC(_local2);
this.m2.pos.INC(_local2.FACTOR(-1));
}
if (Key.isDown(Key.RIGHT)) {
var _local3 = this.s.FACTOR(0.3 / this.dist);
_local3 = new cartesian(-_local3.y, _local3.x);
this.m2.pos.INC(_local3);
this.m1.pos.INC(_local3.FACTOR(-1));
}
this.tens = this.s.FACTOR(((this.dist - this.length) * this.springConstant) / this.dist);
this.damp = this.m2.vel.SUB(this.m1.vel).DOT(this.s.getUnit()) * this.dampConstant;
this.tens.INC(this.s.FACTOR(this.damp / this.dist));
this.m2.springForce(this.tens.FACTOR(-1));
this.m1.springForce(this.tens);
};
ASSetPropFlags(_local1, null, 1);
}
#endinitclip
Symbol 20493 MovieClip [__Packages.polar] Frame 0
class polar
{
var r, a;
function polar (npr, npa) {
r = npr;
a = soupMath.mod2Pi(npa);
}
function report() {
return((((" [r:" + Math.round(r)) + " a:") + (Math.round(a * 100) / 100)) + "]");
}
function getCartesian() {
return(new cartesian(r * Math.cos(a), r * Math.sin(a)));
}
function aDegs() {
return((a / (2 * Math.PI)) * 360);
}
function FACTOR(p) {
return(new polar(r * p, a));
}
function INC(p) {
a = a + p;
a = soupMath.mod2Pi(a);
}
function INCDEGS(p) {
a = a + (((p / 360) * 2) * Math.PI);
a = soupMath.mod2Pi(a);
}
function OFFSETDEGS(p) {
return(new polar(r, a + (((p / 360) * 2) * Math.PI)));
}
function EQU(p) {
r = p.r;
a = p.a;
return(p);
}
function TEND(pTarget, pSpeed) {
var _local4 = pTarget.a - a;
var _local5 = Math.floor(Math.abs(_local4) / Math.PI);
if (_local4 != 0) {
_local4 = ((_local4 / Math.abs(_local4)) * (1 - (2 * _local5))) * (((Math.PI * 2) * _local5) + (Math.abs(_local4) * (1 - (2 * _local5))));
INC(_local4 / pSpeed);
}
}
//ASSetPropFlags(_local1, null, 1);
}
Symbol 20494 MovieClip [__Packages.parser] Frame 0
class parser
{
function parser () {
}
static function exportTargetSector(pSector) {
var _local3 = "";
var _local4 = 0;
for ( ; _local4 < pSector.myArray.length ; _local4++) {
_local3 = _local3 + (Math.round(pSector.myArray[_local4].pos.x).toString(32) + ",");
_local3 = _local3 + (Math.round(pSector.myArray[_local4].pos.y).toString(32) + " ");
}
return(_local3);
}
static function exportLineSector(pSector) {
var _local3 = "";
var _local4 = 0;
for ( ; _local4 < pSector.myArray.length ; _local4++) {
if (pSector.myArray[_local4].hit == false) {
pSector.myArray[_local4].hit = true;
_local3 = _local3 + (Math.round(pSector.myArray[_local4].p1.x).toString(32) + ",");
_local3 = _local3 + (Math.round(pSector.myArray[_local4].p1.y).toString(32) + ",");
_local3 = _local3 + (Math.round(pSector.myArray[_local4].p2.x).toString(32) + ",");
_local3 = _local3 + (Math.round(pSector.myArray[_local4].p2.y).toString(32) + " ");
}
}
return(_local3);
}
static function export(pLines, pTargets) {
var _local4 = "";
if (pLines != undefined) {
var _local5 = pLines.min.x;
for ( ; _local5 <= pLines.max.x ; _local5++) {
var _local6 = pLines.min.y;
for ( ; _local6 <= pLines.max.y ; _local6++) {
pLines.myArray[_local5][_local6].unHit();
}
}
var _local7 = pLines.min.x;
for ( ; _local7 <= pLines.max.x ; _local7++) {
var _local8 = pLines.min.y;
for ( ; _local8 <= pLines.max.y ; _local8++) {
if (pLines.myArray[_local7][_local8] != undefined) {
_local4 = _local4 + exportLineSector(pLines.myArray[_local7][_local8]);
}
}
}
_local4 = _local4 + "#";
var _local9 = pTargets.min.x;
for ( ; _local9 <= pTargets.max.x ; _local9++) {
var _local10 = pTargets.min.y;
for ( ; _local10 <= pTargets.max.y ; _local10++) {
if (pTargets.myArray[_local9][_local10] != undefined) {
_local4 = _local4 + exportTargetSector(pTargets.myArray[_local9][_local10]);
}
}
}
}
return(_local4);
}
static function parseLines(file) {
var _local3 = file.split(" ");
var _local4 = 0;
for ( ; _local4 < _local3.length ; _local4++) {
var _local5 = _local3[_local4].split(",", 4);
var _local6 = _global.parseInt(_local5[0], 32);
var _local7 = _global.parseInt(_local5[1], 32);
var _local8 = _global.parseInt(_local5[2], 32);
var _local9 = _global.parseInt(_local5[3], 32);
for ( ; (Math.abs(_local6) < 5000) && ((Math.abs(_local8) < 5000) && ((Math.abs(_local7) < 5000) && (Math.abs(_local9) < 5000))) ; _local4++) {
var _local10 = new line(new cartesian(_local6, _local7), new cartesian(_local8, _local9));
}
return(0);
}
return(1);
}
static function parseTargets(file) {
var _local3 = file.split(" ", 20);
var _local4 = 0;
for ( ; _local4 < _local3.length ; _local4++) {
var _local5 = _local3[_local4].split(",", 2);
var _local6 = _global.parseInt(_local5[0], 32);
var _local7 = _global.parseInt(_local5[1], 32);
for ( ; (Math.abs(_local6) < 5000) && (Math.abs(_local7) < 5000) ; _local4++) {
var _local8 = new target(new cartesian(_local6, _local7));
}
return(0);
}
return(1);
}
static function parseMap(file) {
_root.newMap();
parseLines(file.split("#")[0]);
parseTargets(file.split("#")[1]);
}
//ASSetPropFlags(_local1, null, 1);
}
Symbol 20495 MovieClip [__Packages.wheel] Frame 0
#initclip
if (!wheel) {
//(_global.wheel = function (pPos, pFrame, pParent) {
super(pPos, pFrame, pParent);
this.motor = 0;
this.accel = 0;
}) extends mass
var _local1 = (_global.wheel /* register */).prototype;
_local1.drive = function (pDir) {
this.contact = true;
if (Key.isDown(Key.UP)) {
_root.cam.focus = 1;
this.accel = this.accel + ((2.5 - this.accel) * 0.1);
this.pos.INC(pDir.FACTOR(this.accel * this.motor));
} else {
this.accel = 0;
}
if (Key.isDown(Key.DOWN)) {
this.pos.INC(pDir.FACTOR((-pDir.DOT(this.vel)) * 0.5));
}
};
_local1.advance = function () {
this.vel.y = this.vel.y + _root.console.gravity;
this.vel.EQU(this.vel.FACTOR(_root.console.viscosity));
this.pos.INC(this.vel);
this.contact = false;
_root.lines.checkMass(this);
_root.targets.checkMass(this);
if (this.contact == false) {
this.accel = 0;
}
this.vel.EQU(this.pos.SUB(this.posOld));
this.posOld.EQU(this.pos);
};
ASSetPropFlags(_local1, null, 1);
}
#endinitclip
Symbol 20496 MovieClip [__Packages.head] Frame 0
#initclip
if (!head) {
//(_global.head = function (pPos, pFrame, pParent) {
super(pPos, pFrame, pParent);
}) extends mass
var _local1 = (_global.head /* register */).prototype;
_local1.advance = function () {
this.vel.y = this.vel.y + _root.console.gravity;
this.vel.EQU(this.vel.FACTOR(_root.console.viscosity));
this.pos.INC(this.vel);
if (this.pos.y > ((_root.lines.max.y + 5) * _root.lines.sectorSize)) {
this.parent.die();
}
_root.lines.checkMass(this);
_root.targets.checkMass(this);
this.vel.EQU(this.pos.SUB(this.posOld));
this.posOld.EQU(this.pos);
};
_local1.lineForce = function (pDir) {
this.pos.INC(pDir);
this.parent.die();
};
ASSetPropFlags(_local1, null, 1);
}
#endinitclip
Symbol 20497 MovieClip [__Packages.graphics] Frame 0
class graphics
{
function graphics () {
}
static function normalFormat(field, bold, align) {
var _local5 = new TextFormat();
_local5.font = "_sans";
_local5.size = 12;
if (bold == true) {
_local5.size = 14;
}
_local5.bold = bold;
_local5.align = align;
field.setNewTextFormat(_local5);
field.multiline = true;
field.wordWrap = true;
}
static function inputFormat(field) {
var _local3 = new TextFormat();
_local3.font = "_sans";
_local3.size = 9;
field.setNewTextFormat(_local3);
field.multiline = true;
field.wordWrap = true;
}
static function consoleFormat(field) {
var _local3 = new TextFormat();
_local3.font = "_sans";
_local3.size = 12;
field.setNewTextFormat(_local3);
field.multiline = false;
}
static function rect(x1, y1, x2, y2, mc) {
mc.lineStyle(0, 0, 100);
mc.moveTo(x1, y1);
mc.lineTo(x2, y1);
mc.lineTo(x2, y2);
mc.lineTo(x1, y2);
mc.lineTo(x1, y1);
}
static function rectFill(x1, y1, x2, y2, mc) {
mc.lineStyle(0, 0, 100);
mc.beginFill(16580591, 100);
mc.moveTo(x1, y1);
mc.lineTo(x2, y1);
mc.lineTo(x2, y2);
mc.lineTo(x1, y2);
mc.lineTo(x1, y1);
mc.endFill();
}
static function rectFillLight(x1, y1, x2, y2, mc) {
mc.lineStyle(0, 0, 20);
mc.beginFill(16580591, 100);
mc.moveTo(x1, y1);
mc.lineTo(x2, y1);
mc.lineTo(x2, y2);
mc.lineTo(x1, y2);
mc.lineTo(x1, y1);
mc.endFill();
}
static function label(pText, x, y, width, height, mc) {
var _local8 = mc.getNextHighestDepth();
mc.createTextField("label_" + _local8, _local8, x, y, width, height);
var _local9 = mc["label_" + _local8];
_local9.selectable = false;
normalFormat(_local9, false, "left");
_local9.text = pText;
}
static function boldLabel(pText, x, y, width, height, mc) {
var _local8 = mc.getNextHighestDepth();
mc.createTextField("label_" + _local8, _local8, x, y, width, height);
var _local9 = mc["label_" + _local8];
_local9.selectable = false;
normalFormat(_local9, true, "center");
_local9.text = pText;
}
static function title(pText, x, y, width, height, mc) {
var _local8 = mc.getNextHighestDepth();
mc.createTextField("label_" + _local8, _local8, x, y, width, height);
var _local9 = mc["label_" + _local8];
normalFormat(_local9, true, "left");
_local9.text = pText;
_local9.selectable = false;
mc.lineStyle(1, 13421772, 200);
mc.moveTo(x, y + 17);
mc.lineTo(x + 100, y + 17);
}
static function inputBox(name, x, y, width, height, mc) {
var _local8 = mc.getNextHighestDepth();
mc.createTextField(name, _local8, x, y, width, height);
var _local9 = mc[name];
_local9.type = "input";
_local9.border = true;
_local9.background = true;
inputFormat(_local9, false);
}
static function consoleBox(name, x, y, width, height, mc) {
var _local8 = mc.getNextHighestDepth();
mc.createTextField(name, _local8, x, y, width, height);
var _local9 = mc[name];
_local9.type = "input";
_local9.border = true;
_local9.background = true;
consoleFormat(_local9, false);
}
static function smallButton(name, text, x, y, mc) {
var _local7 = mc.getNextHighestDepth();
var _local8 = mc.createEmptyMovieClip(name, _local7);
rectFill(0, 0, 50, 25, _local8);
boldLabel(text, 0, 3, 50, 20, _local8);
_local8._x = x;
_local8._y = y;
}
static function cross(x, y, mc) {
mc.lineStyle(1, 16711680, 100);
mc.moveTo(x - 2, y - 2);
mc.lineTo(x + 2, y + 2);
mc.moveTo(x + 2, y - 2);
mc.lineTo(x - 2, y + 2);
}
//ASSetPropFlags(_local1, null, 1);
}
Symbol 20498 MovieClip [__Packages.console] Frame 0
class console
{
var gravity, viscosity, dampConstant, springConstant;
function console () {
_root.createTextField("consoletext", 0, 0, 50, 500, 350);
var _local2 = new TextFormat();
_local2.font = "_sans";
_local2.size = 9;
_local2.align = "right";
_local2.color = 12303291 /* 0xBBBBBB */;
_root.consoletext.setNewTextFormat(_local2);
_root.consoletext.selectable = false;
_root.consoletext._visible = false;
gravity = 0.6;
viscosity = 0.98;
dampConstant = 0.4;
springConstant = 0.6;
}
function write(pText, pFunction, pFile, pLine) {
_root.consoletext.text = _root.consoletext.text + (pText + newline);
if (_root.consoletext.text.split("\r").length > 20) {
_root.consoletext.text = _root.consoletext.text.substr(_root.consoletext.text.split("\r")[0].length + 1);
}
}
function show() {
_root.consoletext._visible = true;
}
function command(pText) {
write(pText);
if (pText.slice(0, 4) == "grav") {
var _local3 = _global.parseFloat(pText.slice(5));
if ((_global.isNaN(_local3) == false) && ((_local3 >= -10) && (_local3 <= 10))) {
gravity = _global.parseFloat(_local3) / 10;
write("gravity = " + _local3);
} else {
write("error: -10<grav<10");
}
}
if (pText.slice(0, 4) == "visc") {
var _local4 = _global.parseFloat(pText.slice(5));
if ((_global.isNaN(_local4) == false) && ((_local4 >= 0) && (_local4 <= 10))) {
viscosity = 1 - (_local4 / 100);
write("viscosity = " + _local4);
} else {
write("error: 0<visc<10");
}
}
if (pText.slice(0, 4) == "damp") {
var _local5 = _global.parseFloat(pText.slice(5));
if ((_global.isNaN(_local5) == false) && ((_local5 >= 0) && (_local5 <= 10))) {
dampConstant = 0.2 + (_local5 * 0.03);
write("damp = " + _local5);
} else {
write("error: 0<damp<10");
}
}
if (pText.slice(0, 6) == "spring") {
var _local6 = _global.parseFloat(pText.slice(7));
if ((_global.isNaN(_local6) == false) && ((_local6 >= 0) && (_local6 <= 10))) {
springConstant = _local6 / 10;
write("spring = " + _local6);
} else {
write("error: 0<spring<10");
}
}
}
//ASSetPropFlags(_local1, null, 1);
}
Symbol 20499 MovieClip [__Packages.cameraHandler] Frame 0
class cameraHandler
{
var pos, focus, mode3d;
function cameraHandler () {
pos = new cartesian(-250, -200);
focus = -1;
mode3d = false;
console.write("new camera", "cameraHandler::cameraHandler", "cameraHandler.as", 33);
}
function swapFocus() {
focus = focus * -1;
}
function focusBike() {
var _local2 = new cartesian(0, 0);
_local2 = _root.bike.headWheel.pos.ADD(new cartesian(-250, -250));
_local2 = _local2.ADD(_root.bike.headWheel.vel.FACTOR(12));
pos.INC(pos.SUB(_local2).FACTOR(-0.1));
}
function advance() {
if (focus == 1) {
focusBike();
}
}
//ASSetPropFlags(_local1, null, 1);
}
Symbol 20500 MovieClip [__Packages.drawingTools] Frame 0
class drawingTools
{
var mymc, p1, p2, oldMousePos, mousePress, drawing, tool, allowDraw;
function drawingTools () {
mymc = _root.createEmptyMovieClip("drawing", _root.getNextHighestDepth());
p1 = new cartesian(50, 50);
p2 = new cartesian(50, 50);
oldMousePos = new cartesian(0, 0);
mousePress = false;
drawing = false;
tool = 1;
allowDraw = true;
}
function mouseDown() {
mousePress = true;
if ((tool == 1) && ((Key.isDown(Key.CONTROL) == false) && (allowDraw))) {
startPen();
}
if ((tool == 4) && ((Key.isDown(Key.CONTROL) == false) && (allowDraw))) {
addTarget();
}
}
function mouseUp() {
mousePress = false;
if ((tool == 1) && ((Key.isDown(Key.CONTROL) == false) && (drawing && (allowDraw)))) {
stopPen();
}
}
function startPen() {
drawing = true;
_root.cam.focus = -1;
if (Key.isDown(Key.SHIFT) == false) {
p1.x = _root._xmouse + _root.cam.pos.x;
p1.y = _root._ymouse + _root.cam.pos.y;
if (p2.SUB(p1).getLength() < 10) {
p1.EQU(p2);
}
}
}
function addTarget() {
if (_root.targets.count < 20) {
var _local2 = new cartesian();
_local2.x = _root._xmouse + _root.cam.pos.x;
_local2.y = _root._ymouse + _root.cam.pos.y;
var _local3 = new target(_local2);
}
}
function stopPen() {
p2.x = _root._xmouse + _root.cam.pos.x;
p2.y = _root._ymouse + _root.cam.pos.y;
var _local2 = new line(p1, p2);
p1.x = _root._xmouse + _root.cam.pos.x;
p1.y = _root._ymouse + _root.cam.pos.y;
drawing = false;
}
function doErase() {
var _local2 = new cartesian(_root._xmouse + _root.cam.pos.x, _root._ymouse + _root.cam.pos.y);
_root.lines.erase(_local2);
_root.targets.erase(_local2);
}
function doHand() {
_root.cam.focus = -1;
_root.cam.pos.x = _root.cam.pos.x + (oldMousePos.x - _root._xmouse);
_root.cam.pos.y = _root.cam.pos.y + (oldMousePos.y - _root._ymouse);
}
function advance() {
mymc.clear();
if (mousePress) {
if ((tool == "2") && (Key.isDown(Key.CONTROL) == false)) {
doErase();
}
if ((tool == "3") || (Key.isDown(Key.CONTROL))) {
doHand();
}
}
oldMousePos = new cartesian(_root._xmouse, _root._ymouse);
if ((tool == 1) && (drawing || (Key.isDown(Key.SHIFT)))) {
mymc.lineStyle(1, 4095, 100);
mymc.moveTo(p1.x - _root.cam.pos.x, p1.y - _root.cam.pos.y);
mymc.lineTo(_root._xmouse, _root._ymouse);
}
graphics.cross(p2.x - _root.cam.pos.x, p2.y - _root.cam.pos.y, mymc);
}
//ASSetPropFlags(_local1, null, 1);
}
Symbol 20501 MovieClip [__Packages.targetHandler] Frame 0
class targetHandler
{
var myArray, mymc, sectorSize, count, hit, min, max;
function targetHandler () {
console.write("new targetHandler", "targetHandler::targetHandler", "targetHandler.as", 85);
myArray = new Array();
mymc = _root.createEmptyMovieClip("targetLayer", _root.getNextHighestDepth());
sectorSize = 50;
count = 0;
hit = 0;
min = new cartesian(0, 0);
max = new cartesian(0, 0);
}
function updateMC() {
var _local2 = 0;
for ( ; _local2 < mymc.getNextHighestDepth() ; _local2++) {
mymc.getInstanceAtDepth(_local2)._visible = false;
}
var _local3 = Math.floor(_root.cam.pos.x / sectorSize);
var _local4 = Math.floor(_root.cam.pos.y / sectorSize);
var _local5 = _local3;
for ( ; _local5 < (_local3 + 12) ; _local5++) {
var _local6 = _local4;
for ( ; _local6 < (_local4 + 10) ; _local6++) {
myArray[_local5][_local6].updateMC();
}
}
}
function addRef(pX, pY, pObj) {
var _local5 = Math.floor(pX / sectorSize);
var _local6 = Math.floor(pY / sectorSize);
min.x = Math.min(_local5, min.x);
min.y = Math.min(_local6, min.y);
max.x = Math.max(_local5, max.x);
max.y = Math.max(_local6, max.y);
if (myArray[_local5] == undefined) {
myArray[_local5] = new Array();
}
if (myArray[_local5][_local6] == undefined) {
myArray[_local5][_local6] = new sector(_local5, _local6);
}
myArray[_local5][_local6].plus(pObj);
}
function checkMass(pObj) {
var _local3 = Math.floor((pObj.pos.x / sectorSize) - 0.5);
var _local4 = Math.floor((pObj.pos.y / sectorSize) - 0.5);
myArray[_local3][_local4].checkMass(pObj);
myArray[_local3 + 1][_local4].checkMass(pObj);
myArray[_local3 + 1][_local4 + 1].checkMass(pObj);
myArray[_local3][_local4 + 1].checkMass(pObj);
}
function erase(pPos) {
var _local3 = Math.floor((pPos.x / sectorSize) - 0.5);
var _local4 = Math.floor((pPos.y / sectorSize) - 0.5);
myArray[_local3][_local4].erase(pPos);
myArray[_local3 + 1][_local4].erase(pPos);
myArray[_local3 + 1][_local4 + 1].erase(pPos);
myArray[_local3][_local4 + 1].erase(pPos);
}
function restart() {
hit = 0;
var _local2 = min.x;
for ( ; _local2 <= max.x ; _local2++) {
var _local3 = min.y;
for ( ; _local3 <= max.y ; _local3++) {
myArray[_local2][_local3].unHit();
}
}
}
//ASSetPropFlags(_local1, null, 1);
}
Symbol 20502 MovieClip [__Packages.target] Frame 0
class target
{
var pos, hit, mymc;
function target (pPos) {
pos = new cartesian(0, 0);
pos.EQU(pPos);
hit = false;
_root.targets.addRef(pos.x, pos.y, this);
var _local3 = _root.targets.mymc.getNextHighestDepth();
mymc = _root.targets.mymc.attachMovie("target", "target_" + _local3, _local3);
mymc._xscale = 50;
mymc._yscale = 50;
updateMC();
console.write("new target", "target::target", "target.as", 78);
_root.targets.count++;
}
function kill() {
mymc.removeMovieClip();
_root.targets.count = _root.targets.count + -1;
if (hit) {
_root.targets.hit = _root.targets.hit + -1;
}
}
function updateMC() {
mymc._visible = true;
mymc._rotation = mymc._rotation + 2;
mymc._x = pos.x - _root.cam.pos.x;
mymc._y = pos.y - _root.cam.pos.y;
if (hit) {
mymc.gotoAndStop(2);
} else {
mymc.gotoAndStop(1);
}
}
function checkMass(pObj) {
if ((hit == false) && (pObj.pos.SUB(pos).getLength() < 25)) {
hit = true;
_root.targets.hit++;
if (_root.targets.hit == _root.targets.count) {
_root.gui.showWinDialog();
}
}
}
function erase(pPos) {
if (pPos.SUB(pos).getLength() < 10) {
kill();
return(1);
}
return(0);
}
//ASSetPropFlags(_local1, null, 1);
}