STORY LOOP FURRY PORN GAMES C SERVICES [?] [R] RND POPULAR | Archived flashes: 229595 |
/disc/ · /res/ — /show/ · /fap/ · /gg/ · /swf/ | P0001 · P2595 · P5190 |
This is the info page for Flash #58904 |
# |
Immunity |
Power |
Power: |
5 |
Spawn Time: |
60 |
60 |
5 |
Frequency: |
10 |
Restart |
x close |
NEXT |
Welcome To BioTank! |
If this is your first visit, please take the time to familiarize yourself with the controls and the simulation in general By clicking NEXT. Otherwise, feel free to click the close button at the bottom left hand corner of this window. |
Lets get started |
You're probably wondering exactly what BioTank is. BioTank isn't your average intense shooter or brain-racking puzzler. If that's what you're after, go find it elsewhere. BioTank is a simulation game of simplistic single-celled organisms that live out their very short lives trying to find food and fight off enemies. |
The basics |
There will be 9 species to start off, although a few of those will die off shortly and a decent number more will be born. It is probably best that you watch for the first little while or else you might end up killing all the poor little things off. If they all die, you can restart by hitting the restart button at the bottom. |
This is a cell. These form the main main show. |
This is food. The cells need to eat or they'll die off. You can regulate the food supply at the bottom |
This is an enemy. The cells will enter skirmishes with any nearby enemies. The one with the higher power will usually win. The average power and amount of enemies can be regulated at the bottom |
This signifies a disease. If they are not yet immune the the disease, it can easily wipe entire species off the face of the planet. Control the power of the disease and the likelihood that food will be infected at the bottom. |
If you wish to place any of the above on the play field, simply click the colored logo at the bottom then click anywhere on the field to place it. |
Watch them grow |
Every time a new cell is born, it inherits the traits of it's parents plus a little randomization. Following the theory of evolution and the laws of natual selection, the weak cells die off and the stong ones pass their traits on to thier offspring. Thus, the cells evolve and adapt ...to an extent. What are you waiting for? Go play! |
ActionScript [AS3]
Section 1//instructions_9 (cells_fla.instructions_9) package cells_fla { import flash.display.*; public dynamic class instructions_9 extends MovieClip { public var next:SimpleButton; public var close:SimpleButton; public function instructions_9(){ addFrameScript(0, frame1); } function frame1(){ stop(); } } }//package cells_flaSection 2//MainTimeline (cells_fla.MainTimeline) package cells_fla { import flash.events.*; import flash.display.*; import flash.text.*; import adobe.utils.*; import flash.accessibility.*; import flash.errors.*; import flash.external.*; import flash.filters.*; import flash.geom.*; import flash.media.*; import flash.net.*; import flash.printing.*; import flash.system.*; import flash.ui.*; import flash.utils.*; import flash.xml.*; public dynamic class MainTimeline extends MovieClip { public var tempRed:Number; public var seperationVector:Object; public var foodSpawnTime:Number; public var targetVector:Object; public var sn:Number; public var predators:Array; public var tempBlue:Number; public var predatorPower:Number; public var i:Number; public var j:Number; public var k:Number; public var m:Number; public var n:Number; public var l:Number; public var bioHazards:Array; public var headings:MovieClip; public var dropMC:MovieClip; public var tempSpeed:Number; public var bioPower:Number; public var wingmates:Number; public var alignmentVectr:Object; public var cellDisplay:MovieClip; public var tempNum:Number; public var gui:MovieClip; public var bioFrequency:Number; public var cells:Array; public var cohesionVector:Object; public var lc:Number; public var tempGreen:Number; public var instructions:MovieClip; public var predatorSpawnTime:Number; public var foods:Array; public var tempSize:Number; public function MainTimeline(){ addFrameScript(0, frame1); } public function restart(_arg1:MouseEvent){ i = 0; while (i < 15) { cellDisplay.countTexts[i].text = ""; cellDisplay.powerTexts[i].text = ""; cellDisplay.immuneTexts[i].text = ""; i++; }; predatorPower = 0; bioPower = 5; predatorSpawnTime = 60; foodSpawnTime = 20; bioFrequency = 15; stage.removeChild(dropMC); dropMC = new MovieClip(); stage.addChild(dropMC); i = 0; while (i < cells.length) { j = 0; while (j < cells[i].length) { removeChild(cells[i][j]); j++; }; i++; }; cells = new Array(); i = 0; while (i < foods.length) { removeChild(foods[i]); i++; }; foods = new Array(); i = 0; while (i < bioHazards.length) { removeChild(bioHazards[i]); i++; }; bioHazards = new Array(); i = 0; while (i < predators.length) { removeChild(predators[i]); i++; }; predators = new Array(); makeSwarm(100, 100); makeSwarm(100, 300); makeSwarm(100, 500); makeSwarm(300, 100); makeSwarm(300, 300); makeSwarm(300, 500); makeSwarm(500, 100); makeSwarm(500, 300); makeSwarm(500, 500); } public function predatorPowerDown(_arg1:MouseEvent){ if (predatorPower > -4){ predatorPower--; }; } public function bioDrop(_arg1:MouseEvent){ stage.removeChild(dropMC); dropMC = new bioHazard(); dropMC.dropType = "bioHazard"; dropMC.alpha = 0.5; stage.addChild(dropMC); } public function nextInstructions(_arg1:MouseEvent){ instructions.nextFrame(); } public function makeSwarm(_arg1:Number, _arg2:Number){ cells.push(new Array()); sn = (cells.length - 1); tempRed = Math.floor((Math.random() * 200)); tempBlue = Math.floor((Math.random() * 200)); tempGreen = Math.floor((Math.random() * 200)); tempSize = ((Math.random() * 5) + 1); tempSpeed = (Math.random() + 0.2); cells[sn].steer = ((Math.random() * 2) * Math.PI); cells[sn].speed = (2 * tempSpeed); cells[sn].averageHunger = 1; cells[sn].averageX = _arg1; cells[sn].averageY = _arg2; cells[sn].action = "wander"; cells[sn].targetX = _arg1; cells[sn].targetY = _arg2; i = 0; while (i < 10) { addCell(sn, ((_arg1 + (Math.random() * 80)) - 40), ((_arg2 + (Math.random() * 80)) - 40), tempRed, tempGreen, tempBlue, ((Math.random() * 0.4) + 0.4), ((tempSize + Math.random()) - 0.5), ((tempSpeed + (Math.random() * 0.5)) - 0.1), 750, 1500, 2, 1, 5, 5); i++; }; } public function bioPowerUp(_arg1:MouseEvent){ bioPower++; } public function foodDrop(_arg1:MouseEvent){ stage.removeChild(dropMC); dropMC = new food(); dropMC.dropType = "food"; dropMC.alpha = 0.5; stage.addChild(dropMC); } function frame1(){ cells = new Array(); foods = new Array(); predators = new Array(); bioPower = 5; bioFrequency = 15; dropMC = new MovieClip(); cellDisplay = new MovieClip(); predatorSpawnTime = 60; foodSpawnTime = 20; predatorPower = 0; bioHazards = new Array(); targetVector = new Object(); seperationVector = new Object(); alignmentVectr = new Object(); cohesionVector = new Object(); stop(); dropMC.dropType = "nothing"; stage.addChild(dropMC); stage.addChild(cellDisplay); cellDisplay.countTexts = new Array(); cellDisplay.deathTexts = new Array(); cellDisplay.birthTexts = new Array(); cellDisplay.stomachTexts = new Array(); cellDisplay.speedTexts = new Array(); cellDisplay.powerTexts = new Array(); cellDisplay.immuneTexts = new Array(); cellDisplay.addChild(headings); cellDisplay.addChild(gui); gui.predatorPowerUp.addEventListener(MouseEvent.MOUSE_DOWN, predatorPowerUp); gui.predatorPowerDown.addEventListener(MouseEvent.MOUSE_DOWN, predatorPowerDown); gui.predatorSpawnUp.addEventListener(MouseEvent.MOUSE_DOWN, predatorSpawnUp); gui.predatorSpawnDown.addEventListener(MouseEvent.MOUSE_DOWN, predatorSpawnDown); gui.foodSpawnUp.addEventListener(MouseEvent.MOUSE_DOWN, foodSpawnUp); gui.foodSpawnDown.addEventListener(MouseEvent.MOUSE_DOWN, foodSpawnDown); gui.bioPowerUp.addEventListener(MouseEvent.MOUSE_DOWN, bioPowerUp); gui.bioPowerDown.addEventListener(MouseEvent.MOUSE_DOWN, bioPowerDown); gui.bioFrequencyUp.addEventListener(MouseEvent.MOUSE_DOWN, bioFrequencyUp); gui.bioFrequencyDown.addEventListener(MouseEvent.MOUSE_DOWN, bioFrequencyDown); gui.foodDrop.addEventListener(MouseEvent.MOUSE_DOWN, foodDrop); gui.predatorDrop.addEventListener(MouseEvent.MOUSE_DOWN, predatorDrop); gui.bioDrop.addEventListener(MouseEvent.MOUSE_DOWN, bioDrop); gui.restart.addEventListener(MouseEvent.MOUSE_DOWN, restart); instructions.close.addEventListener(MouseEvent.MOUSE_DOWN, closeInstructions); instructions.next.addEventListener(MouseEvent.MOUSE_DOWN, nextInstructions); stage.addEventListener(MouseEvent.MOUSE_DOWN, clicky); stage.addChild(instructions); i = 0; while (i < 15) { cellDisplay.countTexts[i] = new TextField(); cellDisplay.countTexts[i].text = ""; cellDisplay.countTexts[i].x = 645; cellDisplay.countTexts[i].y = ((i * 40) + 30); cellDisplay.countTexts[i].selectable = false; cellDisplay.addChild(cellDisplay.countTexts[i]); cellDisplay.powerTexts[i] = new TextField(); cellDisplay.powerTexts[i].text = ""; cellDisplay.powerTexts[i].x = 730; cellDisplay.powerTexts[i].y = ((i * 40) + 30); cellDisplay.powerTexts[i].selectable = false; cellDisplay.addChild(cellDisplay.powerTexts[i]); cellDisplay.immuneTexts[i] = new TextField(); cellDisplay.immuneTexts[i].text = ""; cellDisplay.immuneTexts[i].x = 680; cellDisplay.immuneTexts[i].y = ((i * 40) + 30); cellDisplay.immuneTexts[i].selectable = false; cellDisplay.addChild(cellDisplay.immuneTexts[i]); i++; }; stage.addEventListener(Event.ENTER_FRAME, go); makeSwarm(100, 100); makeSwarm(100, 300); makeSwarm(100, 500); makeSwarm(300, 100); makeSwarm(300, 300); makeSwarm(300, 500); makeSwarm(500, 100); makeSwarm(500, 300); makeSwarm(500, 500); } public function predatorSpawnUp(_arg1:MouseEvent){ predatorSpawnTime++; } public function predatorDrop(_arg1:MouseEvent){ stage.removeChild(dropMC); dropMC = new predator(); dropMC.dropType = "predator"; dropMC.alpha = 0.5; stage.addChild(dropMC); } public function addFood(_arg1:Number, _arg2:Number){ foods.push(new food()); lc = (foods.length - 1); foods[lc].x = _arg1; foods[lc].y = _arg2; foods[lc].food = 3500; if (Math.floor((Math.random() * (100 / bioFrequency))) == 0){ foods[lc].infected = true; } else { foods[lc].infected = false; }; addChildAt(foods[lc], 0); } public function addPredator(_arg1:Number, _arg2:Number, _arg3:Number){ predators.push(new predator()); lc = (predators.length - 1); predators[lc].x = _arg1; predators[lc].y = _arg2; predators[lc].power = _arg3; predators[lc].health = ((Math.random() * 30) + 40); predators[lc].rot = ((Math.random() * 2) * Math.PI); predators[lc].targetSwarm = 0; addChild(predators[lc]); } public function go(_arg1:Event){ if (cells.length > 0){ if (Math.floor((Math.random() * foodSpawnTime)) == 0){ addFood((Math.random() * 600), (Math.random() * 500)); }; if (Math.floor((Math.random() * predatorSpawnTime)) == 0){ addPredator((Math.random() * 600), (Math.random() * 500), ((Math.random() * 5) + predatorPower)); }; gui.predatorPowerText.text = String((predatorPower + 4)); gui.foodSpawn.text = String(foodSpawnTime); gui.predatorSpawn.text = String(predatorSpawnTime); gui.bioFrequencyText.text = String(bioFrequency); gui.bioPowerText.text = String(bioPower); i = 0; for (;i < bioHazards.length;i++) { bioHazards[i].alpha = (bioHazards[i].alpha - 0.02); if (bioHazards[i].alpha <= 0){ removeChild(bioHazards[i]); bioHazards.splice(i, 1); i--; continue; }; }; i = 0; while (i < predators.length) { if (predators[i].health <= 0){ j = 0; while (j < cells.length) { if ((((cells[j].action == "attack")) && ((cells[j].attackTarget == i)))){ cells[j].action = "wander"; cells[j].targetX = cells[j].averageX; cells[j].targetY = cells[j].averageY; } else { if ((((cells[j].action == "attack")) && ((cells[j].attackTarget > i)))){ cells[j].attackTarget--; }; }; j++; }; removeChild(predators[i]); predators.splice(i, 1); i--; } else { tempNum = 600; j = 0; while (j < cells.length) { if (pytha((predators[i].x - cells[j].averageX), (predators[i].y - cells[j].averageY)) < tempNum){ predators[i].targetSwarm = j; tempNum = pytha((predators[i].x - cells[j].averageX), (predators[i].y - cells[j].averageY)); }; j++; }; targetVector.ux = ((cells[predators[i].targetSwarm].averageX - predators[i].x) / tempNum); targetVector.uy = ((cells[predators[i].targetSwarm].averageY - predators[i].y) / tempNum); predators[i].rot = Math.atan2(targetVector.uy, targetVector.ux); predators[i].x = (predators[i].x + targetVector.ux); predators[i].y = (predators[i].y + targetVector.uy); }; i++; }; cellDisplay.graphics.clear(); cellDisplay.graphics.beginFill(0xDDDDDD); cellDisplay.graphics.drawRect(600, 0, 300, 500); cellDisplay.graphics.endFill(); cellDisplay.graphics.beginFill(0xDDDDDD); cellDisplay.graphics.drawRect(0, 500, 900, 100); cellDisplay.graphics.endFill(); i = 0; while (i < cells.length) { if (cells[i].length == 0){ cellDisplay.countTexts[(cells.length - 1)].text = ""; cellDisplay.powerTexts[(cells.length - 1)].text = ""; cellDisplay.immuneTexts[(cells.length - 1)].text = ""; cells.splice(i, 1); i--; } else { cells[i].happiness = (1.5 * (cells[i].averageHunger - 0.2)); if (cells[i].happiness > 1){ cells[i].happiness = 1; } else { if (cells[i].happiness < 0){ cells[i].happiness = 0; }; }; cellDisplay.graphics.beginFill((((cells[i][0].red * 65536) + (cells[i][0].green * 0x0100)) + cells[i][0].blue), 0.6); cellDisplay.graphics.lineStyle(2, (((cells[i][0].red * 65536) + (cells[i][0].green * 0x0100)) + cells[i][0].blue)); cellDisplay.graphics.drawCircle(625, ((i * 40) + 40), cells[i][0].rad); cellDisplay.graphics.endFill(); cellDisplay.countTexts[i].text = String(cells[i].length); cellDisplay.powerTexts[i].text = String((Math.floor((cells[i].averagePower * 10)) / 10)); cellDisplay.immuneTexts[i].text = String((Math.floor((cells[i].averageImmunity * 10)) / 10)); cellDisplay.graphics.lineStyle(1); cellDisplay.graphics.beginFill(0xFFFF00); cellDisplay.graphics.drawCircle(785, ((i * 40) + 40), 7.5); cellDisplay.graphics.moveTo(782.5, ((i * 40) + 36)); cellDisplay.graphics.lineTo(782.5, ((i * 40) + 39)); cellDisplay.graphics.moveTo(787.5, ((i * 40) + 36)); cellDisplay.graphics.lineTo(787.5, ((i * 40) + 39)); cellDisplay.graphics.moveTo(780, ((i * 40) + 42.5)); cellDisplay.graphics.curveTo(785, (((i * 40) + 38) + (9 * cells[i].happiness)), 790, ((i * 40) + 42.5)); cellDisplay.graphics.endFill(); if (cells[i].action == "wander"){ if ((((cells[i].averageHunger < 0.65)) && ((foods.length >= 1)))){ cells[i].action = "feed"; tempNum = 600; cells[i].foodTarget = 0; j = 0; while (j < foods.length) { if (pytha((foods[j].x - cells[i].averageX), (foods[j].y - cells[i].averageY)) < tempNum){ tempNum = pytha((foods[j].x - cells[i].averageX), (foods[j].y - cells[i].averageY)); cells[i].foodTarget = j; }; j++; }; }; cells[i].steer = (cells[i].steer + ((Math.random() * 0.25) - 0.125)); cells[i].targetX = (cells[i].targetX + ((cells[i][0].speed * 2) * Math.cos(cells[i].steer))); cells[i].targetY = (cells[i].targetY + ((cells[i][0].speed * 2) * Math.sin(cells[i].steer))); if (cells[i].targetX < 40){ cells[i].steer = 0; } else { if (cells[i].targetX > 560){ cells[i].steer = Math.PI; }; }; if (cells[i].targetY < 40){ cells[i].steer = (Math.PI / 2); } else { if (cells[i].targetY > 460){ cells[i].steer = ((Math.PI * 3) / 2); }; }; } else { if (cells[i].action == "feed"){ if (Math.floor((Math.random() * 10)) == 0){ tempNum = 600; j = 0; while (j < foods.length) { if (pytha((foods[j].x - cells[i].averageX), (foods[j].y - cells[i].averageY)) < tempNum){ tempNum = pytha((foods[j].x - cells[i].averageX), (foods[j].y - cells[i].averageY)); cells[i].foodTarget = j; }; j++; }; }; cells[i].targetX = foods[cells[i].foodTarget].x; cells[i].targetY = foods[cells[i].foodTarget].y; if ((((foods[cells[i].foodTarget].food <= 0)) || ((cells[i].averageHunger > 0.92)))){ cells[i].action = "wander"; cells[i].targetX = cells[i].averageX; cells[i].targetY = cells[i].targetY; }; j = 0; while (j < cells[i].length) { if ((((cells[i][j].hunger < cells[i][j].maxHunger)) && ((pytha((cells[i][j].x - foods[cells[i].foodTarget].x), (cells[i][j].y - foods[cells[i].foodTarget].y)) < 25)))){ cells[i][j].hunger = (cells[i][j].hunger + 300); foods[cells[i].foodTarget].food = (foods[cells[i].foodTarget].food - 300); if (foods[cells[i].foodTarget].infected == true){ addBioHazard(foods[cells[i].foodTarget].x, foods[cells[i].foodTarget].y, 1); k = 0; while (k < cells.length) { if ((((cells[k].action == "feed")) && ((cells[k].foodTarget == cells[i].foodTarget)))){ cells[k].action = "wander"; }; if (cells[k].foodTarget > cells[i].foodTarget){ cells[k].foodTarget--; }; k++; }; removeChild(foods[cells[i].foodTarget]); foods.splice(cells[i].foodTarget, 1); break; }; }; j++; }; } else { if (cells[i].action == "attack"){ cells[i].targetX = predators[cells[i].attackTarget].x; cells[i].targetY = predators[cells[i].attackTarget].y; j = 0; while (j < cells[i].length) { if (pytha((cells[i][j].x - predators[cells[i].attackTarget].x), (cells[i][j].y - predators[cells[i].attackTarget].y)) < 10){ if (predators[cells[i].attackTarget].power >= ((cells[i][j].strength + (Math.random() * 6)) - 3)){ cells[i][j].health = (cells[i][j].health - predators[cells[i].attackTarget].power); predators[cells[i].attackTarget].health = (predators[cells[i].attackTarget].health - 1); } else { predators[cells[i].attackTarget].health = (predators[cells[i].attackTarget].health - cells[i][j].strength); }; }; j++; }; }; }; }; cells[i].realTargetX = cells[i].targetX; cells[i].realTargetY = cells[i].targetY; j = 0; while (j < cells.length) { tempNum = pytha((cells[i].averageX - cells[j].averageX), (cells[i].averageY - cells[j].averageY)); if ((((tempNum < 150)) && (!((tempNum == 0))))){ cells[i].realTargetX = (cells[i].realTargetX + ((cells[j].length * (cells[i].averageX - cells[j].averageX)) / tempNum)); cells[i].realTargetY = (cells[i].realTargetY + ((cells[j].length * (cells[i].averageY - cells[j].averageY)) / tempNum)); }; j++; }; j = 0; while (j < predators.length) { tempNum = pytha((cells[i].averageX - predators[j].x), (cells[i].averageY - predators[j].y)); if ((((tempNum < 150)) && (!((tempNum == 0))))){ if ((((((cells[i].averageHunger > 0.5)) || (!((cells[i].action == "feed"))))) && (!((cells[i].action == "attack"))))){ cells[i].action = "attack"; cells[i].attackTarget = j; } else { if ((((((cells[i].averageHunger > 0.5)) && ((cells[i].action == "attack")))) && ((tempNum < pytha((cells[i].averageX - predators[cells[i].attackTarget].x), (cells[i].averageY - predators[cells[i].attackTarget].y)))))){ cells[i].action = "attack"; cells[i].attackTarget = j; }; }; }; j++; }; cells[i].averageX = 0; cells[i].averageY = 0; cells[i].averageHunger = 0; cells[i].averageHungerLoss = 0; cells[i].averageBirth = 0; cells[i].averageDeath = 0; cells[i].averageSpeed = 0; cells[i].averagePower = 0; cells[i].averageImmunity = 0; j = 0; while (j < cells[i].length) { cells[i].averageX = (cells[i].averageX + cells[i][j].x); cells[i].averageY = (cells[i].averageY + cells[i][j].y); cells[i][j].hunger = (cells[i][j].hunger - cells[i][j].hungerLoss); cells[i].averageHunger = (cells[i].averageHunger + (cells[i][j].hunger / cells[i][j].maxHunger)); cells[i].averageBirth = (cells[i].averageBirth + cells[i][j].birthRate); cells[i].averageDeath = (cells[i].averageDeath + cells[i][j].deathRate); cells[i].averageHungerLoss = (cells[i].averageHungerLoss + cells[i][j].hungerLoss); cells[i].averageSpeed = (cells[i].averageSpeed + cells[i][j].speed); cells[i].averagePower = (cells[i].averagePower + cells[i][j].strength); cells[i].averageImmunity = (cells[i].averageImmunity + cells[i][j].immunity); if (cells[i][j].infected){ cells[i][j].infectTimer--; //unresolved if addBioHazard(cells[i][j].x, cells[i][j].y, cells[i][j].bioChain); reassignNums(i, j); removeChild(cells[i][j]); cells[i].splice(j, 1); j--; } else { if ((((((Math.floor((Math.random() * cells[i][j].deathRate)) == 0)) || ((cells[i][j].hunger <= 0)))) || ((cells[i][j].health <= 0)))){ reassignNums(i, j); removeChild(cells[i][j]); cells[i].splice(j, 1); j--; } else { if ((((Math.floor(((Math.random() * 5) * cells[i][j].birthRate)) == Math.floor(((Math.random() * 2) * cells[i][j].birthRate)))) && ((cells.length < 12)))){ newSwarm(cells[i][j].x, cells[i][j].y, cells[i][j].rad, (cells[i][j].strength * ((Math.random() * 0.4) + 0.7)), (cells[i][j].hungerLoss * ((Math.random() * 0.4) + 0.7)), (cells[i][j].immunity * ((Math.random() * 0.4) + 0.7))); } else { if (Math.floor((Math.random() * (cells[i][j].birthRate + Math.pow(1.6, (cells[i].length / 2))))) == 0){ tempSpeed = ((cells[i][j].speed + (Math.random() * 0.1)) - 0.05); if (tempSpeed < 0.1){ tempSpeed = 0.1; }; tempSize = ((cells[i][j].rad + (Math.random() * 0.2)) - 0.1); if (tempSize < 0.5){ tempSize = 0.5; }; tempRed = ((cells[i][j].red + Math.floor((Math.random() * 15))) - 7); if (tempRed > 240){ tempRed = 240; } else { if (tempRed < 0){ tempRed = 0; }; }; tempBlue = ((cells[i][j].blue + Math.floor((Math.random() * 15))) - 7); if (tempBlue > 240){ tempBlue = 240; } else { if (tempBlue < 0){ tempBlue = 0; }; }; tempGreen = ((cells[i][j].green + Math.floor((Math.random() * 15))) - 7); if (tempGreen > 240){ tempGreen = 240; } else { if (tempGreen < 0){ tempGreen = 0; }; }; addCell(i, cells[i][j].x, cells[i][j].y, tempRed, tempGreen, tempBlue, ((Math.random() * 0.4) + 0.4), tempSize, tempSpeed, ((cells[i][j].birthRate + (Math.random() * 600)) - 300), ((cells[i][j].deathRate + (Math.random() * 600)) - 300), (cells[i][j].hungerLoss * ((Math.random() * 0.6) + 0.72)), (cells[i][j].hunger / cells[i][j].maxHunger), ((cells[i][j].strength + (Math.random() * 2)) - 0.9), ((cells[i][j].immunity + (Math.random() * 2)) - 0.9)); }; }; cells[i][j].x = (cells[i][j].x + cells[i][j].xvel); cells[i][j].y = (cells[i][j].y + cells[i][j].yvel); targetVector.x = (cells[i].realTargetX - cells[i][j].x); targetVector.y = (cells[i].realTargetY - cells[i][j].y); targetVector.len = pytha(targetVector.x, targetVector.y); targetVector.ux = (targetVector.x / targetVector.len); targetVector.uy = (targetVector.y / targetVector.len); wingmates = 0; cohesionVector.x = 0; cohesionVector.y = 0; seperationVector.ux = 0; seperationVector.uy = 0; if (cells[i][j].pCounts == 0){ cells[i][j].pCounts = 10; cells[i][j].partners = new Array(); k = 0; while (k < cells[i].length) { tempNum = pytha((cells[i][j].x - cells[i][k].x), (cells[i][j].y - cells[i][k].y)); if ((((tempNum < (2 * (cells[i][j].rad + cells[i][k].rad)))) && (!((tempNum == 0))))){ cells[i][j].partners.push(k); }; k++; }; }; cells[i][j].pCounts--; k = 0; while (k < cells[i][j].partners.length) { wingmates++; tempNum = pytha((cells[i][j].x - cells[i][cells[i][j].partners[k]].x), (cells[i][j].y - cells[i][cells[i][j].partners[k]].y)); if (tempNum == 0){ tempNum = 0.001; }; seperationVector.ux = (seperationVector.ux - ((cells[i][cells[i][j].partners[k]].x - cells[i][j].x) / tempNum)); seperationVector.uy = (seperationVector.uy - ((cells[i][cells[i][j].partners[k]].y - cells[i][j].y) / tempNum)); cohesionVector.x = (cohesionVector.x + cells[i][cells[i][j].partners[k]].x); cohesionVector.y = (cohesionVector.y + cells[i][cells[i][j].partners[k]].y); k++; }; if (cells[i].length > 55){ reassignNums(i, 55); removeChild(cells[i][55]); cells[i].splice(55, 1); } else { if (wingmates > 0){ cohesionVector.x = (cohesionVector.x / wingmates); cohesionVector.y = (cohesionVector.y / wingmates); seperationVector.ux = (seperationVector.ux / wingmates); seperationVector.uy = (seperationVector.uy / wingmates); cohesionVector.x = (cohesionVector.x - cells[i][j].x); cohesionVector.y = (cohesionVector.y - cells[i][j].y); cohesionVector.len = pytha(cohesionVector.x, cohesionVector.y); if (cohesionVector.len == 0){ cohesionVector.len = 0.001; }; cohesionVector.ux = (cohesionVector.x / cohesionVector.len); cohesionVector.uy = (cohesionVector.y / cohesionVector.len); } else { cohesionVector.ux = 0; cohesionVector.uy = 0; }; cells[i][j].xvel = (cells[i][j].xvel + ((cells[i][j].speed * (((2 * cohesionVector.ux) + (3 * seperationVector.ux)) + targetVector.ux)) / 6)); cells[i][j].yvel = (cells[i][j].yvel + ((cells[i][j].speed * (((2 * cohesionVector.uy) + (3 * seperationVector.uy)) + targetVector.uy)) / 6)); cells[i][j].xvel = (cells[i][j].xvel * 0.95); cells[i][j].yvel = (cells[i][j].yvel * 0.95); }; }; }; j++; }; cells[i].averageHunger = (cells[i].averageHunger / cells[i].length); cells[i].averageX = (cells[i].averageX / cells[i].length); cells[i].averageY = (cells[i].averageY / cells[i].length); cells[i].averageHungerLoss = (cells[i].averageHungerLoss / cells[i].length); cells[i].averageBirth = (cells[i].averageBirth / cells[i].length); cells[i].averageDeath = (cells[i].averageDeath / cells[i].length); cells[i].averageSpeed = (cells[i].averageSpeed / cells[i].length); cells[i].averagePower = (cells[i].averagePower / cells[i].length); cells[i].averageImmunity = (cells[i].averageImmunity / cells[i].length); }; i++; }; i = 0; while (i < foods.length) { if (foods[i].food <= 0){ j = 0; while (j < cells.length) { if ((((cells[j].action == "feed")) && ((cells[j].foodTarget == i)))){ cells[j].action = "wander"; }; if (cells[j].foodTarget > i){ cells[j].foodTarget--; }; j++; }; removeChild(foods[i]); foods.splice(i, 1); i--; } else { foods[i].scaleX = (foods[i].food / 3500); foods[i].scaleY = (foods[i].food / 3500); foods[i].food = (foods[i].food - 10); }; i++; }; if ((((mouseX < 600)) && ((mouseY < 500)))){ dropMC.x = mouseX; dropMC.y = mouseY; } else { dropMC.x = -100; }; }; } public function bioFrequencyUp(_arg1:MouseEvent){ bioFrequency++; } public function bioPowerDown(_arg1:MouseEvent){ if (bioPower > 0){ bioPower--; }; } public function foodSpawnUp(_arg1:MouseEvent){ foodSpawnTime++; } public function predatorPowerUp(_arg1:MouseEvent){ predatorPower++; } public function predatorSpawnDown(_arg1:MouseEvent){ if (predatorSpawnTime > 5){ predatorSpawnTime--; }; } public function addBioHazard(_arg1:Number, _arg2:Number, _arg3:Number){ var _local4:*; var _local5:*; bioHazards.push(new bioHazard()); lc = (bioHazards.length - 1); bioHazards[lc].x = _arg1; bioHazards[lc].y = _arg2; bioHazards[lc].scaleX = _arg3; bioHazards[lc].scaleY = _arg3; addChild(bioHazards[lc]); _local4 = 0; while (_local4 < cells.length) { _local5 = 0; while (_local5 < cells[_local4].length) { if (pytha((cells[_local4][_local5].x - _arg1), (cells[_local4][_local5].y - _arg2)) < (50 * _arg3)){ if (cells[_local4][_local5].immunity < (((bioPower - 0.5) + (Math.random() * 2)) - 1)){ cells[_local4][_local5].infected = true; cells[_local4][_local5].infectTimer = (Math.random() * 30); cells[_local4][_local5].bioChain = (_arg3 * 0.95); }; }; _local5++; }; _local4++; }; } public function reassignNums(_arg1:Number, _arg2:Number){ k = 0; while (k < cells[_arg1].length) { l = 0; while (l < cells[_arg1][k].partners.length) { if (cells[_arg1][k].partners[l] > 0){ var _local3 = cells[_arg1][k].partners; var _local4 = l; var _local5 = (_local3[_local4] - 1); _local3[_local4] = _local5; }; l++; }; k++; }; } public function addCell(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Number, _arg6:Number, _arg7:Number, _arg8:Number, _arg9:Number, _arg10:Number, _arg11:Number, _arg12:Number, _arg13:Number, _arg14:Number, _arg15:Number){ cells[_arg1].push(new MovieClip()); lc = (cells[_arg1].length - 1); if (_arg8 > 20){ _arg8 = 20; }; if (_arg10 <= 20){ _arg10 = 20; }; if (_arg11 <= 0){ _arg11 = 0; }; cells[_arg1][lc].graphics.beginFill((((_arg4 * 65536) + (_arg5 * 0x0100)) + _arg6), _arg7); cells[_arg1][lc].graphics.lineStyle(2, (((_arg4 * 65536) + (_arg5 * 0x0100)) + _arg6)); cells[_arg1][lc].graphics.drawCircle(0, 0, _arg8); cells[_arg1][lc].graphics.endFill(); cells[_arg1][lc].infected = false; cells[_arg1][lc].rad = _arg8; cells[_arg1][lc].red = _arg4; cells[_arg1][lc].immunity = _arg15; cells[_arg1][lc].blue = _arg6; cells[_arg1][lc].green = _arg5; cells[_arg1][lc].speed = _arg9; cells[_arg1][lc].strength = _arg14; if (cells[_arg1][lc].speed < 0.2){ cells[_arg1][lc].speed = 0.2; }; cells[_arg1][lc].birthRate = _arg10; cells[_arg1][lc].deathRate = _arg11; cells[_arg1][lc].health = ((_arg8 * Math.random()) * 3); cells[_arg1][lc].maxHunger = (((_arg8 + 2) * 150) * (Math.random() + 0.5)); cells[_arg1][lc].hunger = (_arg13 * cells[_arg1][lc].maxHunger); cells[_arg1][lc].hungerLoss = _arg12; cells[_arg1][lc].x = _arg2; cells[_arg1][lc].y = _arg3; cells[_arg1][lc].partners = new Array(); cells[_arg1][lc].pCounts = Math.floor((Math.random() * 10)); cells[_arg1][lc].xvel = 0; cells[_arg1][lc].yvel = 0; addChild(cells[_arg1][lc]); } public function closeInstructions(_arg1:MouseEvent){ stage.removeChild(instructions); } public function newSwarm(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Number, _arg6:Number){ cells.push(new Array()); sn = (cells.length - 1); tempRed = Math.floor((Math.random() * 200)); tempBlue = Math.floor((Math.random() * 200)); tempGreen = Math.floor((Math.random() * 200)); tempSize = (_arg3 * ((Math.random() * 1.5) + 0.3)); tempSpeed = (Math.random() + 0.4); cells[sn].steer = ((Math.random() * 2) * Math.PI); cells[sn].speed = (2 * tempSpeed); cells[sn].averageX = _arg1; cells[sn].averageY = _arg2; cells[sn].action = "wander"; cells[sn].averageHunger = 1; cells[sn].targetX = _arg1; cells[sn].targetY = _arg2; addCell(sn, _arg1, _arg2, tempRed, tempGreen, tempBlue, ((Math.random() * 0.4) + 0.4), tempSize, tempSpeed, 750, 1500, _arg5, 1, _arg4, _arg6); addCell(sn, (_arg1 + 1), _arg2, tempRed, tempGreen, tempBlue, ((Math.random() * 0.4) + 0.4), tempSize, tempSpeed, 750, 1500, _arg5, 1, _arg4, _arg6); } public function pytha(_arg1:Number, _arg2:Number):Number{ return (Math.sqrt(((_arg1 * _arg1) + (_arg2 * _arg2)))); } public function clicky(_arg1:MouseEvent){ if ((((mouseX < 600)) && ((mouseY < 500)))){ switch (dropMC.dropType){ case "food": addFood(mouseX, mouseY); break; case "predator": addPredator(mouseX, mouseY, predatorPower); break; case "bioHazard": addBioHazard(mouseX, mouseY, 1); break; }; }; } public function bioFrequencyDown(_arg1:MouseEvent){ if (bioFrequency > 1){ bioFrequency--; }; } public function foodSpawnDown(_arg1:MouseEvent){ if (foodSpawnTime > 5){ foodSpawnTime--; }; } } }//package cells_flaSection 3//otherStuff_2 (cells_fla.otherStuff_2) package cells_fla { import flash.display.*; import flash.text.*; public dynamic class otherStuff_2 extends MovieClip { public var predatorPowerDown:SimpleButton; public var bioDrop:bioHazard; public var restart:SimpleButton; public var foodSpawnUp:SimpleButton; public var bioPowerDown:SimpleButton; public var bioPowerUp:SimpleButton; public var foodDrop:food; public var predatorSpawnUp:SimpleButton; public var predatorPowerUp:SimpleButton; public var predatorSpawnDown:SimpleButton; public var bioFrequencyText:TextField; public var predatorDrop:predator; public var bioPowerText:TextField; public var predatorPowerText:TextField; public var foodSpawn:TextField; public var predatorSpawn:TextField; public var bioFrequencyUp:SimpleButton; public var bioFrequencyDown:SimpleButton; public var foodSpawnDown:SimpleButton; } }//package cells_flaSection 4//bioHazard (bioHazard) package { import flash.display.*; public dynamic class bioHazard extends MovieClip { } }//packageSection 5//food (food) package { import flash.display.*; public dynamic class food extends MovieClip { } }//packageSection 6//predator (predator) package { import flash.display.*; public dynamic class predator extends MovieClip { } }//package
Library Items
Symbol 1 Graphic | Used by:2 | |
Symbol 2 MovieClip {predator} | Uses:1 | Used by:32 55 |
Symbol 3 Graphic | Used by:4 | |
Symbol 4 MovieClip {food} | Uses:3 | Used by:32 55 |
Symbol 5 Graphic | Used by:6 | |
Symbol 6 MovieClip {bioHazard} | Uses:5 | Used by:32 55 |
Symbol 7 Graphic | Used by:12 | |
Symbol 8 Font | Used by:9 10 11 14 15 16 17 24 25 26 27 | |
Symbol 9 Text | Uses:8 | Used by:12 |
Symbol 10 Text | Uses:8 | Used by:12 |
Symbol 11 Text | Uses:8 | Used by:12 |
Symbol 12 MovieClip | Uses:7 9 10 11 | Used by:Timeline |
Symbol 13 Graphic | Used by:32 | |
Symbol 14 Text | Uses:8 | Used by:32 |
Symbol 15 EditableText | Uses:8 | Used by:32 |
Symbol 16 Text | Uses:8 | Used by:32 |
Symbol 17 EditableText | Uses:8 | Used by:32 |
Symbol 18 Graphic | Used by:20 | |
Symbol 19 Graphic | Used by:20 | |
Symbol 20 Button | Uses:18 19 | Used by:32 |
Symbol 21 Graphic | Used by:23 | |
Symbol 22 Graphic | Used by:23 | |
Symbol 23 Button | Uses:21 22 | Used by:32 |
Symbol 24 EditableText | Uses:8 | Used by:32 |
Symbol 25 EditableText | Uses:8 | Used by:32 |
Symbol 26 Text | Uses:8 | Used by:32 |
Symbol 27 EditableText | Uses:8 | Used by:32 |
Symbol 28 Font | Used by:29 34 37 42 44 46 48 49 50 51 52 54 | |
Symbol 29 Text | Uses:28 | Used by:31 |
Symbol 30 Graphic | Used by:31 | |
Symbol 31 Button | Uses:29 30 | Used by:32 |
Symbol 32 MovieClip {cells_fla.otherStuff_2} | Uses:13 2 4 14 15 16 17 20 23 24 6 25 26 27 31 | Used by:Timeline |
Symbol 33 Graphic | Used by:55 | |
Symbol 34 Text | Uses:28 | Used by:36 |
Symbol 35 Graphic | Used by:36 | |
Symbol 36 Button | Uses:34 35 | Used by:55 |
Symbol 37 Text | Uses:28 | Used by:39 |
Symbol 38 Graphic | Used by:39 | |
Symbol 39 Button | Uses:37 38 | Used by:55 |
Symbol 40 Font | Used by:41 43 45 53 | |
Symbol 41 Text | Uses:40 | Used by:55 |
Symbol 42 Text | Uses:28 | Used by:55 |
Symbol 43 Text | Uses:40 | Used by:55 |
Symbol 44 Text | Uses:28 | Used by:55 |
Symbol 45 Text | Uses:40 | Used by:55 |
Symbol 46 Text | Uses:28 | Used by:55 |
Symbol 47 Graphic | Used by:55 | |
Symbol 48 Text | Uses:28 | Used by:55 |
Symbol 49 Text | Uses:28 | Used by:55 |
Symbol 50 Text | Uses:28 | Used by:55 |
Symbol 51 Text | Uses:28 | Used by:55 |
Symbol 52 Text | Uses:28 | Used by:55 |
Symbol 53 Text | Uses:40 | Used by:55 |
Symbol 54 Text | Uses:28 | Used by:55 |
Symbol 55 MovieClip {cells_fla.instructions_9} | Uses:33 36 39 41 42 43 44 45 46 47 48 4 49 2 50 51 6 52 53 54 | Used by:Timeline |
Instance Names
"headings" | Frame 1 | Symbol 12 MovieClip |
"gui" | Frame 1 | Symbol 32 MovieClip {cells_fla.otherStuff_2} |
"instructions" | Frame 1 | Symbol 55 MovieClip {cells_fla.instructions_9} |
"predatorDrop" | Symbol 32 MovieClip {cells_fla.otherStuff_2} Frame 1 | Symbol 2 MovieClip {predator} |
"foodDrop" | Symbol 32 MovieClip {cells_fla.otherStuff_2} Frame 1 | Symbol 4 MovieClip {food} |
"predatorPowerText" | Symbol 32 MovieClip {cells_fla.otherStuff_2} Frame 1 | Symbol 15 EditableText |
"predatorSpawn" | Symbol 32 MovieClip {cells_fla.otherStuff_2} Frame 1 | Symbol 17 EditableText |
"predatorPowerUp" | Symbol 32 MovieClip {cells_fla.otherStuff_2} Frame 1 | Symbol 20 Button |
"predatorPowerDown" | Symbol 32 MovieClip {cells_fla.otherStuff_2} Frame 1 | Symbol 23 Button |
"predatorSpawnUp" | Symbol 32 MovieClip {cells_fla.otherStuff_2} Frame 1 | Symbol 20 Button |
"predatorSpawnDown" | Symbol 32 MovieClip {cells_fla.otherStuff_2} Frame 1 | Symbol 23 Button |
"foodSpawn" | Symbol 32 MovieClip {cells_fla.otherStuff_2} Frame 1 | Symbol 24 EditableText |
"foodSpawnUp" | Symbol 32 MovieClip {cells_fla.otherStuff_2} Frame 1 | Symbol 20 Button |
"foodSpawnDown" | Symbol 32 MovieClip {cells_fla.otherStuff_2} Frame 1 | Symbol 23 Button |
"bioDrop" | Symbol 32 MovieClip {cells_fla.otherStuff_2} Frame 1 | Symbol 6 MovieClip {bioHazard} |
"bioPowerText" | Symbol 32 MovieClip {cells_fla.otherStuff_2} Frame 1 | Symbol 25 EditableText |
"bioPowerUp" | Symbol 32 MovieClip {cells_fla.otherStuff_2} Frame 1 | Symbol 20 Button |
"bioPowerDown" | Symbol 32 MovieClip {cells_fla.otherStuff_2} Frame 1 | Symbol 23 Button |
"bioFrequencyText" | Symbol 32 MovieClip {cells_fla.otherStuff_2} Frame 1 | Symbol 27 EditableText |
"bioFrequencyUp" | Symbol 32 MovieClip {cells_fla.otherStuff_2} Frame 1 | Symbol 20 Button |
"bioFrequencyDown" | Symbol 32 MovieClip {cells_fla.otherStuff_2} Frame 1 | Symbol 23 Button |
"restart" | Symbol 32 MovieClip {cells_fla.otherStuff_2} Frame 1 | Symbol 31 Button |
"close" | Symbol 55 MovieClip {cells_fla.instructions_9} Frame 1 | Symbol 36 Button |
"next" | Symbol 55 MovieClip {cells_fla.instructions_9} Frame 1 | Symbol 39 Button |
Special Tags
FileAttributes (69) | Timeline Frame 1 | Access local files only, Metadata not present, AS3. |
|