Permalink
Browse files

fixed major bug with deletion from a testtube.

  • Loading branch information...
1 parent 460346f commit c1f59c29fc729ab2700bf60323b93aa33320d861 @Bilkokuya committed Apr 22, 2012
View
2 Mutation.as3proj
@@ -71,7 +71,7 @@
</library>
<!-- Class files to compile (other referenced classes will automatically be included) -->
<compileTargets>
- <compile path="src\mutation\Mutation.as" />
+ <compile path="src\mutation\Main.as" />
</compileTargets>
<!-- Paths to exclude from the Project Explorer tree -->
<hiddenPaths>
View
BIN dist/Mutation.swf
Binary file not shown.
View
4 obj/MutationConfig.old
@@ -16,7 +16,7 @@
</define>
<define append="true">
<name>CONFIG::timeStamp</name>
- <value>'21/04/2012'</value>
+ <value>'22/04/2012'</value>
</define>
<verbose-stacktraces>true</verbose-stacktraces>
<source-path append="true">
@@ -25,7 +25,7 @@
</source-path>
</compiler>
<file-specs>
- <path-element>C:\Users\Gordon\Documents\University\Mutation\src\mutation\Mutation.as</path-element>
+ <path-element>C:\Users\Gordon\Documents\University\Mutation\src\mutation\Main.as</path-element>
</file-specs>
<default-background-color>#FFFFFF</default-background-color>
<default-frame-rate>30</default-frame-rate>
View
4 obj/MutationConfig.xml
@@ -16,7 +16,7 @@
</define>
<define append="true">
<name>CONFIG::timeStamp</name>
- <value>'21/04/2012'</value>
+ <value>'22/04/2012'</value>
</define>
<verbose-stacktraces>true</verbose-stacktraces>
<source-path append="true">
@@ -25,7 +25,7 @@
</source-path>
</compiler>
<file-specs>
- <path-element>C:\Users\Gordon\Documents\University\Mutation\src\mutation\Mutation.as</path-element>
+ <path-element>C:\Users\Gordon\Documents\University\Mutation\src\mutation\Main.as</path-element>
</file-specs>
<default-background-color>#FFFFFF</default-background-color>
<default-frame-rate>30</default-frame-rate>
View
BIN resouces/gfx/bacteria.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
14 src/mutation/Game.as
@@ -0,0 +1,14 @@
+package mutation
+{
+
+ public class Game
+ {
+
+ public function Game()
+ {
+
+ }
+
+ }
+
+}
View
14 src/mutation/Mutation.as → src/mutation/Main.as
@@ -21,7 +21,7 @@ package mutation
// Class: Main extends Sprite
// The main game class with main loop
- public class Mutation extends Sprite
+ public class Main extends Sprite
{
static public var money:int;
@@ -30,7 +30,7 @@ package mutation
private var moneyOut:TextField;
// Constructor: default
- public function Mutation():void
+ public function Main():void
{
if (stage) onInit();
else addEventListener(Event.ADDED_TO_STAGE, onInit);
@@ -73,7 +73,15 @@ package mutation
{
tickCount++;
- moneyOut.text = "$" + money;
+ if (money < 1000){
+ moneyOut.text = "$" + money;
+ }else if (money < 1000000) {
+ var moneyK:Number = money / 1000;
+ moneyOut.text = "$" + moneyK.toFixed(1) + "K";
+ }else {
+ var moneyM:Number = money / 1000000;
+ moneyOut.text = "$" + moneyM.toFixed(2) + "M";
+ }
// Dispatch the main game tick event
stage.dispatchEvent(new MutationEvent(MutationEvent.TICK, tickCount));
View
107 src/mutation/entity/Bacteria.as
@@ -7,6 +7,7 @@
package mutation.entity
{
+ import flash.display.Bitmap;
import flash.display.Sprite;
import flash.events.Event;
import flash.events.MouseEvent;
@@ -20,24 +21,51 @@ package mutation.entity
import mutation.ui.BacteriaDisplay;
import mutation.util.Util;
+
// Class: bacteria
public class Bacteria extends Sprite
{
+ [Embed(source = "../../../resouces/gfx/bacteria.png")]
+ private var bacteriaGFX:Class;
+
private const SPEED:Number = 1;
private const HUNGRY_SPEED:Number = 3;
private const HUNGER_RATE:Number = 0.05;
private const DIRECTION_RATE:Number = 1 / 30;
private const HUNGER_LEVEL:Number = 95;
+ public var flagIsClicked:Boolean = false;
+ public var flagIsAlive:Boolean = true;
+ public var flagIsHungry:Boolean= false;
+ private var canMove:Boolean;
+
public var radius:Number;
public var xSpeed:Number; // Current speed in the x Direction
public var ySpeed:Number; // Current speed in the y Direction
public var food:Number; // Currently food level for this bacteria
- public var isHungry:Boolean;
- public var isAlive:Boolean;
+
+ public var bName:String = "Basic Bacteria";
+
+ public var production:Number = 0;
+ public var productionRate:Number = 1;
+ public var productionHungerLimit:Number = 50;
+ public var productionNeeded:Number = 100;
+
+ public var love:Number = 0;
+ public var loveRate:Number = 1;
+ public var loveHungerLimit = 90;
+ public var loveNeeded:Number = 100;
+
+ public var geneStability:Number = 1;
+
public var target:Sprite;
- private var canMove:Boolean;
+ public var visual:Sprite;
+ public var bitmap:Bitmap;
+ public var speed:Number;
+ public var animation:int;
+
+ private var ani:int;
private var popOut:BacteriaDisplay;
// Constructor: (int, int, int, int)
@@ -51,16 +79,28 @@ package mutation.entity
// Initialise basic stats
food = 100;
- isAlive = true;
- isHungry = false;
+
target = null;
canMove = true;
+ animation = 0;
+ ani = 1;
+ production = 0;
+
+ bitmap = new bacteriaGFX();
+
+ visual = new Sprite();
+ addChild(visual);
+ visual.addChild(bitmap);
+ bitmap.width = 2 * radius;
+ bitmap.height = 2 * radius;
+ bitmap.x = -bitmap.width/2;
+ bitmap.y = -bitmap.height/2;
popOut = new BacteriaDisplay(radius,0,100,50,20,20);
// Draw the graphics
- draw();
-
+ //draw();
+
super();
if (stage) onInit();
else addEventListener(Event.ADDED_TO_STAGE, onInit);
@@ -72,22 +112,42 @@ package mutation.entity
stage.addEventListener(MutationEvent.TICK, onTick);
addEventListener(MouseEvent.ROLL_OVER, onRollOver);
addEventListener(MouseEvent.ROLL_OUT, onRollOut);
+
}
// Updates the logic of this each frame, needs to be called by it's container
public function onTick(e:MutationEvent):void {
- if (!isAlive) return;
-
food -= HUNGER_RATE;
- processHunger();
+ processHungerState();
- if (isHungry && (target != null)) {
+ if (food > productionHungerLimit){
+ production++;
+ if (production > productionNeeded) {
+ production = 0;
+ dispatchEvent(new BacteriaEvent(BacteriaEvent.PRODUCE, this, true));
+ }
+ }
+
+ if (flagIsHungry && (target != null)) {
chaseTheTarget();
}else {
moveAround();
}
- popOut.update("Basic Bacteria", food, isHungry);
+ if (!popOut.visible){
+ if (speed > 1) {
+ animation += 8*ani;
+ }else {
+ animation += 2*ani;
+ }
+
+ if (animation > 15) ani = -1;
+ if (animation < 0) ani = 1;
+
+ scaleY = 1 - ((animation) / 90);
+ }
+
+ popOut.update(bName, food, production);
// Update position
if (canMove){
@@ -99,13 +159,18 @@ package mutation.entity
private function onRollOver(e:MouseEvent):void
{
popOut.show();
+ scaleX = 1.2;
+ scaleY = 1.2;
+ parent.setChildIndex(this, parent.numChildren - 1);
addChild(popOut);
canMove = false;
}
private function onRollOut(e:MouseEvent):void
{
popOut.hide();
+ scaleX = 1;
+ scaleY = 1;
removeChild(popOut);
canMove = true;
}
@@ -123,10 +188,10 @@ package mutation.entity
// Kills this bacteria, dispatching it's death event
public function kill():void {
- if (stage) {
- isAlive = false;
+ flagIsAlive = false;
+ if (stage){
stage.removeEventListener(MutationEvent.TICK, onTick);
- stage.dispatchEvent(new BacteriaEvent(BacteriaEvent.DEATH, this));
+ dispatchEvent(new BacteriaEvent(BacteriaEvent.DEATH, this, true));
}
}
@@ -138,16 +203,14 @@ package mutation.entity
private function moveAt(radians:Number, factor:Number = 1):void
{
- if (canMove){
- xSpeed = -1 * factor * SPEED * Math.cos(radians);
- ySpeed = -1 * factor * SPEED * Math.sin(radians);
- }
+ xSpeed = -1 * factor * SPEED * Math.cos(radians);
+ ySpeed = -1 * factor * SPEED * Math.sin(radians);
}
- private function processHunger():void
+ private function processHungerState():void
{
- if (food < HUNGER_LEVEL) isHungry = true;
- else isHungry = false;
+ if (food < HUNGER_LEVEL) flagIsHungry = true;
+ else flagIsHungry = false;
if (food < 0) kill();
}
View
28 src/mutation/entity/Food.as
@@ -10,20 +10,20 @@ package mutation.entity
import flash.events.Event;
import mutation.events.FoodEvent;
import mutation.events.MutationEvent;
- import mutation.Mutation;
import mutation.util.Util;
// Class: Food
public class Food extends BaseFood
{
private const yAccel:Number = 0.07; // y Acceleration downwards
- public var isAlive:Boolean;
public var xSpeed:Number;
public var ySpeed:Number;
- public var isMoving:Boolean;
public var life:Number;
+ public var flagIsMoving:Boolean = true;
+ public var flagIsAlive:Boolean = true;
+
// Constructor: default
public function Food(x:Number, y:Number, base:BaseFood)
{
@@ -34,8 +34,7 @@ package mutation.entity
xSpeed = 0;
ySpeed = 0;
life = 5 * 30;
- isAlive = false;
- isMoving = true;
+ flagIsMoving = true;
draw();
@@ -51,19 +50,15 @@ package mutation.entity
// OnTick Updates
private function onTick(e:MutationEvent):void {
- life--;
- if(isMoving){
+ if(flagIsMoving){
ySpeed += yAccel;
x += xSpeed;
y += ySpeed;
}
- if (life == 140) isAlive = true;
-
- // force it to fade out before dying
- if (life < 30){
- this.alpha = life / 30;
- if (life < 0) {
+ if (flagIsAlive){
+ life--;
+ if ( life < 0) {
kill();
}
}
@@ -73,10 +68,11 @@ package mutation.entity
// Kills this peice of food from the game
public function kill():void
{
- if (isAlive){
- isAlive = false;
+ flagIsAlive = false;
+ flagIsMoving = false;
+ if (stage){
stage.removeEventListener(MutationEvent.TICK, onTick);
- stage.dispatchEvent(new FoodEvent(FoodEvent.FDEATH, this));
+ dispatchEvent(new FoodEvent(FoodEvent.DEATH, this, true));
}
}
View
92 src/mutation/entity/Item.as
@@ -0,0 +1,92 @@
+package mutation.entity
+{
+ import flash.display.Sprite;
+ import flash.events.Event;
+ import flash.events.MouseEvent;
+ import mutation.events.ItemEvent;
+ import mutation.events.MutationEvent;
+ import mutation.Main;
+
+ public class Item extends Sprite
+ {
+
+ private const yAccel:Number = -0.07; // y Acceleration downwards
+
+ public var xSpeed:Number;
+ public var ySpeed:Number;
+ public var life:Number;
+ public var radius:Number;
+ public var money:Number;
+
+ public var flagIsMoving:Boolean = true;
+ public var flagIsClicked:Boolean = false;
+ public var flagIsAlive:Boolean = true;
+
+ // Constructor: default
+ public function Item(x:Number, y:Number)
+ {
+ this.x = x;
+ this.y = y;
+ xSpeed = 0;
+ ySpeed = 0;
+ life = 4 * 30;
+ radius = 6;
+ money = 100;
+
+ draw();
+
+ if (stage) onInit();
+ else addEventListener(Event.ADDED_TO_STAGE, onInit);
+ }
+
+ // Initialisation after Stage
+ private function onInit(e:Event = null):void {
+ removeEventListener(Event.ADDED_TO_STAGE, onInit);
+ stage.addEventListener(MutationEvent.TICK, onTick);
+ addEventListener(MouseEvent.CLICK, onClick);
+ }
+
+ // OnTick Updates
+ public function onTick(e:MutationEvent):void {
+
+ if(flagIsMoving){
+ ySpeed += yAccel;
+ x += xSpeed;
+ y += ySpeed;
+ }
+
+ if (flagIsAlive){
+ life--;
+ if ( life < 0) {
+ kill();
+ }
+ }
+ }
+
+ private function onClick(e:MouseEvent):void
+ {
+ flagIsClicked = true;
+ }
+
+ // Kills this peice of food from the game
+ public function kill():void
+ {
+ flagIsAlive = false;
+ flagIsMoving = false;
+ if (stage) {
+ stage.removeEventListener(MutationEvent.TICK, onTick);
+ removeEventListener(MouseEvent.CLICK, onClick);
+ dispatchEvent(new ItemEvent(ItemEvent.DEATH, this, true));
+ }
+ }
+
+ // Draw the graphics representation
+ private function draw():void {
+ graphics.beginFill(0xFFAA33);
+ graphics.drawCircle(0, 0, radius);
+ graphics.endFill();
+ }
+
+ }
+
+}
View
138 src/mutation/entity/TestTube.as
@@ -7,14 +7,16 @@
package mutation.entity
{
+ import flash.display.DisplayObject;
import flash.display.Sprite;
import flash.events.Event;
import flash.events.MouseEvent;
import flash.ui.Mouse;
+ import mutation.events.ItemEvent;
import mutation.events.MutationEvent;
import mutation.events.BacteriaEvent;
import mutation.events.FoodEvent;
- import mutation.Mutation;
+ import mutation.Main;
import mutation.util.Keys;
import mutation.util.Util;
@@ -24,28 +26,31 @@ package mutation.entity
{
private var bacterias:Array; // Array of Bacteria
private var foods:Array; // Array of Food
+ private var items:Array;
private var radius:int; // Radius of movement for the testtube
+ private var flagIsClicked:Boolean = false;
+
// Constructor: default
public function TestTube(x:Number = 200, y:Number = 200, radius:int = 50) {
this.x = x;
this.y = y;
this.radius = radius;
-
+
bacterias = new Array();
foods = new Array();
+ items = new Array();
- // Set up the 5 bacteria in this tube
- // Remove this in future when extending the test tube to being a generic container
- // i.e. once the "buying" bacteria functionality is added
+ // Temporay set up the bacteria to test
for (var i:int = 0; i < 5; i++) {
var xSpeed:Number = (Math.random() - 0.5) * 5;
var ySpeed:Number = (Math.random() - 0.5) * 5;
- var b:Bacteria = new Bacteria(0, 0, xSpeed, ySpeed);
+ var b:Bacteria = new Bacteria(0, 0, xSpeed, ySpeed, 8);
bacterias.push(b);
addChild(b);
}
+ // Temporary draw the circle
draw();
super();
@@ -59,59 +64,70 @@ package mutation.entity
removeEventListener(Event.ADDED_TO_STAGE, onInit);
addEventListener(MouseEvent.CLICK, onClick);
stage.addEventListener(MutationEvent.TICK, onTick);
- stage.addEventListener(BacteriaEvent.DEATH, onBacteriaDeath);
- stage.addEventListener(FoodEvent.FDEATH, onFoodDeath);
+
+ addEventListener(FoodEvent.DEATH, onFoodDeath);
+ addEventListener(BacteriaEvent.DEATH, onBacteriaDeath);
+ addEventListener(ItemEvent.DEATH, onItemDeath);
+ addEventListener(BacteriaEvent.PRODUCE, onBacteriaProduce);
}
// Every frame, process the actions of this TestTube
private function onTick(e:MutationEvent):void {
- testBoundaries();
- testCollisions();
+ updateItems();
+ updateFood();
+ updateBacteria();
- if (Keys.isDown(Keys.Q)) {
- Foods.nextFood();
- }else if (Keys.isDown(Keys.E)) {
- Foods.lastFood();
- }
+ if (flagIsClicked) spawnFood();
+ flagIsClicked = false;
}
-
- // Checks that all bacteria are in the boundary of the test tube
- private function testBoundaries():void {
- // Ensure each bacteria is within the limits of the testtube radius
- for each (var b:Bacteria in bacterias) {
- if ( !(Util.inRadius(b.x, b.y, radius)) ){
- b.xSpeed *= -1;
- b.ySpeed *= -1;
+ private function updateItems():void
+ {
+ for each (var i:Item in items) {
+ if ( !(Util.inRadius(i.x, i.y, radius)) ){
+ i.ySpeed *= -0.5;
+ i.xSpeed *= -0.5;
+ // Abuse the inRadius function to check if the combined speed is in range 0->1
+ if (Util.inRadius(i.xSpeed, i.ySpeed, 1)) i.flagIsMoving = false;
+ }
+
+ if (i.flagIsClicked) {
+ this.flagIsClicked = false;
+ Main.money += i.money;
+ i.kill();
}
+ i.flagIsClicked = false;
}
+ }
+
+ private function updateFood():void
+ {
for each (var f:Food in foods) {
if ( !(Util.inRadius(f.x, f.y, radius)) ){
f.ySpeed *= -0.5;
f.xSpeed *= -0.5;
// Abuse the inRadius function to check if the combined speed is in range 0->1
- if (Util.inRadius(f.xSpeed, f.ySpeed, 1)) f.isMoving = false;
+ if (Util.inRadius(f.xSpeed, f.ySpeed, 1)) f.flagIsMoving = false;
}
}
}
- // Checks collisions between the Bacteria, and between the food
- private function testCollisions():void
+ private function updateBacteria():void
{
- for each (var b:Bacteria in bacterias) {
- if (!b.isAlive) continue;
- // check each bacteria against other bacteria
- for each (var b2:Bacteria in bacterias) {
- // if it hits, knock them back in opposite directions and put space between them
+ for each (var b:Bacteria in bacterias) {
+
+ if ( !(Util.inRadius(b.x, b.y, radius)) ){
+ b.xSpeed *= -1;
+ b.ySpeed *= -1;
}
- if (b.isHungry) {
+ if (b.flagIsHungry) {
var closestDistance:Number = 0;
var closestFood:Food = null;
// check each bacteria against the food
for each (var f:Food in foods) {
- if (!f.isAlive) continue;
+ if (!f.flagIsAlive) continue;
var distance:Number = Util.getDistanceSquared(b.x, b.y, f.x, f.y);
if ((distance < closestDistance) || (!closestFood)) {
@@ -129,56 +145,68 @@ package mutation.entity
b.target = closestFood;
}
}
+
}
+ private function onBacteriaProduce(e:BacteriaEvent):void
+ {
+ var item:Item = new Item(e.bacteria.x, e.bacteria.y);
+ items.push(item);
+ addChild(item);
+ }
// Feeds the bacteria when the testTube is clicked on
private function onClick(e:MouseEvent):void {
+ flagIsClicked = true;
+ }
+
+ private function spawnFood():void
+ {
// Add a new peice of food
// Ensure it is in radius of the testTube
if (Util.inRadius(mouseX, mouseY, radius)) {
- if (Mutation.money >= 10){
+ //if (Main.money >= 10){
var food:Food = new Food(mouseX, mouseY, Foods.getFood());
foods.push(food);
addChild(food);
- Mutation.money -= 10;
- }
+ Main.money -= 10;
+ // }
}
}
// Called whenever a piece of food dies
private function onFoodDeath(e:FoodEvent):void
{
- // Terrible temporary method of removing an element from the array
- if (Util.removeFrom(foods, e.food)){
- removeChild(e.food);
-
- if (e.food.debrisType) {
- trace("not null debris");
- for (var i:int = 0; i < e.food.debrisCount; ++i) {
- var food:Food = new Food(e.food.x, e.food.y, e.food.debrisType);
- food.xSpeed = e.food.xSpeed - (Math.random() - 0.5);
- food.ySpeed = e.food.ySpeed - 3*(Math.random());
- foods.push(food);
- addChild(food);
- }
+ removeChild(e.food);
+ foods.splice(foods.indexOf(e.food), 1);
+
+ if (e.food.debrisType) {
+ for (var i:int = 0; i < e.food.debrisCount; ++i) {
+ var debris:Food = new Food(e.food.x, e.food.y, e.food.debrisType);
+ debris.xSpeed = e.food.xSpeed - (Math.random() - 0.5);
+ debris.ySpeed = e.food.ySpeed - 3*(Math.random());
+ foods.push(debris);
+ addChild(debris);
}
}
-
}
// Called whenever a bacteria dies
private function onBacteriaDeath(e:BacteriaEvent):void
{
- // Terrible temporary method of removing an element from the array
- if (Util.removeFrom(bacterias, e.bacteria)){
- removeChild(e.bacteria);
- }
+ removeChild(e.bacteria);
+ bacterias.splice(bacterias.indexOf(e.bacteria), 1);
+ }
+
+ private function onItemDeath(e:ItemEvent):void
+ {
+ removeChild(e.item);
+ items.splice(items.indexOf(e.item), 1);
}
// Draws the graphics of the testTube
private function draw():void {
- graphics.beginFill(0xFF6600, 0.5);
+ graphics.beginFill(0x777777, 0.5);
graphics.drawCircle(0, 0, radius+10);
graphics.endFill();
}
View
15 src/mutation/entity/behaviours/bPhysics.as
@@ -0,0 +1,15 @@
+package mutation.entity.behaviours
+{
+
+ public interface bPhysics
+ {
+
+ public function bPhysics()
+ {
+ }
+
+ public function update();
+
+ }
+
+}
View
21 src/mutation/entity/behaviours/bPhysicsFloat.as
@@ -0,0 +1,21 @@
+package mutation.entity.behaviours
+{
+
+ public class bPhysicsFloat implements bPhysics
+ {
+
+ public var density_:Number;
+
+ public function bPhysicsFloat()
+ {
+
+ }
+
+ override public function update()
+ {
+
+ }
+
+ }
+
+}
View
3 src/mutation/events/BacteriaEvent.as
@@ -5,7 +5,8 @@ package mutation.events
public class BacteriaEvent extends Event
{
- public static const DEATH:String = "DEATH";
+ public static const DEATH:String = "BACTERIA_DEATH";
+ public static const PRODUCE:String = "BACTERIA_PRODUCE";
public var bacteria:Bacteria;
View
2 src/mutation/events/FoodEvent.as
@@ -5,7 +5,7 @@ package mutation.events
public class FoodEvent extends Event
{
- public static const FDEATH:String = "FDEATH";
+ public static const DEATH:String = "FOOD_DEATH";
public var food:Food;
public function FoodEvent(type:String, food:Food, bubbles:Boolean=false, cancelable:Boolean=false)
View
29 src/mutation/events/ItemEvent.as
@@ -0,0 +1,29 @@
+package mutation.events
+{
+ import flash.events.Event;
+ import mutation.entity.Item;
+
+ public class ItemEvent extends Event
+ {
+ public static const DEATH:String = "ITEM_DEATH";
+ public var item:Item;
+
+ public function ItemEvent(type:String, item:Item, bubbles:Boolean=false, cancelable:Boolean=false)
+ {
+ this.item = item;
+ super(type, bubbles, cancelable);
+ }
+
+ public override function clone():Event
+ {
+ return new ItemEvent(type, item, bubbles, cancelable);
+ }
+
+ public override function toString():String
+ {
+ return formatToString("ItemEvent", "type", "bubbles", "cancelable", "eventPhase");
+ }
+
+ }
+
+}
View
16 src/mutation/ui/BacteriaDisplay.as
@@ -10,7 +10,7 @@ package mutation.ui
{
private var nameField:TextField;
private var foodField:TextField;
- private var hungryField:TextField;
+ private var productionField:TextField;
private var boxWidth_:int;
private var boxHeight_:int;
@@ -30,24 +30,24 @@ package mutation.ui
nameField = new TextField();
foodField = new TextField();
- hungryField = new TextField();
+ productionField = new TextField();
var format:TextFormat = new TextFormat();
format.size = 12;
format.font = "Calibri";
nameField.defaultTextFormat = format;
foodField.defaultTextFormat = format;
- hungryField.defaultTextFormat = format;
+ productionField.defaultTextFormat = format;
nameField.x = arrowWidth_;
nameField.y = (-boxHeight_/2) + 2;
foodField.x = arrowWidth_;
foodField.y = (-boxHeight_/2) + 17;
- hungryField.x = arrowWidth_;
- hungryField.y = (-boxHeight_/2) + 32;
+ productionField.x = arrowWidth_;
+ productionField.y = (-boxHeight_/2) + 32;
super();
if (stage) onInit();
@@ -58,7 +58,7 @@ package mutation.ui
{
addChild(nameField);
addChild(foodField);
- addChild(hungryField);
+ addChild(productionField);
draw();
@@ -74,11 +74,11 @@ package mutation.ui
this.visible = false;
}
- public function update(names:String, food:Number, isHungry:Boolean):void
+ public function update(names:String, food:Number, production:Number):void
{
nameField.text = names;
foodField.text = "Food: " + food.toFixed(0) + "/100";
- hungryField.text = "isHungry: " + isHungry;
+ productionField.text = "Prod: " + production.toFixed(0) + "/100";;
}
private function draw():void

0 comments on commit c1f59c2

Please sign in to comment.