Saturday, June 4, 2011

Yesterday's News, Today!

Okay what I wanted to show yesterday, but had a few technical issues. And not sure if I explained the issue well.

So I have an array of player items.

[apple object][apple object][beer object][beer object]etc

my [apple object] has

public class Item {
public var name:String; //name of the item a string
public var producer = []; // who created the item
public var number:int; //how many of them
public var IDNumber:int; //okay so this is a specific number for this item not used for much except
//for producer
public var IDArray; // a link to the array that this item is in.... used for producer again

[apple object].name == apple
[apple object].producer == [apple tree, apple tree, apple tree, apple tree]
[apple object].number == 4 //I have 4 apples stacked
[apple object].IDNumber == 26
[apple object].IDArray = Player.itemArray

We send my [apple object] over to the image builder and it makes an apple but got one problem. I can't add an array as a tag to an image. Not sure why but it did not like it. (this would still be an object as far as flash is concerned but) i'm going to call it [apple image] what I can do though is add the rest of the properties to my [apple image]

So then when I mouse over my [apple image] I get most of the information except I don't have the producer array. But because I sent in a unique IDNumber and what array the item is in IDArray as a pointer... I can just go look.

The actual code which does have a bug I will fix tonight. (The girls crash it because they can have nulls in there array, easy fix took me a while to figure out.)

for (i2 = 0; i2 <; i2++) {
if( ==[i2].IDNumber) {
stringy = stringy + "Producer: ";
for (var i3 = 0; i3 <[i2].producer.length; i3++) {
stringy = stringy + " " +[i2].producer[i3] + ",";

I'm sure there is a better way to do it, but if your making suggestions please use small words and examples.


1 comment:

  1. Apple trees? Incoming harvest-moon mechanics? :D