[Tools][Expand/Collapse All]Note that automatic extraction of ActionScript 3 is still pretty much unsupported by swfchan. AS1/AS2 works okay most of the time.Frame 1 (78 B)
fscommand ("allowscale", "false");
fscommand ("showmenu", "false");
stop();
Frame 2 (9.6 KiB) ● ●
function rotateRadar(radar) {
if (radar.direction == null) {
radar.direction = -1;
radar.speed = random(5) + 1;
radar.startRot = radar._rotation;
}
if ((radar.direction == 1) && (90 < radar.rot)) {
radar.direction = -1;
radar.rot = 90;
} else if ((radar.direction == -1) && (radar.rot < -90)) {
radar.direction = 1;
radar.rot = -90;
}
radar.rot = radar.rot + (radar.direction * radar.speed);
radar._rotation = radar.rot + radar.startRot;
}
function doLoad() {
init();
}
function init() {
playGame = true;
submitscore.gotoAndStop(1);
trafficDensity = 20;
keyCodes = new array();
cars = new array();
zonesX = new array(325, 455, 470, 10, 545, 155, 250, 380, 177, 190, 245, 450, 16, 42, 160, 375, 336);
zonesY = new array(285, 310, 115, 10, 120, 310, 365, 390, 90, 150, 45, 190, 338, 152, 230, 227, 108);
screenX = 550;
screenY = 400;
screenX2 = Math.ceil(screenX / 2);
screenY2 = Math.ceil(screenY / 2);
_root.attachMovie("arena", "arena", 100);
arena._x = screenX2;
arena._y = screenY2;
_root.attachMovie("surround", "surround", 1000);
surround._x = screenX2;
surround._y = screenY2;
arena.attachMovie("zone", "zone", 10000);
cars.push(new car("player1", 38, 40, 37, 39, 2, 1000, 280, 280, 1));
totalPlayers = cars.length;
newZone();
}
function doEnterFrame() {
if (playGame == true) {
if (0 < zoneTimer) {
zoneTimer = zoneTimer * 0.995;
}
zoneTimer = Math.ceil(zoneTimer);
moveCars();
if (random(trafficDensity) < 1) {
newTraffic();
}
} else if (submitscore._currentFrame == 1) {
submitscore.gotoAndStop(2);
arena.removeMovieClip();
}
}
function doKeyDown() {
K = Key.getCode();
keyCodes[K] = 1;
}
function doKeyUp() {
K = Key.getCode();
keyCodes[K] = 0;
}
function trig(angle) {
calc = Math.floor(angle / 360);
angle = angle - (calc * 360);
if ((angle >= 0) && (90 >= angle)) {
tx = Math.cos((Math.PI/180) * (90 - angle));
ty = Math.sin((Math.PI/180) * (90 - angle));
} else if ((90 < angle) and (180 >= angle)) {
tx = Math.cos((Math.PI/180) * (angle - 90));
ty = -Math.sin((Math.PI/180) * (angle - 90));
} else if ((180 < angle) and (270 >= angle)) {
tx = -Math.sin((Math.PI/180) * (angle - 180));
ty = -Math.cos((Math.PI/180) * (angle - 180));
} else if ((270 < angle) and (360 >= angle)) {
tx = -Math.cos((Math.PI/180) * (angle - 270));
ty = Math.sin((Math.PI/180) * (angle - 270));
}
}
function attachMC(linkName, newName, depth, x, y, rotation, goto) {
_root.arena.attachMovie(linkName, newName, depth);
_root.arena[newName]._x = x - _root.screenX2;
_root.arena[newName]._y = y - _root.screenY2;
_root.arena[newName]._rotation = rotation;
if (0 < goto) {
_root.arena[newName].gotoAndStop(goto);
}
}
function car(name, upKey, downKey, leftKey, rightKey, color, depth, x, y, number) {
this.number = number;
this.name = name;
this.upKey = upKey;
this.downKey = downKey;
this.leftKey = leftKey;
this.rightKey = rightKey;
this.color = color;
this.depth = depth;
this.x = x;
this.y = y;
this.angle = 30;
this.pangle = this.angle;
this.dx = 0;
this.dy = 0;
this.accelerator = 2;
this.friction = 0.7;
this.steering = 10;
this.brakes = this.accelerator * 0.3;
this.speed = 0;
this.tyres = 0;
this.attention = 0;
this.timer = 0;
this.topSpeed = (this.accelerator / (1 - this.friction)) - this.accelerator;
this.score = 0;
this.scoreOut = 0;
this.standstill = 0;
attachMC("car", name, this.depth, this.x, this.y, 0, this.color);
attachMC("hud", "hud" + this.number, this.depth + 1000, (screenX + 45) - (this.number * 125), screenY - 15, 0, 0);
arena["hud" + this.number].nametag = this.name;
arena["hud" + this.number].score = this.scoreOut;
}
function moveCars() {
i = 0;
while (i < totalPlayers) {
thisCar = cars[i];
if (thisCar.scoreOut < thisCar.score) {
thisCar.scoreOut = thisCar.scoreOut + 10;
}
tx = 0;
ty = 0;
thisCar.speed = Math.sqrt((thisCar.dx * thisCar.dx) + (thisCar.dy * thisCar.dy));
if (keyCodes[thisCar.leftKey] == 1) {
thisCar.angle = thisCar.angle - (thisCar.steering * ((keyCodes[thisCar.downKey] * -2) + 1));
}
if (keyCodes[thisCar.rightKey] == 1) {
thisCar.angle = thisCar.angle + (thisCar.steering * ((keyCodes[thisCar.downKey] * -2) + 1));
}
if (keyCodes[thisCar.downKey] == 1) {
trig(thisCar.angle + 180);
thisCar.dx = thisCar.dx + (tx * thisCar.brakes);
thisCar.dy = thisCar.dy + (ty * thisCar.brakes);
}
if (keyCodes[thisCar.upKey] == 1) {
trig(thisCar.angle);
thisCar.dx = thisCar.dx + (tx * thisCar.accelerator);
thisCar.dy = thisCar.dy + (ty * thisCar.accelerator);
}
thisCar.dx = thisCar.dx * thisCar.friction;
thisCar.dy = thisCar.dy * thisCar.friction;
thisCar.x = thisCar.x + thisCar.dx;
thisCar.y = thisCar.y - thisCar.dy;
if (screenX < thisCar.x) {
thisCar.x = thisCar.x - screenX;
}
if (thisCar.x < 0) {
thisCar.x = thisCar.x + screenX;
}
if (screenY < thisCar.y) {
thisCar.y = thisCar.y - screenY;
}
if (thisCar.y < 0) {
thisCar.y = thisCar.y + screenY;
}
if (((thisCar.angle != thisCar.pangle) && ((thisCar.topSpeed * 0.5) < thisCar.speed)) || ((keyCodes[thisCar.upKey] == 1) && (thisCar.speed < (thisCar.topSpeed * 0.666666666666667)))) {
thisCar.angle = thisCar.angle + (random(thisCar.tyres) - (thisCar.tyres / 2));
if (Math.sqrt(((thisCar.x - thisCar.px) * (thisCar.x - thisCar.px)) + ((thisCar.y - thisCar.py) * (thisCar.y - thisCar.py))) < thisCar.topSpeed) {
k = 1;
while (100 >= k) {
skids++;
if (400 < skids) {
skids = 1;
}
tRatio = k / 100;
pRatio = 1 - tRatio;
skidX = (thisCar.x * pRatio) + (thisCar.px * tRatio);
skidY = (thisCar.y * pRatio) + (thisCar.py * tRatio);
skidAngle = (thisCar.angle * pRatio) + (thisCar.pangle * tRatio);
attachMC("skid", "skid" + skids, skids, skidX, skidY, skidAngle, 0);
k = k + 20;
}
}
if ((thisCar.topSpeed * 0.666666666666667) < thisCar.speed) {
skidon = true;
}
}
collision = false;
k = 0;
while (k < totalPlayers) {
if (i != k) {
tempDX = thisCar.x - cars[k].x;
tempDY = thisCar.y - cars[k].y;
tempDIST = Math.sqrt((tempDX * tempDX) + (tempDY * tempDY));
if (tempDIST < 8) {
collision = true;
tempDX = thisCar.dx;
tempDY = thisCar.dy;
thisCar.dx = 2 * cars[k].dx;
thisCar.dy = 2 * cars[k].dx;
cars[k].dx = 2 * tempDX;
cars[k].dy = 2 * tempDY;
}
}
k++;
}
if (_root.arena.hard.hitTest(thisCar.x, thisCar.y, true)) {
collision = true;
}
if (_root.arena.traffic.hitTest(thisCar.x, thisCar.y, true)) {
collision = true;
thisCar.attention = thisCar.attention + 2;
}
if (collision == true) {
thisCar.dx = -thisCar.dx;
thisCar.dy = -thisCar.dy;
thisCar.x = thisCar.px;
thisCar.y = thisCar.py;
soundFX.gotoAndStop(random(4) + 2);
}
if (_root.arena.radars.hitTest(thisCar.x, thisCar.y, true)) {
if ((!arena.flash) || (arena.flash._currentFrame == 20)) {
attachMC("flash", "flash", 999999, screenX2, screenY2, 0, 0);
thisCar.attention = thisCar.attention + 20;
}
}
tempDX = zonesX[currentZone] - thisCar.x;
tempDY = zonesY[currentZone] - thisCar.y;
zoneDist = Math.sqrt((tempDX * tempDX) + (tempDY * tempDY));
if ((zoneDist < 25) && (thisCar.speed < 0.5)) {
thisCar.score = thisCar.score + (zoneTimer - 99);
attachMC("deliveryzoom", "deliveryzoom", 7500, thisCar.x, thisCar.y, 0, 0);
thisCar.attention = thisCar.attention - 5;
newZone();
}
if (thisCar.attention < 0) {
thisCar.attention = 0;
}
if (100 < thisCar.attention) {
thisCar.attention = 100;
_root.score = thisCar.score;
playGame = false;
}
placeMC(thisCar.name, thisCar.x, thisCar.y, thisCar.angle, 100);
arena["hud" + thisCar.number].attention._xscale = thisCar.attention;
arena["hud" + thisCar.number].timer._xscale = thisCar.timer;
arena["hud" + thisCar.number].score = thisCar.scoreOut;
if (((thisCar.x == thisCar.px) && (thisCar.y == thisCar.py)) && (thisCar.angle == thisCar.pangle)) {
thisCar.standstill = thisCar.standstill + 10;
} else {
thisCar.standstill = thisCar.standstill - 20;
}
if (100 < thisCar.standstill) {
thisCar.standstill = 100;
}
if (thisCar.standstill < 0) {
thisCar.standstill = 0;
}
arena[thisCar.name].locator._alpha = thisCar.standstill;
arena[thisCar.name].locator._rotation = -thisCar.angle;
thisCar.pangle = thisCar.angle;
thisCar.px = thisCar.x;
thisCar.py = thisCar.y;
i++;
}
skid.setVolume(0);
if (skidon == true) {
skid.setVolume(75);
}
skidon = false;
}
function placeMC(name, x, y, rotation, alpha) {
_root.xtemp = x - _root.screenX2;
_root.ytemp = y - _root.screenY2;
_root.rotationtemp = rotation;
_root.alphatemp = alpha;
tellTarget (_root.arena[name]) {
_x = _root.xtemp;
_y = _root.ytemp;
_rotation = _root.rotationtemp;
_alpha = _root.alphatemp;
};
}
function newZone() {
if (5 < trafficDensity) {
trafficDensity--;
}
currentZone = random(zonesX.length);
arena.zone._x = zonesX[currentZone] - screenX2;
arena.zone._y = zonesY[currentZone] - screenY2;
zoneTimer = 1000;
arena.zone.gotoAndPlay(1);
}
function newTraffic() {
totalTraffic = 6;
congestion++;
if (100 < congestion) {
congestion = 1;
}
arena.traffic.attachMovie("traffic" + (random(totalTraffic) + 1), "traffic" + congestion, congestion);
}
stop();
Instance of Symbol 114 MovieClip in Frame 2 (179 B)
onClipEvent (load) {
_root.doLoad();
}
onClipEvent (enterFrame) {
_root.doEnterFrame();
}
onClipEvent (keyDown) {
_root.doKeyDown();
}
onClipEvent (keyUp) {
_root.doKeyUp();
}
Symbol 10 MovieClip [target] Frame 30 (1 B)
Symbol 10 MovieClip [target] Frame 31 (8 B)
stop();
Symbol 16 MovieClip [zone] Frame 51 (18 B)
gotoAndPlay (30);
Symbol 17 MovieClip [target] Frame 30 (1 B)
Symbol 17 MovieClip [target] Frame 31 (8 B)
stop();
Instance of Symbol 33 MovieClip in Symbol 34 MovieClip Frame 1 (54 B)
onClipEvent (enterFrame) {
_root.rotateRadar(this);
}
Instance of Symbol 33 MovieClip in Symbol 34 MovieClip Frame 1 (54 B)
onClipEvent (enterFrame) {
_root.rotateRadar(this);
}
Instance of Symbol 33 MovieClip in Symbol 34 MovieClip Frame 1 (54 B)
onClipEvent (enterFrame) {
_root.rotateRadar(this);
}
Instance of Symbol 33 MovieClip in Symbol 34 MovieClip Frame 1 (54 B)
onClipEvent (enterFrame) {
_root.rotateRadar(this);
}
Instance of Symbol 33 MovieClip in Symbol 34 MovieClip Frame 1 (54 B)
onClipEvent (enterFrame) {
_root.rotateRadar(this);
}
Instance of Symbol 33 MovieClip in Symbol 34 MovieClip Frame 1 (54 B)
onClipEvent (enterFrame) {
_root.rotateRadar(this);
}
Instance of Symbol 33 MovieClip in Symbol 34 MovieClip Frame 1 (54 B)
onClipEvent (enterFrame) {
_root.rotateRadar(this);
}
Instance of Symbol 33 MovieClip in Symbol 34 MovieClip Frame 1 (54 B)
onClipEvent (enterFrame) {
_root.rotateRadar(this);
}
Symbol 38 MovieClip [skid] Frame 41 (24 B)
this.removeMovieClip();
Instance of Symbol 63 MovieClip in Symbol 65 MovieClip [traffic2] Frame 1 (51 B)
onClipEvent (load) {
gotoAndStop(random(6) + 1);
}
Instance of Symbol 64 MovieClip in Symbol 65 MovieClip [traffic2] Frame 239 (51 B)
onClipEvent (load) {
gotoAndStop(random(4) + 1);
}
Symbol 65 MovieClip [traffic2] Frame 240 (24 B)
this.removeMovieClip();
Instance of Symbol 63 MovieClip in Symbol 66 MovieClip [traffic3] Frame 1 (51 B)
onClipEvent (load) {
gotoAndStop(random(6) + 1);
}
Instance of Symbol 64 MovieClip in Symbol 66 MovieClip [traffic3] Frame 321 (51 B)
onClipEvent (load) {
gotoAndStop(random(4) + 1);
}
Symbol 66 MovieClip [traffic3] Frame 322 (24 B)
this.removeMovieClip();
Instance of Symbol 63 MovieClip in Symbol 67 MovieClip [traffic4] Frame 1 (51 B)
onClipEvent (load) {
gotoAndStop(random(6) + 1);
}
Instance of Symbol 64 MovieClip in Symbol 67 MovieClip [traffic4] Frame 294 (51 B)
onClipEvent (load) {
gotoAndStop(random(4) + 1);
}
Symbol 67 MovieClip [traffic4] Frame 295 (24 B)
this.removeMovieClip();
Instance of Symbol 63 MovieClip in Symbol 68 MovieClip [traffic5] Frame 1 (51 B)
onClipEvent (load) {
gotoAndStop(random(6) + 1);
}
Instance of Symbol 64 MovieClip in Symbol 68 MovieClip [traffic5] Frame 239 (51 B)
onClipEvent (load) {
gotoAndStop(random(4) + 1);
}
Symbol 68 MovieClip [traffic5] Frame 240 (24 B)
this.removeMovieClip();
Instance of Symbol 63 MovieClip in Symbol 69 MovieClip [traffic6] Frame 1 (51 B)
onClipEvent (load) {
gotoAndStop(random(6) + 1);
}
Instance of Symbol 64 MovieClip in Symbol 69 MovieClip [traffic6] Frame 239 (51 B)
onClipEvent (load) {
gotoAndStop(random(4) + 1);
}
Symbol 69 MovieClip [traffic6] Frame 240 (24 B)
this.removeMovieClip();
Instance of Symbol 63 MovieClip in Symbol 70 MovieClip [traffic1] Frame 1 (51 B)
onClipEvent (load) {
gotoAndStop(random(6) + 1);
}
Instance of Symbol 64 MovieClip in Symbol 70 MovieClip [traffic1] Frame 239 (51 B)
onClipEvent (load) {
gotoAndStop(random(4) + 1);
}
Symbol 70 MovieClip [traffic1] Frame 240 (24 B)
this.removeMovieClip();
Symbol 73 MovieClip [flash] Frame 20 (8 B)
stop();
Symbol 75 MovieClip [deliveryzoom] Frame 21 (24 B)
this.removeMovieClip();
Symbol 86 Button (31 B)
on (release) {
_root.play();
}
Symbol 102 Button (200 B)
on (press) {
loadVariables ((((("/congestscore.php?act=new&name=" + escape(_root.name)) + "&email=") + escape(_root.email)) + "&score=") + escape(_root.score), this);
gotoAndStop (10);
}
Symbol 105 Button (31 B)
on (release) {
_root.init();
}
Symbol 111 Button (84 B)
on (press) {
getURL ("/congestscore.php?email=" + escape(_root.email), "_blank");
}
Symbol 112 MovieClip Frame 1 (8 B)
stop();
Symbol 112 MovieClip Frame 2 (8 B)
stop();
Symbol 112 MovieClip Frame 10 (8 B)
stop();
Symbol 115 MovieClip Frame 1 (8 B)
stop();
Symbol 115 MovieClip Frame 2 (8 B)
stop();
Symbol 115 MovieClip Frame 3 (8 B)
stop();
Symbol 115 MovieClip Frame 4 (8 B)
stop();
Symbol 115 MovieClip Frame 5 (8 B)
stop();