Frame 1
function starField(mc, sparseness, speed, color) {
var myBitmapData = (new flash.display.BitmapData(STAGE_W, STAGE_H, true, 13421772));
mc.attachBitmap(myBitmapData, this.getNextHighestDepth());
mc.sparseness = sparseness;
mc.speed = speed;
mc.col = color;
y = speed;
while (y < STAGE_H) {
if (random(sparseness) == 0) {
myBitmapData.setPixel32(random(STAGE_W), y, color);
}
y = y + speed;
}
mc.onEnterFrame = function () {
if (random(this.sparseness) == 0) {
this.x = random(STAGE_W);
myBitmapData.setPixel32(this.x, this.speed, this.col);
this.s = 0;
while (this.s < this.speed) {
myBitmapData.setPixel32(this.x, this.s, 16777215);
this.s++;
}
}
myBitmapData.scroll(0, this.speed);
};
}
stop();
_global.ROOT = this;
Mouse.show();
ROOT._quality = "high";
Stage.scaleMode = "noScale";
STAGE_W = 600;
STAGE_H = 600;
var sky2 = ROOT.createEmptyMovieClip("sky2", ROOT.getNextHighestDepth());
starField(sky2, 9, 4, "0xFFAAAAAA");
var sky3 = ROOT.createEmptyMovieClip("sky3", ROOT.getNextHighestDepth());
starField(sky3, 30, 8, "0xFFFFFFFF");
ROOT.attachMovie("title", "tit", ROOT.getNextHighestDepth());
ROOT.tit.msg.gotoAndStop("loading");
ROOT.tit.stop();
loaded = false;
loader = new Object();
loader.interval = function () {
loa = _root.getBytesLoaded();
tot = _root.getBytesTotal();
if (loa >= tot) {
loaded = true;
ROOT.tit.msg.play();
clearInterval(this.id);
}
};
clearInterval(loader.id);
loader.id = setInterval(loader, "interval", 10);
Mouse.removeListener(mouseListener);
var mouseListener = new Object();
mouseListener.onMouseUp = function () {
if ((tit._currentframe == 1) && (loaded)) {
tit.gotoAndStop(2);
}
};
Mouse.addListener(mouseListener);
Key.removeListener(myListener);
var myListener = new Object();
myListener.onKeyDown = function () {
spaceDown = Key.isDown(32);
};
myListener.onKeyUp = function () {
if (spaceDown && (loaded)) {
if (tit._currentframe == tit._totalframes) {
ROOT.gotoAndStop("game");
} else {
obj.sound.stop();
tit.nextFrame();
obj = ROOT.createEmptyMovieClip("s", 213);
obj.sound = new Sound(obj);
obj.sound.attachSound("conversion");
obj.sound.setVolume(10);
obj.sound.start();
}
}
};
Key.addListener(myListener);
Frame 2
function routine() {
if (Key.isDown(81)) {
reset();
}
cycle++;
level = (100 / REVOLUTION) * boids.length;
player.agency = (100 - level) + 10;
if (player.agency > 100) {
player.agency = 100;
}
refract.fillRect(new flash.geom.Rectangle(0, 0, 600, 600), 0);
rotation.fillRect(new flash.geom.Rectangle(0, 0, 600, 600), 0);
var _local3 = 0;
while (_local3 < enemies.length) {
if ((((enemies[_local3]._y > (STAGE_H + 100)) || (enemies[_local3]._y < -100)) || (enemies[_local3]._x > (STAGE_W + 100))) || (enemies[_local3]._x < -100)) {
removeEnemy(enemies[_local3], false);
}
enemies[_local3]._y = enemies[_local3]._y + enemies[_local3].yspeed;
enemies[_local3]._x = enemies[_local3]._x + enemies[_local3].xspeed;
var _local19 = new flash.geom.Matrix();
_local19.translate(enemies[_local3]._x, enemies[_local3]._y);
element.area._xscale = (element.area._yscale = 90 + enemies[_local3].mass);
refract.draw(element, _local19, null, "add");
_local3++;
}
var _local2 = 0;
while (_local2 < prolets.length) {
if (prolets[_local2].inertia > 0) {
prolets[_local2].inertia--;
prolets[_local2].yspeed = prolets[_local2].yspeed + 0.2;
if (prolets[_local2].xspeed > 0) {
prolets[_local2].xspeed = prolets[_local2].xspeed - 0.2;
if (prolets[_local2].xspeed < 0) {
prolets[_local2].xspeed = 0;
}
}
if (prolets[_local2].xspeed < 0) {
prolets[_local2].xspeed = prolets[_local2].xspeed + 0.2;
if (prolets[_local2].xspeed > 0) {
prolets[_local2].xspeed = 0;
}
}
if (prolets[_local2].yspeed > 2) {
prolets[_local2].yspeed = 2;
}
}
prolets[_local2]._y = prolets[_local2]._y + prolets[_local2].yspeed;
prolets[_local2]._x = prolets[_local2]._x + prolets[_local2].xspeed;
if (prolets[_local2]._y > (STAGE_H + 50)) {
removeProlet(prolets[_local2]);
}
_local2++;
}
var _local4 = 0;
while (_local4 < boids.length) {
if (boids[_local4]._visible) {
var _local1 = boids[_local4];
var _local19 = new flash.geom.Matrix();
_local19.translate(_local1.nX, _local1.nY);
refract.draw(refraction, _local19, null, "add");
rotation.draw(rotator, _local19, new flash.geom.ColorTransform(1, Math.round((_local1.xs * 8) + 8), Math.round((_local1.ys * 8) + 8), 1, 0, 0, 0, 0), "add");
}
_local4++;
}
if (player._visible) {
if (Key.isDown(37)) {
player.xSpeed = player.xSpeed - PLAYER_ACC;
}
if (Key.isDown(39)) {
player.xSpeed = player.xSpeed + PLAYER_ACC;
}
if ((!Key.isDown(37)) && (!Key.isDown(39))) {
if (player.xSpeed < 0) {
player.xSpeed = player.xSpeed + PLAYER_INERTIA;
if (player.xSpeed > 0) {
player.xSpeed = 0;
}
}
if (player.xSpeed > 0) {
player.xSpeed = player.xSpeed - PLAYER_INERTIA;
if (player.xSpeed < 0) {
player.xSpeed = 0;
}
}
}
if (Key.isDown(40)) {
player.ySpeed = player.ySpeed + PLAYER_ACC;
}
if (Key.isDown(38)) {
player.ySpeed = player.ySpeed - PLAYER_ACC;
}
if ((!Key.isDown(40)) && (!Key.isDown(38))) {
if (player.ySpeed < 0) {
player.ySpeed = player.ySpeed + PLAYER_INERTIA;
if (player.ySpeed > 0) {
player.ySpeed = 0;
}
}
if (player.ySpeed > 0) {
player.ySpeed = player.ySpeed - PLAYER_INERTIA;
if (player.ySpeed < 0) {
player.ySpeed = 0;
}
}
}
if (Key.isDown(32) && (!spaceIsDown)) {
spaceIsDown = true;
if (playerAggregator.sts == "recharging") {
playSound("hiss", 100);
}
}
if (!Key.isDown(32)) {
spaceIsDown = false;
}
if (((Key.isDown(32) && (playerAggregator.sts == "ready")) && (!end)) && (cycle > 20)) {
player.flame._visible = true;
player.flame.thing.gotoAndStop(1);
playerAggregator.sts = "aggregating";
player.mass = 1;
}
if (playerAggregator.sts == "ready") {
player.body.gotoAndStop((cycle % 3) != 0);
mass1.active = (mass2.active = (mass3.active = false));
}
if (playerAggregator.sts == "aggregating") {
player.agency = 100;
player.body.gotoAndStop(true);
playerAggregator.counter--;
playerAggregator.vol = 20 + (player.mass * 2);
if (playerAggregator.vol > 80) {
playerAggregator.vol = 80;
}
perc = 100 - ((100 / AGGREGATION_TIMER) * playerAggregator.counter);
if (perc < 40) {
perc = 40;
mass2.active = true;
mass3.active = false;
mass2.vol = playerAggregator.vol;
}
if (perc > 70) {
player.flame.thing.gotoAndStop(2);
perc = 70;
mass3.active = true;
mass2.active = false;
mass3.vol = playerAggregator.vol;
}
player.flame._rotation = player.flame._rotation - (perc / 1.6);
if (playerAggregator.counter <= 0) {
player.flame._visible = false;
playerAggregator.sts = "recharging";
playerAggregator.counter = PLAYER_RECHARGE_TIMER;
playSound("end_mass_3", playerAggregator.vol);
_local4 = 0;
while (_local4 < boids.length) {
if (!boids[_local4]._visible) {
var _local1 = boids[_local4];
_local1._x = (_local1.aggregator._x + random(_local1.aggregator._width)) - (_local1.aggregator._width / 2);
_local1._y = (_local1.aggregator._y + random(_local1.aggregator._height)) - (_local1.aggregator._height / 2);
_local1._visible = true;
}
_local4++;
}
player._xscale = 100;
player._yscale = 100;
player.mass = 0;
}
} else if (player.mass != undefined) {
updateProgress("");
}
if (playerAggregator.sts == "recharging") {
mass1.active = (mass2.active = (mass3.active = false));
playerAggregator.counter--;
player.body.gotoAndStop((cycle % 8) != 0);
if (playerAggregator.counter <= 0) {
playerAggregator.sts = "ready";
playerAggregator.counter = AGGREGATION_TIMER;
}
}
} else {
player.xSpeed = (player.ySpeed = (player.xspeed = (player.yspeed = 0)));
}
if (proletAggregator.sts == "aggregating") {
if (proletAggregator.tgt._x == undefined) {
proletAggregator.tgt = enemies[random(enemies.length - 1)];
} else if (proletAggregator.subject.mass > (proletAggregator.tgt.mass / 3)) {
chaser = proletAggregator.subject;
chased = proletAggregator.tgt;
var _local14 = chaser.getDifference(chased);
var _local17 = chaser.getAngle(chased);
chaser.ajust(_local17, (-ATTRACTION_POWER) / 2);
}
proletAggregator.counter--;
perc = 100 - ((100 / AGGREGATION_TIMER) * proletAggregator.counter);
if (perc < 40) {
perc = 40;
}
if (perc > 70) {
proletAggregator.subject.flame.thing.gotoAndStop(2);
perc = 70;
}
proletAggregator.vol = 20 + (proletAggregator.subject.mass * 2);
if (proletAggregator.vol > 80) {
proletAggregator.vol = 80;
}
mass1.vol = proletAggregator.vol;
mass1.active = true;
proletAggregator.subject.flame._rotation = proletAggregator.subject.flame._rotation - (perc / 1.6);
if (proletAggregator.counter <= 0) {
proletAggregator.subject.flame._visible = false;
proletAggregator.subject.gotoAndPlay(1);
proletAggregator.sts = "recharging";
proletAggregator.counter = PROLET_RECHARGE_TIMER;
playSound("end_mass_1", proletAggregator.vol);
_local4 = 0;
while (_local4 < boids.length) {
if (!boids[_local4]._visible) {
var _local1 = boids[_local4];
_local1._x = (_local1.aggregator._x + random(_local1.aggregator._width)) - (_local1.aggregator._width / 2);
_local1._y = (_local1.aggregator._y + random(_local1.aggregator._height)) - (_local1.aggregator._height / 2);
_local1._visible = true;
}
_local4++;
}
proletAggregator.subject._xscale = 100;
proletAggregator.subject._yscale = 100;
proletAggregator.subject.mass = 0;
proletAggregator.subject.maxSpeed = PROLET_MAX_SPEED;
proletAggregator.subject = undefined;
}
_local2 = 0;
while (_local2 < prolets.length) {
dist = Math.sqrt(Math.pow(proletAggregator.subject._x - prolets[_local2]._x, 2) + Math.pow(proletAggregator.subject._y - prolets[_local2]._y, 2));
if ((dist < CONVERSION_DISTANCE) && (prolets[_local2].inertia <= 0)) {
newBoid = battlefield.attachMovie("boid", "b" + battlefield.getNextHighestDepth(), battlefield.getNextHighestDepth(), {_x:prolets[_local2]._x, _y:prolets[_local2]._y, maxSpeed:PROLET_MAX_SPEED});
newBoid.mass = 0;
newBoid.flame._visible = false;
newBoid.body.gotoAndStop(true);
boids.push(newBoid);
newBoid.ind = boids.length - 1;
removeProlet(prolets[_local2]);
playSound("conversion", 30);
}
_local2++;
}
} else {
mass1.active = false;
if (player.mass == undefined) {
updateProgress("");
}
}
if (proletAggregator.sts == "recharging") {
proletAggregator.counter--;
if (proletAggregator.counter <= 0) {
proletAggregator.sts = "ready";
proletAggregator.counter = AGGREGATION_TIMER;
}
}
if (player.xSpeed > PLAYER_MAX_SPEED) {
player.xSpeed = PLAYER_MAX_SPEED;
}
if (player.xSpeed < (-PLAYER_MAX_SPEED)) {
player.xSpeed = -PLAYER_MAX_SPEED;
}
if (player.ySpeed > PLAYER_MAX_SPEED) {
player.ySpeed = PLAYER_MAX_SPEED;
}
if (player.ySpeed < (-PLAYER_MAX_SPEED)) {
player.ySpeed = -PLAYER_MAX_SPEED;
}
if (player._x < MARGIN) {
player.xSpeed = player.xSpeed + ((MARGIN - player._x) / 10);
}
if (player._x > (STAGE_W - MARGIN)) {
player.xSpeed = player.xSpeed + (((STAGE_W - MARGIN) - player._x) / 10);
}
if (player._y < MARGIN) {
player.ySpeed = player.ySpeed + ((MARGIN - player._y) / 10);
}
if (player._y > (STAGE_H - MARGIN)) {
player.ySpeed = player.ySpeed + (((STAGE_H - MARGIN) - player._y) / 10);
}
player._x = player._x + ((player.xSpeed / 100) * player.agency);
player._y = player._y + ((player.ySpeed / 100) * player.agency);
player.maxSpeed = (PLAYER_MAX_SPEED / 100) * (100 - player.agency);
if ((player.mass != undefined) && (player._visible)) {
var _local19 = new flash.geom.Matrix();
_local19.translate(player.nX, player.nY);
refractionBig.area._xscale = (refractionBig.area._yscale = player.agency);
refract.draw(refractionBig, _local19, null, "add");
rotatorBig.area._xscale = (rotatorBig.area._yscale = player.agency);
rotation.draw(rotatorBig, _local19, new flash.geom.ColorTransform(1, Math.round((player.xs * 8) + 8), Math.round((player.ys * 8) + 8), 1, 0, 0, 0, 0), "add");
}
if (playerAggregator.sts == "aggregating") {
e = 0;
while (e < enemies.length) {
if (enemies[e].hitTest(player)) {
hitEnemy(enemies[e], player);
}
e++;
}
}
if (proletAggregator.sts == "aggregating") {
e = 0;
while (e < enemies.length) {
if (enemies[e].hitTest(proletAggregator.subject)) {
hitEnemy(enemies[e], proletAggregator.subject);
}
e++;
}
}
var _local20 = Math.PI / steps;
_local4 = 0;
while (_local4 < boids.length) {
if (boids[_local4]._visible && (boids[_local4] != proletAggregator.subject)) {
var _local1 = boids[_local4];
if ((((random(100) == 0) && ((random(100) + PROLET_SUBJECTIVITY_OFFSET) < level)) && (_local1 != player)) && (proletAggregator.sts == "ready")) {
subjectivity(_local1);
}
var _local6 = getOffsets(_local1.nX, _local1.nY, refract, 3, 4, ATT_COLOR);
if (_local6[0] || (_local6[1])) {
var _local10 = _local6[0];
var _local8 = _local6[1];
var dist = Math.sqrt((_local10 * _local10) + (_local8 * _local8));
if (dist != 0) {
_local1.ajustVector((-_local10) / dist, (-_local8) / dist);
}
}
var _local5 = getOffsets(_local1.nX, _local1.nY, refract, 1, 2, REF_COLOR);
if (_local5[0] || (_local5[1])) {
var _local10 = _local5[0];
var _local8 = _local5[1];
var dist = (Math.sqrt((_local10 * _local10) + (_local8 * _local8)) * 2);
if (dist != 0) {
_local1.ajustVector((_local10 / dist) * 0.5, (_local8 / dist) * 0.5);
}
}
var _local9 = rotation.getPixel(_local1.nX, _local1.nY);
var _local7 = _local9 >> 16;
if (_local7) {
var _local15 = (((_local9 & ATT_COLOR) >> 8) / _local7) - 8;
var _local16 = ((_local9 & 255) / _local7) - 8;
_local1.ajustVector(_local15 / 4, _local16 / 4);
}
if (playerAggregator.sts == "aggregating") {
dst = player.getDistance(_local1);
if (((dst < (player._width / 4)) && (_local1 != player)) && (_local1._visible)) {
_local1._visible = false;
player._xscale = player._xscale + SCALE_PER_UNIT;
player._yscale = player._yscale + SCALE_PER_UNIT;
_local1.aggregator = player;
player.mass++;
updateProgress(player.mass);
}
}
if (proletAggregator.sts == "aggregating") {
dst = proletAggregator.subject.getDistance(_local1);
if ((((dst < (proletAggregator.subject._width / 2)) && (_local1 != proletAggregator.subject)) && (_local1._visible)) && (!((_local1 == player) && (playerAggregator.sts == "aggregating")))) {
_local1._visible = false;
proletAggregator.subject._xscale = proletAggregator.subject._xscale + SCALE_PER_UNIT;
proletAggregator.subject._yscale = proletAggregator.subject._yscale + SCALE_PER_UNIT;
_local1.aggregator = proletAggregator.subject;
proletAggregator.subject.mass++;
if (player.mass == undefined) {
updateProgress(proletAggregator.subject.mass);
}
}
}
_local2 = 0;
while (_local2 < prolets.length) {
dist = Math.sqrt(Math.pow(_local1._x - prolets[_local2]._x, 2) + Math.pow(_local1._y - prolets[_local2]._y, 2));
if ((dist < CONVERSION_DISTANCE) && (prolets[_local2].inertia <= 0)) {
newBoid = battlefield.attachMovie("boid", "b" + battlefield.getNextHighestDepth(), battlefield.getNextHighestDepth(), {_x:prolets[_local2]._x, _y:prolets[_local2]._y, maxSpeed:PROLET_MAX_SPEED});
newBoid.mass = 0;
newBoid.flame._visible = false;
newBoid.body.gotoAndStop(true);
boids.push(newBoid);
newBoid.ind = boids.length - 1;
removeProlet(prolets[_local2]);
playSound("conversion", 30);
}
_local2++;
}
if (_local1._visible && (_local1.mass == 0)) {
e = 0;
while (e < enemies.length) {
if (enemies[e].hitTest(_local1._x, _local1._y, true)) {
killBoid(_local1);
}
e++;
}
}
}
_local4++;
}
if (player._visible) {
_local4 = 0;
while (_local4 < boids.length) {
if ((boids[_local4] != player) && (boids[_local4] != proletAggregator.subject)) {
var _local18 = boids[_local4];
var _local14 = _local18.getDifference(player);
if (_local14.distance < (1 * player.agency)) {
var _local17 = boids[_local4].getAngle(player);
if (playerAggregator.sts == "recharging") {
perc = 100 - ((PLAYER_RECHARGE_TIMER / 100) * playerAggregator.counter);
boids[_local4].ajust(_local17, ((-ATTRACTION_POWER) / 100) * perc);
} else if (playerAggregator.sts == "aggregating") {
boids[_local4].ajust(_local17, (-ATTRACTION_POWER) * 3);
} else {
boids[_local4].ajust(_local17, -ATTRACTION_POWER);
}
}
}
_local4++;
}
}
if (proletAggregator.sts == "aggregating") {
_local4 = 0;
while (_local4 < boids.length) {
if (boids[_local4] != proletAggregator.subject) {
var _local18 = boids[_local4];
var _local14 = _local18.getDifference(proletAggregator.subject);
if (_local14.distance < 100) {
var _local17 = boids[_local4].getAngle(proletAggregator.subject);
if (proletAggregator.sts == "aggregating") {
boids[_local4].ajust(_local17, (-ATTRACTION_POWER) * 3);
}
}
}
_local4++;
}
}
drawWorld();
}
function getOffsets(x, y, bitmap, loffset, roffset, mask) {
var _local2 = 0;
var _local1 = 0;
_local2 = _local2 + (bitmap.getPixel(x + loffset, y) & mask);
_local2 = _local2 - (bitmap.getPixel(x - loffset, y) & mask);
_local1 = _local1 + (bitmap.getPixel(x, y + loffset) & mask);
_local1 = _local1 - (bitmap.getPixel(x, y - loffset) & mask);
var _local8 = bitmap.getPixel(x + roffset, y + roffset) & mask;
_local2 = _local2 + _local8;
_local1 = _local1 + _local8;
_local8 = bitmap.getPixel(x - roffset, y - roffset) & mask;
_local2 = _local2 - _local8;
_local1 = _local1 - _local8;
_local8 = bitmap.getPixel(x - roffset, y + roffset) & mask;
_local2 = _local2 - _local8;
_local1 = _local1 + _local8;
_local8 = bitmap.getPixel(x + roffset, y - roffset) & mask;
_local2 = _local2 + _local8;
_local1 = _local1 - _local8;
return([_local2, _local1]);
}
function drawWorld() {
showmap.fillRect(showmap.rectangle, 0);
if (drawRefraction) {
showmap.draw(refract, trm, new flash.geom.ColorTransform(1, 1, 0, 1, 0, 0, 0, 0), "add");
}
if (drawAlignment) {
showmap.draw(rotation, trm, new flash.geom.ColorTransform(0, 0, 1, 1, 0, 0, 0, 0), "add");
}
}
function waveTimer() {
this.s++;
if (level < 20) {
freq = 2;
} else if (level < 60) {
freq = 3;
} else {
freq = 4;
}
if ((this.s % freq) == 0) {
if (random(2) == 0) {
spawnEnemy("square", Math.round((1 + boids.length) - Math.random(boids.length)));
} else {
spawnEnemy("square", Math.round((1 + boids.length) + Math.random(boids.length)));
}
}
if ((this.s % 2) == 1) {
newProlet = spawnProlet(MARGIN + random(STAGE_W - (MARGIN * 2)), 0);
newProlet.yspeed = 2;
}
}
function spawnEnemy(typ, ms) {
enemy = battlefield.attachMovie(typ, "e_" + battlefield.getNextHighestDepth(), battlefield.getNextHighestDepth());
enemies.push(enemy);
enemy.ind = enemies.length - 1;
enemy.isEnemy = true;
if (!(typ === "square")) {
} else {
enemy._y = 0;
enemy._x = MARGIN + random(STAGE_W - (MARGIN * 2));
enemy._xscale = 100 + (ms * SCALE_PER_UNIT);
enemy._yscale = 100 + (ms * SCALE_PER_UNIT);
enemy.xspeed = 0;
enemy.yspeed = 2;
enemy.mass = ms;
enemy.onEnterFrame = function () {
this._rotation = this._rotation + 2;
};
}
}
function spawnProlet(xPos, yPos) {
prolet = battlefield.attachMovie("prolet", "p_" + battlefield.getNextHighestDepth(), battlefield.getNextHighestDepth());
prolets.push(prolet);
prolet._x = xPos;
prolet._y = yPos;
prolet.ind = prolets.length - 1;
prolet.yspeed = 0;
prolet.xspeed = 0;
return(prolet);
}
function removeEnemy(obj, violent) {
if (violent) {
exp = battlefield.attachMovie("debris", "exp_" + battlefield.getNextHighestDepth(), battlefield.getNextHighestDepth(), {_x:obj._x, _y:obj._y, _xscale:obj._xscale, _yscale:obj._yscale});
exp.maxScale = obj._xscale * 2;
if (exp.maxScale > 1000) {
exp.maxScale = 1000;
}
exp.onEnterFrame = function () {
this._xscale = this._xscale * 1.2;
this._yscale = this._yscale * 1.2;
if (this._xscale > this.maxScale) {
removeMovieClip(this);
}
};
}
enemies.splice(obj.ind, 1);
e = 0;
while (e < enemies.length) {
enemies[e].ind = e;
e++;
}
removeMovieClip(obj);
}
function removeProlet(obj) {
prolets.splice(obj.ind, 1);
k = 0;
while (k < prolets.length) {
prolets[k].ind = k;
k++;
}
delete obj.onEnterFrame;
removeMovieClip(obj);
}
function killBoid(obj) {
if (obj == player) {
playSound("die_player", 70);
music.active = false;
HUD.msg.field.text = "YOUR GAME IS OVER BUT THE STRUGGLE OF THE INTERGALACTIC WORKING CLASS CONTINUES...";
HUD.msg._visible = true;
} else {
playSound("die" + random(6), 50);
}
boids.splice(obj.ind, 1);
b = 0;
while (b < boids.length) {
boids[b].ind = b;
b++;
}
delete obj.onEnterFrame;
removeMovieClip(obj);
}
function hitEnemy(def, atk) {
if ((atk.mass - def.mass) > 1) {
playSound("explosion", 70);
angle = Math.atan2(def._y - atk._y, def._x - atk._x);
power = 5;
newProlet = spawnProlet(def._x + (Math.cos(angle) * power), def._y + (Math.sin(angle) * power));
newProlet.inertia = 20;
newProlet.xspeed = newProlet.xspeed + (Math.cos(angle) * power);
newProlet.yspeed = newProlet.yspeed + (Math.cos(angle) * power);
removeEnemy(def, true);
} else {
if (atk.mass > 1) {
playSound("contact", 70);
}
angle = Math.atan2(def._y - atk._y, def._x - atk._x);
power = def.mass - Math.abs(atk.mass - def.mass);
def.xspeed = def.xspeed + ((Math.cos(angle) * power) / 5);
def.yspeed = def.yspeed + ((Math.sin(angle) * power) / 5);
if (atk == player) {
power = def.mass - Math.abs(atk.mass - def.mass);
atk.xSpeed = atk.xSpeed - (Math.cos(angle) * power);
atk.ySpeed = atk.ySpeed - (Math.sin(angle) * power);
}
if (atk.mass > 1) {
def.mass = def.mass - atk.mass;
}
def._xscale = (def._yscale = 100 + (def.mass * SCALE_PER_UNIT));
}
}
function subjectivity(avantBoid) {
if (enemies.length > 0) {
comrades = 0;
playerToo = false;
c = 0;
while (c < boids.length) {
if ((boids[c] != avantBoid) && (boids[c].getDistance(avantBoid) < (CONVERSION_DISTANCE * 3))) {
comrades++;
if (boids[c] == player) {
playerToo = true;
}
}
c++;
}
if ((comrades > Math.round(boids.length / 2.5)) && (!playerToo)) {
proletAggregator.sts = "aggregating";
proletAggregator.subject = avantBoid;
proletAggregator.subject.maxSpeed = PROLET_MAX_SPEED * 0.8;
proletAggregator.subject.flame._visible = true;
proletAggregator.subject.flame.thing.gotoAndStop(1);
}
}
}
function createSoundLoop(sound_id) {
id = soundBox.getNextHighestDepth();
obj = soundBox.createEmptyMovieClip(id, id);
obj.sound = new Sound(obj);
obj.sound.attachSound(sound_id);
obj.onEnterFrame = function () {
this.sound.setVolume(this.vol);
if (!this.active) {
this.sound.stop();
this.isPlaying = false;
}
if (this.active && (!this.isPlaying)) {
this.sound.start(0, 999999);
this.isPlaying = true;
}
};
return(obj);
}
function playSound(sound_id, sound_volume) {
id = soundBox.getNextHighestDepth();
obj = soundBox.createEmptyMovieClip(id, id);
obj.sound = new Sound(obj);
obj.sound.attachSound(sound_id);
obj.sound.setVolume(sound_volume);
obj.sound.start();
return(obj);
}
function updateProgress(qt) {
prog = Math.round((100 / REVOLUTION) * qt);
if (prog > 100) {
prog = 100;
}
if (qt == "") {
HUD.level.field.text = "";
} else {
HUD.level.field.text = prog + "%";
}
if ((prog == 100) && (!end)) {
revolution();
}
}
function revolution() {
HUD.msg.field.text = "WORKERS OF ALL PLANETS ARE OVERTHROWING THEIR OPPRESSORS. REVOLUTION TRIUMPHS!";
HUD.msg._visible = true;
playSound("internationale", 100);
if (playerAggregator.sts == "aggregating") {
playerAggregator.counter = 2;
}
if (proletAggregator.sts == "aggregating") {
proletAggregator.counter = 2;
}
music.active = false;
trace("REVOLUTION");
clearInterval(waves.id);
i = 0;
while (i < enemies.length) {
removeEnemy(enemies[i], true);
i++;
}
for (mc in battlefield) {
if (battlefield[mc].isEnemy) {
removeEnemy(battlefield[mc], true);
enemies = new Array();
removeMovieClip(battlefield[mc]);
}
}
end = true;
}
function reset() {
delete ROOT.onEnterFrame;
for (mc in ROOT) {
removeMovieClip(ROOT[mc]);
}
stopAllSounds();
gotoAndStop ("intro");
}
stop();
Mouse.hide();
ROOT._quality = "low";
MARGIN = 50;
REF_COLOR = 16711680 /* 0xFF0000 */;
ATT_COLOR = 65280;
STARTING_BOIDS = 0;
REVOLUTION = 35;
PROLET_MAX_SPEED = 5;
PLAYER_MAX_SPEED = 5;
PLAYER_INERTIA = 0.2;
PLAYER_ACC = 0.8;
ATTRACTION_POWER = 2;
AGGREGATION_TIMER = 200;
PLAYER_RECHARGE_TIMER = 150;
PROLET_RECHARGE_TIMER = 300;
SCALE_PER_UNIT = 20;
CONVERSION_DISTANCE = 20;
DIFFICULTY_LEVEL = 50;
PROLET_SUBJECTIVITY_OFFSET = 30;
end = false;
var drawRefraction = true;
var drawAlignment = false;
var trm = (new flash.geom.Matrix());
removeMovieClip(ROOT.tit);
soundBox = ROOT.createEmptyMovieClip("sndBox", 999);
var refract = (new flash.display.BitmapData(600, 600, false, 0));
var rotation = (new flash.display.BitmapData(600, 600, false, 0));
var showmap = (new flash.display.BitmapData(600, 600, false, 0));
ROOT.attachBitmap(showmap, 1);
battlefield = ROOT.createEmptyMovieClip("battle", 10);
HUD = ROOT.createEmptyMovieClip("HUD", 30);
HUD.attachMovie("levelCount", "level", 40);
HUD.attachMovie("messageBox", "msg", 50);
HUD.msg._visible = false;
var sky2 = ROOT.createEmptyMovieClip("sky2", this.getNextHighestDepth());
starField(sky2, 9, 4, "0xFFAAAAAA");
var sky3 = ROOT.createEmptyMovieClip("sky3", this.getNextHighestDepth());
starField(sky3, 30, 8, "0xFFFFFFFF");
var boids = [];
var a = 0;
while (a < STARTING_BOIDS) {
newBoid = battlefield.attachMovie("boid", "b" + a, battlefield.getNextHighestDepth(), {_x:Math.random() * 600, _y:Math.random() * 600, maxSpeed:PROLET_MAX_SPEED});
newBoid.mass = 0;
newBoid.flame._visible = false;
newBoid.body.gotoAndStop(true);
boids.push(newBoid);
newBoid.ind = boids.length - 1;
a++;
}
player = battlefield.attachMovie("player", "player", battlefield.getNextHighestDepth(), {_x:STAGE_W / 2, _y:STAGE_H, maxSpeed:3});
boids.push(player);
player.ind = boids.length - 1;
player.ySpeed = 0;
player.xSpeed = 0;
player.agency = 100;
player.flame._visible = false;
player.mass = 0;
var playerAggregator = new Object();
playerAggregator.sts = "ready";
playerAggregator.counter = AGGREGATION_TIMER;
var proletAggregator = new Object();
proletAggregator.sts = "ready";
proletAggregator.counter = AGGREGATION_TIMER;
enemies = new Array();
prolets = new Array();
clearInterval(waves.id);
waves = new Object();
waves.interval = waveTimer;
waves.id = setInterval(waves, "interval", 1000);
waves.s = 0;
refraction._visible = false;
rotator._visible = false;
element._visible = false;
refractionBig._visible = false;
rotatorBig._visible = false;
ROOT.onEnterFrame = routine;
cycle = 0;
mass1 = createSoundLoop("mass_1");
mass2 = createSoundLoop("mass_2");
mass3 = createSoundLoop("mass_3");
music = createSoundLoop("techno_dnb");
music.active = true;
music.vol = 30;
Symbol 9 MovieClip Frame 11
gotoAndPlay ("press");
Symbol 16 MovieClip Frame 10
gotoAndPlay ("press");
Symbol 63 MovieClip [player] Frame 1
#initclip 3
Object.registerClass("player", boid);
#endinitclip
Symbol 64 MovieClip [boid] Frame 1
#initclip 2
Object.registerClass("boid", boid);
#endinitclip
Symbol 112 MovieClip [__Packages.boid] Frame 0
class boid extends MovieClip
{
var xspeed, maxSpeed, yspeed, xs, ys, _x, _y;
function boid () {
super();
xspeed = ((xspeed == undefined) ? ((Math.random() * maxSpeed) - (maxSpeed / 2)) : (xspeed));
yspeed = ((yspeed == undefined) ? ((Math.random() * maxSpeed) - (maxSpeed / 2)) : (yspeed));
}
function onEnterFrame() {
var _local3 = Math.atan2(yspeed, xspeed);
var _local2 = Math.sqrt((yspeed * yspeed) + (xspeed * xspeed));
xs = xspeed / _local2;
ys = yspeed / _local2;
if (_local2 > maxSpeed) {
_local2 = maxSpeed;
xspeed = xs * _local2;
yspeed = ys * _local2;
}
_x = _x + xspeed;
_y = _y + yspeed;
if (_x < MARGIN) {
xspeed = xspeed + ((MARGIN - _x) / 10);
}
if (_x > (STAGE_W - MARGIN)) {
xspeed = xspeed + (((STAGE_W - MARGIN) - _x) / 10);
}
if (_y < MARGIN) {
yspeed = yspeed + ((MARGIN - _y) / 10);
}
if (_y > (STAGE_H - MARGIN)) {
yspeed = yspeed + (((STAGE_H - MARGIN) - _y) / 10);
}
}
function getDistance(n) {
return(Math.sqrt(Math.pow(_x - n._x, 2) + Math.pow(_y - n._y, 2)));
}
function getAngle(n) {
return(Math.atan2(_y - n._y, _x - n._x));
}
function getDifference(n) {
var _local3 = _x - n._x;
var _local2 = _y - n._y;
return({distance:Math.sqrt((_local3 * _local3) + (_local2 * _local2)), angle:Math.atan2(_local2, _local3)});
}
function get nX() {
return(_x);
}
function get nY() {
return(_y);
}
function ajustVector(x, y) {
xspeed = xspeed + x;
yspeed = yspeed + y;
}
function ajust(angle, power) {
xspeed = xspeed + (Math.cos(angle) * power);
yspeed = yspeed + (Math.sin(angle) * power);
}
function addMovement(n, power) {
xspeed = xspeed + ((xspeed - n.xspeed) * power);
yspeed = yspeed + ((yspeed - n.yspeed) * power);
}
var MARGIN = 50;
var STAGE_W = Stage.width;
var STAGE_H = Stage.height;
}
Symbol 101 MovieClip Frame 1
stop();