Frame 1
function init() {
attachMovie("mcCadre", "cadre", 2000);
attachMovie("mcScore", "score", 2001);
score._x = mcw - 2;
score._y = mch - 17;
glow(score, 2, 250, 8546095);
glow(score, 2, 255, 14868116);
createEmptyMovieClip("lines", 2);
createEmptyMovieClip("men", 3);
men.d = 0;
attachMovie("mcGround", "ground", 10);
ground._y = mch - 20;
var _local1 = 0;
while (_local1 < 2) {
var _local2 = attachMovie("mcRoom", "room" + _local1, 5 + _local1);
_local2._x = (mcw * 0.5) + (((_local1 * 2) - 1) * ((mcw * 0.5) - MARGIN));
_local2._y = ground._y;
_local2.gotoAndStop(_local1 + 1);
_local1++;
}
createEmptyMovieClip("parts", 4);
parts.d = 0;
mList = [];
pList = [];
updateBg();
so = SharedObject.getLocal("server-fever");
if (so.data.version != VERSION) {
so.data.score = 0;
so.data.version = VERSION;
so.data.options = [4, 0, 0, 0, 0, 0];
}
sc = so.data.score;
options = so.data.options;
if (sc == null) {
sc = 0;
options = [4, 0, 0, 0, 0, 0];
}
incScore(0);
setInterval(updateBg, 60000);
var _local3 = {onMouseUp:release, onMouseMove:function () {
flStart = true;
}};
Mouse.addListener(_local3);
room1.vr = 0;
}
function main() {
updateMen();
updateParts();
updateShop();
room1.vr = room1.vr - (room1._rotation * 0.2);
room1.vr = room1.vr * 0.78;
room1._rotation = room1._rotation + room1.vr;
if ((Math.abs(room1._rotation) + Math.abs(room1.vr)) < 1) {
room1.vr = 0;
room1._rotation = 0;
}
}
function updateMen() {
if ((mList.length < options[0]) && (random(mList.length * 2) == 0)) {
men.d++;
var mc = men.attachMovie("mcMan", "man" + men.d, men.d);
mc._x = MARGIN;
mc._y = ground._y;
mc.speed = SPEED[options[1]] + Math.random();
mc.startFrame = 0;
mc.cs = 0.8;
mc.sens = 1;
var _local5 = Math.random();
var _local4 = MUSCLE[options[2]];
mc.wsc = (Math.max(0.25, 1 - _local5) * _local4) + (1 - _local4);
if (random(2) == 0) {
mc.startFrame = 50;
}
mc.frame = mc.startFrame;
mc.stop();
mList.push(mc);
mc.serv.cas._xscale = (mc.serv.cas._yscale = 100 + (_local5 * 70));
mc.serv.cas.gotoAndStop(random(mc.serv.cas._totalframes) + 1);
mc.zone.onPress = function () {
take(mc);
};
glow(mc, 2, 255, 14868116);
}
var _local1 = 0;
while (_local1 < mList.length) {
var mc = mList[_local1];
if (mc.flLaunch != true) {
var _local2 = mc.speed * mc.cs;
if (mc.sens == 1) {
_local2 = _local2 * mc.wsc;
}
mc._x = mc._x + (_local2 * mc.sens);
mc.frame = (mc.frame + _local2) % 40;
mc.gotoAndStop((int(mc.frame) + 1) + mc.startFrame);
var _local3 = LAUNCH_PROBA[options[3]] / mc.speed;
if ((((mc.sens == 1) && (mc._x > (room0._x + 40))) && (mc._x < (mcw * 0.6))) && (random(_local3) == 0)) {
mc.flLaunch = true;
mc.gotoAndPlay(101);
mc.launch = launch;
mc.runBack = runBack;
}
}
if (mc._x > (mcw - MARGIN)) {
incScore(1);
runBack(mc);
mc._x = mcw - MARGIN;
}
if (mc._x < MARGIN) {
mc.removeMovieClip();
mList.splice(_local1--, 1);
}
_local1++;
}
}
function take(mc) {
if (serv != null) {
return(undefined);
}
serv = newServ(mc);
serv._x = _xmouse;
serv._y = _ymouse;
runBack(mc);
}
function release() {
if (serv == null) {
return(undefined);
}
var _local2 = serv._x - serv.ox;
var _local1 = serv._y - serv.oy;
var _local3 = Math.min(Math.sqrt((_local2 * _local2) + (_local1 * _local1)), 20);
var _local4 = Math.atan2(_local1, _local2);
serv.vx = Math.cos(_local4) * _local3;
serv.vy = Math.sin(_local4) * _local3;
turnPhys(serv);
serv = null;
}
function turnPhys(mc) {
mc.frict = 0.98;
mc.w = mc.cas._xscale * 0.001;
mc.vr = ((Math.random() * 2) - 1) * Math.sqrt((mc.vx * mc.vx) + (mc.vy * mc.vy));
}
function launch(mc) {
var _local1 = newServ(mc);
_local1.vx = ((2 + options[2]) + (Math.random() * 6)) + (options[2] * 2);
_local1.vy = -(1.5 + (Math.random() * 4));
_local1._rotation = 27;
turnPhys(_local1);
}
function runBack(mc) {
mc.flLaunch = false;
mc._xscale = mc._xscale * -1;
mc.sens = -1;
mc.startFrame = 150;
mc.cs = 2;
mc.speed = mc.speed * 1.5;
if (mc._currentframe > 100) {
mc._x = mc._x + 18;
}
}
function displayShop() {
shop = attachMovie("mcShop", "shop", 2002);
shop._y = -shop._height;
displayShopSlot();
}
function displayShopSlot() {
var _local3 = 42;
var _local4 = (mcw - (2 * _local3)) / 4;
var _local1 = 0;
while (_local1 < 5) {
var _local2 = shop.attachMovie("shopSlot", "ss" + _local1, _local1);
_local2._x = (_local3 + (_local1 * _local4)) - (_local2._width * 0.5);
_local2._y = 5;
_local2.gotoAndStop(_local1 + 1);
_local2.id = _local1;
_local2.field.text = getPrice(_local1) + " \u20AC";
_local2.fieldLevel.text = options[_local1];
if ((options[_local1] == lim[_local1]) || (getPrice(_local1) > sc)) {
_local2._alpha = 40;
_local2.but._visible = false;
if (options[_local1] == lim[_local1]) {
_local2.field.text = "MAX";
}
}
_local1++;
}
}
function getPrice(id) {
switch (id) {
case 0 :
return(int(Math.pow(options[0] - 1, 3) / 10) * 10);
case 1 :
return(Math.pow(10, options[1] + 1));
case 2 :
return(Math.pow(10, options[2] + 1));
case 3 :
return(100 + (int(Math.pow(6, options[3] + 2) / 10) * 10));
case 4 :
return(1200);
}
return(prices[id]);
}
function buy(id) {
incScore(-getPrice(id));
options[id]++;
so.data.options = options;
displayShopSlot();
}
function updateShop() {
if (shop == null) {
if (flStart && (_ymouse < 30)) {
displayShop();
}
} else if (_ymouse > 80) {
shop._y = shop._y - 15;
if (shop._y < (-shop._height)) {
shop.removeMovieClip();
shop = null;
}
} else {
shop._y = shop._y * 0.5;
}
}
function newServ(mc) {
var _local1 = newPart("mcServ");
var _local3 = {x:mc.serv._x, y:mc.serv._y};
mc.localToGlobal(_local3);
_local1.flServ = true;
_local1.x = _local3.x;
_local1.y = _local3.y;
_local1.cas.gotoAndStop(mc.serv.cas._currentframe);
_local1.cas._xscale = (_local1.cas._yscale = mc.serv.cas._xscale);
glow(_local1, 2, 255, 14868116);
return(_local1);
}
function newPart(link, x, y) {
parts.d++;
var _local1 = parts.attachMovie(link, "p" + parts.d, parts.d);
_local1.x = (_local1._x = x);
_local1.y = (_local1._y = y);
_local1.vx = 0;
_local1.vy = 0;
_local1.frict = 1;
_local1.w = 0;
pList.push(_local1);
_local1.scale = 100;
return(_local1);
}
function updateParts() {
var _local4 = 0;
while (_local4 < pList.length) {
var _local1 = pList[_local4];
_local1.vx = _local1.vx * _local1.frict;
_local1.vy = _local1.vy * _local1.frict;
_local1.x = _local1.x + _local1.vx;
_local1.y = _local1.y + _local1.vy;
_local1.t = _local1.t - 1;
_local1.vy = _local1.vy + _local1.w;
if (_local1.t < 10) {
_local1._xscale = (_local1._yscale = (_local1.t / 10) * _local1.scale);
}
if (_local1.t < 0) {
_local1.removeMovieClip();
pList.splice(_local4--, 1);
}
if (_local1.vr != null) {
_local1._rotation = _local1._rotation + _local1.vr;
}
if (_local1.flServ == true) {
if (_local1 == serv) {
_local1.ox = _local1._x;
_local1.oy = _local1._y;
_local1.x = _xmouse;
_local1.y = _ymouse;
} else {
var _local5 = _local1.getBounds(_local1).yMax + 2;
if (_local1.y > (ground._y - _local5)) {
if (options[4] == 1) {
_local1.y = ground._y - _local5;
_local1.vy = _local1.vy * -0.5;
_local1.vr = _local1.vr * (-(0.5 + (Math.random() * 0.8)));
if (_local1.rebond == null) {
_local1.rebond = 0;
}
if ((_local1.rebond++) == 3) {
_local1.t = 10;
}
} else {
var _local6 = Math.pow(6, _local1.w * 10);
var _local3 = 0;
while (_local3 < _local6) {
var _local2 = newPart("part", _local1.x + ((((Math.random() * 2) - 1) * _local1._width) * 0.5), _local1.y + ((((Math.random() * 2) - 1) * _local1._height) * 0.5));
_local2.vx = _local1.vx * (0.5 + Math.random());
_local2.vy = ((-_local1.vy) * (0.5 + Math.random())) * 0.7;
_local2.frict = 0.98;
_local2.t = 10 + (Math.random() * 10);
_local2.w = 0.1 + (Math.random() * _local1.w);
_local2.scale = (_local2._xscale = (_local2._yscale = 100 + (Math.random() * 80)));
glow(_local2, 2, 10, 8546095);
_local3++;
}
_local1.removeMovieClip();
pList.splice(_local4--, 1);
}
}
}
if (((Math.abs(_local1._x - room1._x) < 20) && (_local1._y < room1._y)) && (_local1._y > (room1._y - 100))) {
var _local6 = 12;
var _local7 = 12;
room1.vr = (((Math.sqrt((_local1.vx * _local1.vx) + (_local1.vy * _local1.vy)) * _local1.w) * 2) * (room1._y - _local1.y)) / 100;
_local1.removeMovieClip();
pList.splice(_local4--, 1);
incScore(1);
}
}
_local1._x = _local1.x;
_local1._y = _local1.y;
_local4++;
}
}
function updateBg() {
var _local1 = new Date();
var _local2 = 100;
var _local3 = (_local1.getHours() / 24) * _local2;
_local3 = _local3 + ((_local1.getMinutes() / 1440) * _local2);
bg.gotoAndStop(int(_local3) + 1);
bg.star._rotation = -bg.star._parent._rotation;
}
function incScore(n) {
sc = sc + n;
score.field.text = sc + " \u20AC";
so.data.score = sc;
}
function glow(mc, bl, st, col) {
var _local1 = new flash.filters.GlowFilter();
_local1.blurX = bl;
_local1.blurY = bl;
_local1.strength = st;
_local1.color = col;
var _local2 = mc.filters;
_local2.push(_local1);
mc.filters = _local2;
}
mcw = 360;
mch = 200;
MARGIN = 34;
VERSION = 3;
SPEED = [0.5, 1, 2, 3.5, 5];
MUSCLE = [1, 0.7, 0.5, 0.25, 0.1];
LAUNCH_PROBA = [10000000, 1000, 400, 160, 60];
prices = [10, 200, 400, 1000, 10000, 30000];
lim = [20, 4, 4, 4, 1, 1];
init();
Frame 2
main();
Frame 3
gotoAndPlay (2);
Symbol 13 MovieClip [mcMan] Frame 120
launch(this);
Symbol 13 MovieClip [mcMan] Frame 129
runBack(this);
Symbol 22 Button
on (press) {
_parent._parent.buy(id);
}
Symbol 55 MovieClip Frame 1
if (speed == null) {
speed = ((random(2) * 2) - 1) * (0.1 + (Math.random() * 0.5));
}
_rotation = (_rotation + speed);
Symbol 55 MovieClip Frame 2
gotoAndPlay (1);
Symbol 58 MovieClip Frame 1
_rotation = (-_parent._rotation);
_parent._parent.star = this;