Goto And Play random frame?

*Originally posted by ilyaslamasse *
**Yep, true, that’s why I now compare squared distances. It proves really faster :slight_smile: **

ok just for anyone who doesnt know what ilyaslamasse means by that… heh “squared distances” is taking the number you would normally compare to Math.sqrt(value) and squaring it manually so you would only have to compare it to that value without the Math.sqrt()

ex:

if (Math.sqrt(x) == 5) then …

would become

if (x == 25) then …

Basically you are squaring both sides of the equation (to maintain equality) but to also get rid of the sqrt. Because you do the number in your head (or using a claculator :wink: thats one less thing that Flash has to do…

if (Math.sqrt(x)² == 5²) then …

gives

if (x == 25) then …

And that second example is much much faster for Flash to resolve

(just for any onlookers of the tread :))