actionscript 3 - how does the "for each in" loop work? -
for reason code not work intended, i've cut out of program but, think need tell have tree array, , trying make collisions said trees thought work:
function collisions(loopevent:event):void { each (var a:tree in treearray) { if (brettmc.right1.hittestobject(a.stump)) { rightcoll = false; } else { rightcoll = true; } if (brettmc.left1.hittestobject(a.stump)) { leftcoll = false; } else { leftcoll = true; } if (brettmc.up1.hittestobject(a.stump)) { upcoll = false; } else { upcoll = true; } if (brettmc.down1.hittestobject(a.stump)) { downcoll = false; } else { downcoll = true; } } }
i pretty sure problem for each loop
messed up.
i don't see issue loop itself
except
is treearray
actual name of variable? or it's type?
if that's actual variable, can trace length of before loop?
Comments
Post a Comment