|
-
hi,
i'm currently doing some stuff for a flash game and have come across an odd problem...
heres the relevent lines of code...
var statsAry = new Array();
statsAry[1] = {utype: "tank", movespeed: 2, ap: 100, hp: 250, mcost: 50, fcost: 50, damage: 75};
_root["unit"+numunits].stats = _root.statsAry[1];
there can be multiple units with the same stats, so i thought the above would be a nice clean way of generating their details
thing is though, when you get into the game and start changing the values e.g.
_root.unit5.stats.ap = 50;
it not only changes that unit, but all other units of the same type *and* the initial root array?? why?? :/
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|