Frame 1
function createAnt(antXLoc, antYLoc, antGender, antName, antDigCapacity, antMaxAge, antMoveRate, antDecisionMod) {
this.attachMovie("Ant", antName, this.getNextHighestDepth());
this[antName].gender = antGender;
this[antName].digCapacity = antDigCapacity;
this[antName].moveRate = antMoveRate;
this[antName].maxAge = antMaxAge;
this[antName].decisionMod = antDecisionMod;
this[antName].myName = antName;
nextArrayEntry = totalAnts.length;
totalAnts[Number(nextArrayEntry)] = antName;
totalAntsNo = totalAntsNo + 1;
this[antName].onRelease = function () {
_root.showAntInfo(antName);
};
}
function startInfoPanelHide() {
if (_root.antInfoPanel_intervalId != null) {
clearInterval(_root.antInfoPanel_intervalId);
}
_root.antInfoPanel_intervalId = setInterval(this, "hideInfoPanel", 6000);
}
function showAntInfo(whichAnt) {
if (_root.antInfoPanel) {
_root.antInfoPanel._x = 630;
_root.antInfoPanel._y = 50;
_root.antInfoPanel.currentAnt = String(whichAnt);
var _local2 = new mx.transitions.Tween(_root.antInfoPanel, "_alpha", mx.transitions.easing.Regular.easeOut, 100, 0, 4, false);
var _local7 = new mx.transitions.Tween(_root.antInfoPanel, "_xscale", mx.transitions.easing.Regular.easeOut, 100, 50, 4, false);
var _local6 = new mx.transitions.Tween(_root.antInfoPanel, "_yscale", mx.transitions.easing.Regular.easeOut, 100, 50, 4, false);
_local2.onMotionFinished = function () {
var _local2 = new mx.transitions.Tween(_root.antInfoPanel, "_alpha", mx.transitions.easing.Regular.easeOut, 0, 100, 4, false);
var _local3 = new mx.transitions.Tween(_root.antInfoPanel, "_xscale", mx.transitions.easing.Regular.easeOut, 50, 100, 4, false);
var _local4 = new mx.transitions.Tween(_root.antInfoPanel, "_yscale", mx.transitions.easing.Regular.easeOut, 50, 100, 4, false);
_root.antInfoPanel.ant_age.text = _root[whichAnt].age;
_root.antInfoPanel.hungerMeter.handle._x = _root[whichAnt].appetite;
_root.antInfoPanel.antNameText.text = _root[whichAnt].customName;
};
} else {
_root.attachMovie("antInfoPanel", "antInfoPanel", _root.getNextHighestDepth());
_root.antInfoPanel._x = 630;
_root.antInfoPanel._y = 50;
var _local3 = new mx.transitions.Tween(_root.antInfoPanel, "_alpha", mx.transitions.easing.Regular.easeOut, 0, 100, 4, false);
var _local4 = new mx.transitions.Tween(_root.antInfoPanel, "_xscale", mx.transitions.easing.Regular.easeOut, 50, 100, 4, false);
var _local5 = new mx.transitions.Tween(_root.antInfoPanel, "_yscale", mx.transitions.easing.Regular.easeOut, 50, 100, 4, false);
_root.antInfoPanel.currentAnt = String(whichAnt);
_root.antInfoPanel.ant_age.text = _root[whichAnt].age;
_root.antInfoPanel.hungerMeter.handle._x = _root[whichAnt].appetite;
_root.antInfoPanel.antNameText.text = _root[whichAnt].customName;
}
_root.startInfoPanelHide();
}
function hideInfoPanel() {
if (_root.antInfoPanel_intervalId != null) {
clearInterval(_root.antInfoPanel_intervalId);
}
var _local2 = new mx.transitions.Tween(_root.antInfoPanel, "_alpha", mx.transitions.easing.Regular.easeOut, 100, 0, 4, false);
var _local4 = new mx.transitions.Tween(_root.antInfoPanel, "_xscale", mx.transitions.easing.Regular.easeOut, 100, 50, 4, false);
var _local3 = new mx.transitions.Tween(_root.antInfoPanel, "_yscale", mx.transitions.easing.Regular.easeOut, 100, 50, 4, false);
_local2.onMotionFinished = function () {
removeMovieClip(_root.antInfoPanel);
};
}
function createFood(foodXLoc, foodYLoc, foodName) {
this.attachMovie("foodPellet", foodName, this.getNextHighestDepth());
this[foodName].myName = foodName;
eval (foodName)._x = foodXLoc * CurrentGame.tileW;
eval (foodName)._y = foodYLoc * CurrentGame.tileH;
eval (foodName).xtile = foodXLoc;
eval (foodName).ytile = foodYLoc;
}
function feedAnts() {
var _local2 = 1 + Math.round(Math.random() * 5);
i = 0;
while (i <= _local2) {
var _local1 = 1 + Math.round(Math.random() * 26);
createFood(Number(_local1), 1, String(("foodPellet" + controlsPanel.totalFood) + i));
i++;
}
}
function randomRock() {
var _local2 = Math.round(Math.random() - 0.4);
switch (_local2) {
case 0 :
var _local1 = 1 + Math.floor(Math.random() * 3);
return(_local1);
case 1 :
_local1 = 16 + Math.floor(Math.random() * 6);
return(_local1);
}
}
this._lockroot = true;
var totalAnts = new Array();
var totalAntsNo = 0;
var antInfoPanel_intervalId;
var nextArrayEntry = 0;
var CurrentGame = new Game();
CurrentGame.tileW = 20;
CurrentGame.tileH = 20;
CurrentGame.thisMap = [[23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23], [13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13], [10, 11, 12, 11, 12, 12, 11, 11, 11, 11, 12, 11, 12, 12, 11, 11, 11, 11, 12, 11, 12, 12, 11, 11, 11, 11, 12, 11, 12, 12, 11, 11, 12, 12, 9], [7, 1, 3, 4, 3, 1, 2, 3, 1, 1, 2, 4, 1, 2, 2, 4, 2, 2, 4, 2, 1, 2, 3, 1, 4, 2, 2, 1, 2, 4, 2, 4, 2, randomRock(), 8], [7, 1, 2, 2, 3, 2, 4, 3, 4, 3, 1, 2, 2, 1, 3, 4, 3, 1, 3, 2, 2, 3, randomRock(), 4, 3, 1, 4, 3, 1, randomRock(), 2, 1, 4, 4, 8], [7, 1, 1, 2, 3, 2, 4, 2, 4, 1, 2, 1, 3, 4, 2, 2, 2, randomRock(), randomRock(), 2, 1, 4, 3, 1, 1, 2, 4, 4, 2, 1, 2, 4, 2, 4, 8], [7, 1, 1, 2, 3, randomRock(), 1, 1, 1, 2, 2, 4, 4, 1, 2, 4, 2, 2, 4, 3, 2, 1, 4, randomRock(), 1, 2, 1, 1, 3, 3, 2, 3, 1, 4, 8], [7, 4, 3, 1, 3, 1, 4, 1, 3, 1, 1, 4, 3, 3, 4, 3, randomRock(), 3, 4, 2, 1, 1, 3, 4, 3, 1, 2, 2, 4, randomRock(), 4, 4, 1, randomRock(), 8], [7, randomRock(), 2, 2, 3, 2, 4, 2, randomRock(), 1, 2, 4, 2, 4, 1, 4, 2, 1, 1, 2, randomRock(), 4, 3, 4, randomRock(), 1, 3, 3, 1, 2, randomRock(), 3, 2, 1, 8], [7, 4, 1, randomRock(), randomRock(), 2, 4, 3, 2, 2, randomRock(), 3, 2, 2, 1, 3, 4, 1, 2, 1, 1, 3, 1, 2, 3, 2, 4, 2, 2, 1, 2, 1, 3, 4, 8], [7, 1, 1, 4, 1, 2, 1, 3, 1, 1, 2, 2, 2, 1, 2, 4, 4, 2, 4, 4, 1, 2, 3, 1, 3, 2, 2, 1, 3, 3, 2, 2, 2, 1, 8], [7, 2, 1, 2, randomRock(), 3, 4, 4, 1, 1, 3, 1, 1, 1, 2, 2, 4, 2, 3, 2, 1, 1, 3, 1, 2, 2, 4, 3, 1, 1, 2, 4, 2, 3, 8], [7, 2, 2, 2, 1, 2, 1, 4, 1, 4, 2, 4, 2, 2, 3, 4, 2, 1, 4, 4, 1, 1, 2, 4, 3, 3, 4, 3, 4, 3, 1, 3, 2, 2, 8], [7, 3, 3, 1, 3, 2, 4, 3, randomRock(), 1, 2, 4, 3, 1, 2, 1, 2, 1, 4, 3, 2, 2, 3, 4, 3, 2, 4, 3, 1, 3, 2, 4, 1, 4, 8], [7, 4, 4, 2, 2, 2, 3, 3, 1, 1, 4, 3, 2, 1, 2, 4, 4, 2, 1, 1, 2, 1, randomRock(), 4, randomRock(), 4, 3, 2, 2, 1, 2, 4, 2, 1, 8], [7, 1, 2, 2, 2, 1, 2, 3, randomRock(), 1, 4, 4, 2, 1, 2, 1, 2, 2, 4, 2, 1, 4, randomRock(), 1, 3, 4, 4, 3, 1, randomRock(), 2, 4, 4, 4, 8], [7, 2, 1, 2, 3, 4, randomRock(), 3, 1, 2, 2, 4, 1, 2, 2, 4, 3, randomRock(), randomRock(), 1, 3, 1, 4, 2, 3, 2, 4, randomRock(), randomRock(), randomRock(), 1, 3, 2, 3, 8], [7, 1, 1, 2, 3, 1, 4, 2, 2, 1, 1, 3, 2, 1, 3, 4, 2, 1, 2, randomRock(), 1, 1, 3, 4, 2, randomRock(), randomRock(), randomRock(), randomRock(), 2, 1, 2, 3, 4, 8], [7, 1, 4, 1, 3, 2, 1, 3, 1, 4, 3, 4, 2, 1, 2, 3, 1, randomRock(), 4, 2, 4, 2, 2, 1, 4, 2, 1, 3, 4, randomRock(), 2, 1, 2, 4, 8], [7, 4, 3, 4, 4, 2, 4, 3, 4, 1, 2, 4, 4, 3, 2, 1, 2, randomRock(), 4, 2, 1, 4, 3, 3, 4, 4, 4, 4, randomRock(), 1, 2, 4, 1, 4, 8], [7, 2, 1, 3, 3, 4, 1, 4, 1, 1, 2, 2, 2, 1, 4, 1, 3, 4, 1, 3, 3, 3, 4, 2, 3, 2, 3, 3, 1, 3, 4, 4, 2, 2, 8], [7, 1, 1, 2, 3, 2, 4, 3, 2, 3, 4, 1, 3, 4, 2, 4, 2, 1, 4, 2, 1, 1, 3, 4, 1, 3, 4, 3, 4, 4, 2, 2, 1, 4, 8], [7, 1, 1, 1, 3, 3, 3, 3, 1, 2, 2, 4, 4, 4, 2, 3, 1, 1, 4, 1, 1, 2, 1, 4, 2, 1, 1, 3, 1, 4, 3, 4, 1, 2, 8], [7, 1, 2, 2, 3, 2, 4, 1, 1, 2, 3, randomRock(), 1, 1, 1, 4, 2, 3, 1, 2, 3, 1, 3, 2, 3, 2, 4, 1, 2, 3, 2, 4, 2, 4, 8], [6, 14, 14, 15, 14, 15, 14, 14, 14, 15, 14, 14, 15, 15, 14, 14, 15, 14, 14, 15, 14, 14, 15, 15, 14, 14, 14, 15, 14, 14, 15, 14, 15, 14, 5]];
CurrentGame.buildMap(this);
this.createAnt(5, 1, 0, "ant1", 15, 100, 0.5, 0.4);
this.createAnt(5, 1, 1, "ant2", 15, 100, 0.25, 0.2);
this.attachMovie("controls", "controlsPanel", this.getNextHighestDepth());
controlsPanel._y = 460;
controlsPanel._x = 12;
this.onEnterFrame = function () {
if (this._ymouse >= 450) {
var _local3 = controlsPanel._y;
var _local2 = 460;
var _local5 = new mx.transitions.Tween(controlsPanel, "_y", mx.transitions.easing.Regular.easeOut, _local3, _local2, 8, false);
} else {
var _local3 = controlsPanel._y;
var _local2 = 495;
var _local6 = new mx.transitions.Tween(controlsPanel, "_y", mx.transitions.easing.Regular.easeOut, _local3, _local2, 8, false);
}
if (totalAntsNo <= 0) {
delete this.controlsPanel.onEnterFrame;
delete this.onEnterFrame;
this.attachMovie("gameOver", "gameOver", this.getNextHighestDepth());
controlsPanel.lifeSpanText.text = " - - - - - - - - - - - - - - - - - - - - - - - - - - - - ";
gameOver._x = 350;
gameOver._y = 250;
gameOver._alpha = 0;
gameOver._xscale = 50;
gameOver._yscale = 50;
var _local4 = new mx.transitions.Tween(gameOver, "_alpha", mx.transitions.easing.Regular.easeOut, 0, 100, 15, false);
var _local7 = new mx.transitions.Tween(gameOver, "_xscale", mx.transitions.easing.Regular.easeOut, 50, 100, 15, false);
var _local8 = new mx.transitions.Tween(gameOver, "_yscale", mx.transitions.easing.Regular.easeOut, 50, 100, 15, false);
}
};
stop();
Symbol 33 MovieClip [Ant] Frame 1
#initclip 11
Object.registerClass("Ant", Ant);
#endinitclip
stop();
Symbol 33 MovieClip [Ant] Frame 2
stop();
Symbol 33 MovieClip [Ant] Frame 3
stop();
Symbol 33 MovieClip [Ant] Frame 4
stop();
Symbol 33 MovieClip [Ant] Frame 5
stop();
Symbol 33 MovieClip [Ant] Frame 6
stop();
Symbol 33 MovieClip [Ant] Frame 7
stop();
Symbol 33 MovieClip [Ant] Frame 8
stop();
Symbol 33 MovieClip [Ant] Frame 9
stop();
Symbol 33 MovieClip [Ant] Frame 10
stop();
Symbol 112 MovieClip [Tile] Frame 1
#initclip 9
Object.registerClass("Tile", Tile);
#endinitclip
Symbol 132 MovieClip Frame 1
stop();
Symbol 132 MovieClip Frame 2
stop();
Symbol 135 MovieClip [controls] Frame 1
var remaining;
var elapsedTime;
var elapsedDays;
var elapsedHours;
var elapsedM;
var elapsedS;
var elapsedH;
var startTime;
var remaining;
var days;
var hours;
var minutes;
var seconds;
var hundredths;
var foodRefreshed = 1;
var totalAntsAddedTime = 4;
this.onEnterFrame = function () {
elapsedTime = getTimer();
elapsedDays = Math.floor(elapsedHours / 24);
elapsedHours = Math.floor(elapsedTime / 3600000);
remaining = elapsedTime - (elapsedHours * 3600000);
elapsedM = Math.floor(remaining / 60000);
remaining = remaining - (elapsedM * 60000);
elapsedS = Math.floor(remaining / 1000);
remaining = remaining - (elapsedS * 1000);
elapsedH = Math.floor(remaining / 10);
days = String(elapsedHours);
hours = String(elapsedHours);
minutes = String(elapsedM);
seconds = String(elapsedS);
lifeSpanText.text = ((((((days + " Days / ") + hours) + " Hours / ") + minutes) + " Minutes / ") + seconds) + " Seconds";
if (elapsedM > foodRefreshed) {
if (totalFood < 5) {
foodRefreshed = foodRefreshed + 2;
totalFood++;
i = 1;
while (i <= 5) {
if (eval ("pellet" + i)._currentframe == 2) {
eval ("pellet" + i).gotoAndStop(1);
break;
}
i++;
}
}
}
if (elapsedM >= totalAntsAddedTime) {
totalAntsAddedTime = totalAntsAddedTime + 4;
if ((_parent[totalAnts] % 2) == 0) {
_root.createAnt(5, 1, 1, "ant" + (_parent[totalAnts] + 1), 10, 100, 0.25, 0.4);
} else {
_root.createAnt(5, 1, 0, "ant" + (_parent[totalAnts] + 1), 10, 100, 0.5, 0.4);
}
}
};
var btns_sound = new Sound();
btns_sound.loadSound("sound/btns_sound5.mp3", false);
btns_sound.setVolume(30);
var totalFood = 5;
feedBtn.onRelease = function () {
btns_sound.start();
if (totalFood > 0) {
eval ("pellet" + totalFood).gotoAndStop(2);
totalFood = totalFood - 1;
_root.feedAnts();
}
};
this.soundBtn.soundTxt.text = "MUSIC OFF";
var formatOver = new TextFormat();
formatOver.color = 16777011 /* 0xFFFF33 */;
var formatOut = new TextFormat();
formatOut.color = 16777215 /* 0xFFFFFF */;
var game_sound = new Sound();
game_sound.onLoad = function (success) {
if (success) {
game_sound.start();
}
};
game_sound.loadSound("sound/music1.mp3", false);
game_sound.onSoundComplete = function () {
game_sound.start();
};
game_sound.setVolume(50);
soundBtn.onRelease = function () {
btns_sound.start();
if (this.soundTxt.text == "MUSIC ON") {
this.soundTxt.text = "MUSIC OFF";
this.soundTxt.setTextFormat(formatOver);
game_sound.start();
game_sound.setVolume(50);
} else {
this.soundTxt.text = "MUSIC ON";
this.soundTxt.setTextFormat(formatOver);
game_sound.stop();
}
};
soundBtn.onRollOver = function () {
this.soundTxt.setTextFormat(formatOver);
};
soundBtn.onRollOut = function () {
this.soundTxt.setTextFormat(formatOut);
};
soundBtn.onReleaseOutside = function () {
this.soundTxt.setTextFormat(formatOut);
};
stop();
Symbol 148 MovieClip [foodPellet] Frame 1
#initclip 10
Object.registerClass("foodPellet", Food);
#endinitclip
Symbol 148 MovieClip [foodPellet] Frame 4
stop();
Symbol 148 MovieClip [foodPellet] Frame 7
stop();
Symbol 158 MovieClip [powerup] Frame 9
stop();
removeMovieClip(this);
Symbol 174 MovieClip [antInfoPanel] Frame 1
var currentAnt;
textChangingBg._visible = false;
this.onEnterFrame = function () {
if (currentAnt) {
hungerMeter.handle._x = _parent[currentAnt].appetite;
} else {
hungerMeter.handle._x = 0;
}
ant_age.text = _parent[currentAnt].age;
};
antNameText.onChanged = function () {
_parent[currentAnt].customName = this.text;
trace(_parent[currentAnt].customName);
};
antNameText.onSetFocus = function () {
textChangingBg._visible = true;
antNameText.textColor = 16737792 /* 0xFF6600 */;
if (_parent.antInfoPanel_intervalId != null) {
clearInterval(_parent.antInfoPanel_intervalId);
}
};
antNameText.onKillFocus = function () {
textChangingBg._visible = false;
antNameText.textColor = 0;
if (_parent.antInfoPanel_intervalId != null) {
clearInterval(_parent.antInfoPanel_intervalId);
}
_parent.startInfoPanelHide();
};
Symbol 183 MovieClip [__Packages.mx.transitions.OnEnterFrameBeacon] Frame 0
class mx.transitions.OnEnterFrameBeacon
{
function OnEnterFrameBeacon () {
}
static function init() {
var _local4 = _global.MovieClip;
if (!_root.__OnEnterFrameBeacon) {
mx.transitions.BroadcasterMX.initialize(_local4);
var _local3 = _root.createEmptyMovieClip("__OnEnterFrameBeacon", 9876);
_local3.onEnterFrame = function () {
_global.MovieClip.broadcastMessage("onEnterFrame");
};
}
}
static var version = "1.1.0.52";
}
Symbol 184 MovieClip [__Packages.mx.transitions.BroadcasterMX] Frame 0
class mx.transitions.BroadcasterMX
{
var _listeners;
function BroadcasterMX () {
}
static function initialize(o, dontCreateArray) {
if (o.broadcastMessage != undefined) {
delete o.broadcastMessage;
}
o.addListener = mx.transitions.BroadcasterMX.prototype.addListener;
o.removeListener = mx.transitions.BroadcasterMX.prototype.removeListener;
if (!dontCreateArray) {
o._listeners = new Array();
}
}
function addListener(o) {
removeListener(o);
if (broadcastMessage == undefined) {
broadcastMessage = mx.transitions.BroadcasterMX.prototype.broadcastMessage;
}
return(_listeners.push(o));
}
function removeListener(o) {
var _local2 = _listeners;
var _local3 = _local2.length;
while (_local3--) {
if (_local2[_local3] == o) {
_local2.splice(_local3, 1);
if (!_local2.length) {
broadcastMessage = undefined;
}
return(true);
}
}
return(false);
}
function broadcastMessage() {
var _local5 = String(arguments.shift());
var _local4 = _listeners.concat();
var _local6 = _local4.length;
var _local3 = 0;
while (_local3 < _local6) {
_local4[_local3][_local5].apply(_local4[_local3], arguments);
_local3++;
}
}
static var version = "1.1.0.52";
}
Symbol 185 MovieClip [__Packages.mx.transitions.Tween] Frame 0
class mx.transitions.Tween
{
var obj, prop, begin, useSeconds, _listeners, addListener, prevTime, _time, looping, _duration, broadcastMessage, isPlaying, _fps, prevPos, _pos, change, _intervalID, _startTime;
function Tween (obj, prop, func, begin, finish, duration, useSeconds) {
mx.transitions.OnEnterFrameBeacon.init();
if (!arguments.length) {
return;
}
this.obj = obj;
this.prop = prop;
this.begin = begin;
position = (begin);
this.duration = (duration);
this.useSeconds = useSeconds;
if (func) {
this.func = func;
}
this.finish = (finish);
_listeners = [];
addListener(this);
start();
}
function set time(t) {
prevTime = _time;
if (t > duration) {
if (looping) {
rewind(t - _duration);
update();
broadcastMessage("onMotionLooped", this);
} else {
if (useSeconds) {
_time = _duration;
update();
}
stop();
broadcastMessage("onMotionFinished", this);
}
} else if (t < 0) {
rewind();
update();
} else {
_time = t;
update();
}
//return(time);
}
function get time() {
return(_time);
}
function set duration(d) {
_duration = (((d == null) || (d <= 0)) ? (_global.Infinity) : (d));
//return(duration);
}
function get duration() {
return(_duration);
}
function set FPS(fps) {
var _local2 = isPlaying;
stopEnterFrame();
_fps = fps;
if (_local2) {
startEnterFrame();
}
//return(FPS);
}
function get FPS() {
return(_fps);
}
function set position(p) {
setPosition(p);
//return(position);
}
function setPosition(p) {
prevPos = _pos;
obj[prop] = (_pos = p);
broadcastMessage("onMotionChanged", this, _pos);
updateAfterEvent();
}
function get position() {
return(getPosition());
}
function getPosition(t) {
if (t == undefined) {
t = _time;
}
return(func(t, begin, change, _duration));
}
function set finish(f) {
change = f - begin;
//return(finish);
}
function get finish() {
return(begin + change);
}
function continueTo(finish, duration) {
begin = position;
this.finish = (finish);
if (duration != undefined) {
this.duration = (duration);
}
start();
}
function yoyo() {
continueTo(begin, time);
}
function startEnterFrame() {
if (_fps == undefined) {
_global.MovieClip.addListener(this);
} else {
_intervalID = setInterval(this, "onEnterFrame", 1000 / _fps);
}
isPlaying = true;
}
function stopEnterFrame() {
if (_fps == undefined) {
_global.MovieClip.removeListener(this);
} else {
clearInterval(_intervalID);
}
isPlaying = false;
}
function start() {
rewind();
startEnterFrame();
broadcastMessage("onMotionStarted", this);
}
function stop() {
stopEnterFrame();
broadcastMessage("onMotionStopped", this);
}
function resume() {
fixTime();
startEnterFrame();
broadcastMessage("onMotionResumed", this);
}
function rewind(t) {
_time = ((t == undefined) ? 0 : (t));
fixTime();
update();
}
function fforward() {
time = (_duration);
fixTime();
}
function nextFrame() {
if (useSeconds) {
time = ((getTimer() - _startTime) / 1000);
} else {
time = (_time + 1);
}
}
function onEnterFrame() {
nextFrame();
}
function prevFrame() {
if (!useSeconds) {
time = (_time - 1);
}
}
function toString() {
return("[Tween]");
}
function fixTime() {
if (useSeconds) {
_startTime = getTimer() - (_time * 1000);
}
}
function update() {
position = (getPosition(_time));
}
static var version = "1.1.0.52";
static var __initBeacon = mx.transitions.OnEnterFrameBeacon.init();
static var __initBroadcaster = mx.transitions.BroadcasterMX.initialize(mx.transitions.Tween.prototype, true);
function func(t, b, c, d) {
return(((c * t) / d) + b);
}
}
Symbol 186 MovieClip [__Packages.Tile] Frame 0
class Tile extends MovieClip
{
var currentlyDigging, _currentframe, walkable, diggable;
function Tile () {
super();
currentlyDigging = "none";
}
function checkWalkable() {
var _local2 = 0;
while (_local2 < allNonWalkable.length) {
if (_currentframe == allNonWalkable[_local2]) {
walkable = false;
}
_local2++;
}
_local2 = 0;
while (_local2 < allWalkable.length) {
if (_currentframe == allWalkable[_local2]) {
walkable = true;
}
_local2++;
}
}
function checkDiggable() {
var _local2 = 0;
while (_local2 < allNonDiggable.length) {
if (_currentframe == allNonDiggable[_local2]) {
diggable = false;
}
_local2++;
}
_local2 = 0;
while (_local2 < allDiggable.length) {
if (_currentframe == allDiggable[_local2]) {
diggable = true;
}
_local2++;
}
}
var allNonWalkable = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23];
var allWalkable = [13];
var allDiggable = [1, 2, 3, 4, 11, 12];
var allNonDiggable = [5, 6, 7, 8, 9, 10, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23];
}
Symbol 187 MovieClip [__Packages.Game] Frame 0
class Game extends Tile
{
var mapWidth, thisMap, mapHeight, tileW, tileH;
function Game () {
super();
}
function buildMap(where) {
mapWidth = thisMap[0].length;
mapHeight = thisMap.length;
var i = 0;
while (i < mapHeight) {
var j = 0;
while (j < mapWidth) {
var tileName = ((("t_" + i) + "_") + j);
where.attachMovie("Tile", tileName, where.getNextHighestDepth());
eval (tileName)._x = j * tileW;
eval (tileName)._y = i * tileH;
eval (tileName).gotoAndStop(thisMap[i][j]);
eval (tileName).checkWalkable();
eval (tileName).checkDiggable();
j++;
}
i++;
}
where.attachMovie("gradientOverlay", "gradientOverlay", where.getNextHighestDepth());
}
}
Symbol 188 MovieClip [__Packages.Food] Frame 0
class Food extends MovieClip
{
var currentlife, xtile, ytile, tileW, tileH, eaten, _x, _y, targetTileY, onEnterFrame, _currentframe, eaten_intervalId, gotoAndStop, mold_intervalId, removeme_intervalId, removeMovieClip, myName, _parent;
function Food () {
super();
currentlife = 4;
xtile = 1;
ytile = 1;
tileW = 20;
tileH = 20;
eaten = false;
_x = xtile * tileW;
_y = ytile * tileH;
dropIn();
growMoldy();
}
function dropIn() {
targetTileY = targetTileY + ytile;
_x = xtile * tileW;
onEnterFrame = function () {
this.nextTile = (("t_" + (this.ytile + 1)) + "_") + this.xtile;
if ((this.ytile != this.targetTileY) && (this.targetTileY <= 34)) {
if (this._parent[this.nextTile].walkable != false) {
this._y = this._y + (0.25 * this.tileH);
this.ytile = this.ytile + 0.25;
}
}
var _local2 = 1;
while (_local2 <= this._parent.totalAntsNo) {
if ((((this._parent["ant" + _local2].xtile == this.xtile) && (this._parent["ant" + _local2].ytile == this.ytile)) && (this.eaten == false)) && (this._parent["ant" + _local2].moveDir != 0)) {
if (this._parent["ant" + _local2].actionState != 3) {
this._parent["ant" + _local2].eatFood();
this.eaten = true;
delete this.onEnterFrame;
this.gotoAndStop(5);
if (this.eaten_intervalId != null) {
clearInterval(this.eaten_intervalId);
}
this.eaten_intervalId = setInterval(this, "getEaten", 300);
this._parent.attachMovie("powerup", "powerup" + this.myName, this._parent.getNextHighestDepth());
this._parent["powerup" + this.myName]._x = this.xtile * this.tileW;
this._parent["powerup" + this.myName]._y = this.ytile * this.tileH;
}
}
_local2++;
}
};
}
function getEaten() {
if (_currentframe == 7) {
removeFood();
clearInterval(eaten_intervalId);
} else {
gotoAndStop(_currentframe + 1);
}
}
function growMoldy() {
if (mold_intervalId != null) {
clearInterval(mold_intervalId);
}
mold_intervalId = setInterval(this, "getMoldy", 5000);
}
function removeFood() {
if (removeme_intervalId != null) {
clearInterval(removeme_intervalId);
}
removeMovieClip();
}
function getMoldy() {
if (currentlife == 0) {
clearInterval(mold_intervalId);
var _local3 = new mx.transitions.Tween(this, "_alpha", mx.transitions.easing.Regular.easeOut, 100, 0, 30, false);
removeme_intervalId = setInterval(this, "removeFood", 700);
} else if (currentlife == 3) {
currentlife--;
var _local2 = new Color(_parent[myName]);
_local2.setTransform({ra:51, ga:153});
} else if (currentlife == 2) {
currentlife--;
var _local2 = new Color(_parent[myName]);
_local2.setTransform({ra:51, ga:100});
} else if (currentlife == 1) {
currentlife--;
var _local2 = new Color(_parent[myName]);
_local2.setTransform({ra:51, ga:50});
} else {
currentlife--;
}
}
}
Symbol 189 MovieClip [__Packages.mx.transitions.easing.Regular] Frame 0
class mx.transitions.easing.Regular
{
function Regular () {
}
static function easeIn(t, b, c, d) {
t = t / d;
return(((c * t) * t) + b);
}
static function easeOut(t, b, c, d) {
t = t / d;
return((((-c) * t) * (t - 2)) + b);
}
static function easeInOut(t, b, c, d) {
t = t / (d / 2);
if (t < 1) {
return((((c / 2) * t) * t) + b);
}
t--;
return((((-c) / 2) * ((t * (t - 2)) - 1)) + b);
}
static var version = "1.1.0.52";
}
Symbol 190 MovieClip [__Packages.Ant] Frame 0
class Ant extends MovieClip
{
var age, appetite, decisionMod, moveDir, moveRate, maxAge, ageRate, gender, digCapacity, antRestAmount, xtile, ytile, tileW, tileH, _x, _y, dying_sound, digging_sound, eating_sound, hunger_intervalId, myName, _parent, getNextHighestDepth, dyingWarningFadeIn, dyingWarningFadeOut, grow_intervalId, onEnterFrame, rest_intervalId, dig_intervalId, removeMovieClip, gotoAndStop, anteaten_intervalId, nextTile;
function Ant () {
super();
age = 1;
appetite = 0;
decisionMod = 0.4;
moveDir = 5;
moveRate = 0.25;
maxAge = 1;
ageRate = 20000;
gender = 0;
digCapacity = 30;
antRestAmount = 1000;
xtile = 0;
ytile = 1;
tileW = 20;
tileH = 20;
_x = xtile * tileW;
_y = ytile * tileH;
growOlder();
getHungry();
doAI();
dying_sound = new Sound();
digging_sound = new Sound();
eating_sound = new Sound();
dying_sound.loadSound("sound/dying_voice.mp3", false);
digging_sound.loadSound("sound/digging.mp3", false);
eating_sound.loadSound("sound/eating2.mp3", false);
digging_sound.setVolume(75);
dying_sound.setVolume(30);
}
function increaseAppetite() {
if (appetite >= 100) {
if ((actionState != 3) || (actionState != 4)) {
actionState = 5;
clearInterval(hunger_intervalId);
die();
}
} else if (appetite >= 80) {
appetite = appetite + 2;
if (warningOn == false) {
if (!_parent[myName].messageHolder.dyingWarning) {
warningOn = true;
_parent[myName].createEmptyMovieClip("messageHolder", getNextHighestDepth());
_parent[myName].messageHolder.attachMovie("dyingWarning", "dyingWarning", getNextHighestDepth());
_parent[myName].messageHolder.dyingWarning._alpha = 0;
dyingWarningFadeIn = new mx.transitions.Tween(_parent[myName].messageHolder.dyingWarning, "_alpha", mx.transitions.easing.Regular.easeOut, 0, 100, 8, false);
} else {
warningOn = true;
dyingWarningFadeIn = new mx.transitions.Tween(_parent[myName].messageHolder.dyingWarning, "_alpha", mx.transitions.easing.Regular.easeOut, 0, 100, 8, false);
}
}
} else if (warningOn == true) {
dyingWarningFadeOut = new mx.transitions.Tween(_parent[myName].messageHolder.dyingWarning, "_alpha", mx.transitions.easing.Regular.easeOut, 100, 0, 8, false);
warningOn = false;
appetite = appetite + 2;
}
appetite = appetite + 2;
}
function reduceAppetite() {
if (appetite >= 6) {
appetite = appetite - 6;
} else {
appetite = 0;
}
}
function ageYear() {
if (age >= maxAge) {
if ((actionState != 3) || (actionState != 4)) {
actionState = 5;
clearInterval(grow_intervalId);
die();
}
} else {
age++;
}
}
function getHungry() {
if (hunger_intervalId != null) {
clearInterval(hunger_intervalId);
}
hunger_intervalId = setInterval(this, "increaseAppetite", 5000);
}
function growOlder() {
if (grow_intervalId != null) {
clearInterval(grow_intervalId);
}
grow_intervalId = setInterval(this, "ageYear", ageRate);
}
function die() {
if (actionState == 5) {
dying_sound.start();
delete onEnterFrame;
if (rest_intervalId) {
clearInterval(rest_intervalId);
}
if (grow_intervalId != null) {
clearInterval(grow_intervalId);
}
if (dig_intervalId != null) {
clearInterval(dig_intervalId);
}
if (this["dyingWarning" + this]) {
removeMovieClip();
}
_parent.totalAntsNo = _parent.totalAntsNo - 1;
var _local3 = _y;
var _local2 = _y - 40;
gotoAndStop(9);
var _local4 = new mx.transitions.Tween(this, "_alpha", mx.transitions.easing.Regular.easeOut, 100, 0, 30, false);
var _local5 = new mx.transitions.Tween(this, "_y", mx.transitions.easing.Regular.easeOut, _local3, _local2, 30, false);
this[_local4].onMotionFinished = function () {
delete this._parent[this.myName];
this._parent[this.myName].removeMovieClip();
};
}
}
function jumpToLocation(antDestX, antDestY) {
xtile = antDestX;
ytile = antDestY;
_x = antDestX * tileW;
_y = antDestY * tileH;
}
function doAI() {
if (rest_intervalId) {
clearInterval(rest_intervalId);
}
if (anteaten_intervalId != null) {
clearInterval(anteaten_intervalId);
}
var _local2 = Math.round(Math.random() + decisionMod);
if (actionState == 5) {
trace(("cannot doAI, " + this) + " is dead");
} else {
switch (_local2) {
case 0 :
rest();
actionState = 0;
break;
case 1 :
moveAnt();
actionState = 2;
}
}
}
function rest() {
if (rest_intervalId != null) {
clearInterval(rest_intervalId);
}
this["i" + moveDir].gotoAndStop(1);
rest_intervalId = setInterval(this, "doAI", antRestAmount);
delete onEnterFrame;
}
function moveAnt() {
var targetTileX = (1 + Math.floor(Math.random() * 3));
var targetTileY = (1 + Math.floor(Math.random() * 3));
moveDir = 0 + Math.floor(Math.random() * 4);
switch (moveDir) {
case 0 :
targetTileY = ytile - targetTileY;
onEnterFrame = function () {
this.nextTile = (("t_" + (this.ytile - 1)) + "_") + this.xtile;
if ((this.ytile != targetTileY) && (targetTileY >= 0)) {
if (this._parent[this.nextTile].walkable != false) {
this.gotoAndStop(1);
this._y = this._y - (this.moveRate * this.tileH);
this.ytile = this.ytile - this.moveRate;
} else {
delete this.onEnterFrame;
if (this._parent[this.nextTile].diggable != false) {
this.checkDig();
} else {
this.doAI();
}
}
} else {
delete this.onEnterFrame;
this.doAI();
}
};
break;
case 1 :
targetTileX = targetTileX + xtile;
onEnterFrame = function () {
this.nextTile = (("t_" + this.ytile) + "_") + (this.xtile + 1);
if ((this.xtile != targetTileX) && (targetTileX <= 34)) {
if (this._parent[this.nextTile].walkable != false) {
this.gotoAndStop(2);
this._x = this._x + (this.moveRate * this.tileW);
this.xtile = this.xtile + this.moveRate;
} else {
delete this.onEnterFrame;
if (this._parent[this.nextTile].diggable != false) {
this.checkDig();
} else {
this.doAI();
}
}
} else {
delete this.onEnterFrame;
this.doAI();
}
};
break;
case 2 :
targetTileY = targetTileY + ytile;
onEnterFrame = function () {
this.nextTile = (("t_" + (this.ytile + 1)) + "_") + this.xtile;
if ((this.ytile != targetTileY) && (targetTileY <= 34)) {
if (this._parent[this.nextTile].walkable != false) {
this.gotoAndStop(3);
this._y = this._y + (this.moveRate * this.tileH);
this.ytile = this.ytile + this.moveRate;
} else {
delete this.onEnterFrame;
if (this._parent[this.nextTile].diggable != false) {
this.checkDig();
} else {
this.doAI();
}
}
} else {
delete this.onEnterFrame;
this.doAI();
}
};
break;
case 3 :
targetTileX = xtile - targetTileX;
onEnterFrame = function () {
this.nextTile = (("t_" + this.ytile) + "_") + (this.xtile - 1);
if ((this.xtile != targetTileX) && (targetTileX >= 0)) {
if (this._parent[this.nextTile].walkable != false) {
this.gotoAndStop(4);
this._x = this._x - (this.moveRate * this.tileW);
this.xtile = this.xtile - this.moveRate;
} else {
delete this.onEnterFrame;
if (this._parent[this.nextTile].diggable != false) {
this.checkDig();
} else {
this.doAI();
}
}
} else {
delete this.onEnterFrame;
this.doAI();
}
};
}
}
function checkDig() {
var _local2 = Math.round(Math.random() + decisionMod);
if (digCapacity > 0) {
switch (_local2) {
case 0 :
digCapacity--;
actionState = 3;
digTile();
break;
case 1 :
doAI();
}
} else {
trace(this + " dig capacity maxed");
doAI();
}
}
function digTile() {
delete onEnterFrame;
digging_sound.start();
switch (moveDir) {
case 0 :
if (_parent[nextTile].currentlyDigging == "none") {
_parent[nextTile].currentlyDigging = String("digged");
gotoAndStop(5);
if (dig_intervalId != null) {
clearInterval(dig_intervalId);
}
dig_intervalId = setInterval(this, "digUp", 800);
break;
}
doAI();
break;
case 1 :
if (_parent[nextTile].currentlyDigging == "none") {
if (dig_intervalId != null) {
clearInterval(dig_intervalId);
}
_parent[nextTile].currentlyDigging = String("digged");
gotoAndStop(6);
dig_intervalId = setInterval(this, "digRight", 800);
} else {
doAI();
break;
if (_parent[nextTile].currentlyDigging == "none") {
_parent[nextTile].currentlyDigging = String("digged");
gotoAndStop(7);
if (dig_intervalId != null) {
clearInterval(dig_intervalId);
}
dig_intervalId = setInterval(this, "digDown", 800);
delete onEnterFrame;
} else {
doAI();
break;
if (_parent[nextTile].currentlyDigging == "none") {
_parent[nextTile].currentlyDigging = String("digged");
gotoAndStop(8);
if (dig_intervalId != null) {
clearInterval(dig_intervalId);
}
dig_intervalId = setInterval(this, "digLeft", 800);
delete onEnterFrame;
} else {
doAI();
}
}
}
case 2 :
if (_parent[nextTile].currentlyDigging == "none") {
_parent[nextTile].currentlyDigging = String("digged");
gotoAndStop(7);
if (dig_intervalId != null) {
clearInterval(dig_intervalId);
}
dig_intervalId = setInterval(this, "digDown", 800);
delete onEnterFrame;
} else {
doAI();
break;
if (_parent[nextTile].currentlyDigging == "none") {
_parent[nextTile].currentlyDigging = String("digged");
gotoAndStop(8);
if (dig_intervalId != null) {
clearInterval(dig_intervalId);
}
dig_intervalId = setInterval(this, "digLeft", 800);
delete onEnterFrame;
} else {
doAI();
}
}
case 3 :
if (_parent[nextTile].currentlyDigging == "none") {
_parent[nextTile].currentlyDigging = String("digged");
gotoAndStop(8);
if (dig_intervalId != null) {
clearInterval(dig_intervalId);
}
dig_intervalId = setInterval(this, "digLeft", 800);
delete onEnterFrame;
} else {
doAI();
}
}
}
function digDown() {
if (_parent[nextTile]._currentframe < 24) {
_parent[nextTile].gotoAndStop(24);
} else if (_parent[nextTile]._currentframe < 28) {
_parent[nextTile].gotoAndStop(_parent[nextTile]._currentframe + 1);
var _local3 = _y;
var _local2 = _y;
_local2 = _local2 + (0.25 * tileH);
var _local4 = new mx.transitions.Tween(this, "_y", mx.transitions.easing.Regular.easeOut, _local3, _local2, 2, false);
} else {
clearInterval(dig_intervalId);
_parent[nextTile].walkable = true;
ytile = ytile + 1;
doAI();
}
}
function digLeft() {
if (_parent[nextTile]._currentframe < 29) {
_parent[nextTile].gotoAndStop(29);
} else if (_parent[nextTile]._currentframe < 33) {
_parent[nextTile].gotoAndStop(_parent[nextTile]._currentframe + 1);
var _local3 = _x;
var _local2 = _x;
_local2 = _local2 - (0.25 * tileW);
var _local4 = new mx.transitions.Tween(this, "_x", mx.transitions.easing.Regular.easeOut, _local3, _local2, 2, false);
} else {
clearInterval(dig_intervalId);
_parent[nextTile].walkable = true;
xtile = xtile - 1;
doAI();
}
}
function digUp() {
if (_parent[nextTile]._currentframe < 34) {
_parent[nextTile].gotoAndStop(34);
} else if (_parent[nextTile]._currentframe < 38) {
_parent[nextTile].gotoAndStop(_parent[nextTile]._currentframe + 1);
var _local3 = _y;
var _local2 = _y;
_local2 = _local2 - (0.25 * tileH);
var _local4 = new mx.transitions.Tween(this, "_y", mx.transitions.easing.Regular.easeOut, _local3, _local2, 2, false);
} else {
clearInterval(dig_intervalId);
ytile = ytile - 1;
_parent[nextTile].walkable = true;
doAI();
}
}
function digRight() {
if (_parent[nextTile]._currentframe < 39) {
_parent[nextTile].gotoAndStop(39);
} else if (_parent[nextTile]._currentframe < 43) {
_parent[nextTile].gotoAndStop(_parent[nextTile]._currentframe + 1);
var _local3 = _x;
var _local2 = _x;
_local2 = _local2 + (0.25 * tileW);
var _local4 = new mx.transitions.Tween(this, "_x", mx.transitions.easing.Regular.easeOut, _local3, _local2, 2, false);
} else {
clearInterval(dig_intervalId);
_parent[nextTile].walkable = true;
xtile = xtile + 1;
doAI();
}
}
function eatFood() {
if (rest_intervalId) {
clearInterval(rest_intervalId);
}
if (dig_intervalId != null) {
clearInterval(dig_intervalId);
}
if (anteaten_intervalId != null) {
clearInterval(anteaten_intervalId);
}
delete onEnterFrame;
if (appetite > 0) {
reduceAppetite();
}
actionState = 4;
eating_sound.start();
gotoAndStop(10);
anteaten_intervalId = setInterval(this, "finishEating", 1000);
}
function finishEating() {
clearInterval(anteaten_intervalId);
doAI();
}
var customName = "Name This Ant";
var warningOn = false;
var actionState = 0;
}