PhatKitty
10-03-2009, 02:53 PM
Well I'm making a snake game and I have everything working exept one thing which is giving duplicated movieclips unchanging varibles.
By that I mean I want each duplicate to have a diferent number set as the same name variable, so duplicate 1 has the var set as 1, 2 set as 2 so on. Here is what I have:
holder2.onEnterFrame = function() {
var holder2 = attachMovie("body", "body"+this.getNextHighestDepth(), this.getNextHighestDepth());
i++;
holder2.onEnterFrame = function() {
this._x = recordx[i];
this._y = recordy[i];
}
}
I want it so that the "i" is 1 more for every new block, but the problem is by increasing the "i" by 1 every time a new block is added it increases the "i" for all of
I was thinking If I could use on.Load like:
holder2.onLoad = function() {
blocksnumber = i
}
So then a new variable (blocksnumber) would be made each time inside each new "block" dupe, but that doesn't seem to work for duplicates, I think because the block is already loaded or the empty MC is already loaded. So any help would be appreciated!
By that I mean I want each duplicate to have a diferent number set as the same name variable, so duplicate 1 has the var set as 1, 2 set as 2 so on. Here is what I have:
holder2.onEnterFrame = function() {
var holder2 = attachMovie("body", "body"+this.getNextHighestDepth(), this.getNextHighestDepth());
i++;
holder2.onEnterFrame = function() {
this._x = recordx[i];
this._y = recordy[i];
}
}
I want it so that the "i" is 1 more for every new block, but the problem is by increasing the "i" by 1 every time a new block is added it increases the "i" for all of
I was thinking If I could use on.Load like:
holder2.onLoad = function() {
blocksnumber = i
}
So then a new variable (blocksnumber) would be made each time inside each new "block" dupe, but that doesn't seem to work for duplicates, I think because the block is already loaded or the empty MC is already loaded. So any help would be appreciated!