Kod: Zaznacz cały
function rand(a:Number ,b:Number)
{
return Math.round(a+Math.random()*(b-a));
}
var wspx:Array = new Array();
var wspy:Array = new Array();
var polx:Number;
var poly:Number;
for ( x=0; x<2; x++) {
_root.attachMovie ("object", "object"+x, x+100);
if (x==0)
{
polx = rand(40,200);
poly = rand(40,200);
this["object"+x]._x = polx;
this["object"+x]._y = poly;
wspx[0]=polx-20;
wspx[1]=polx+20;
wspy[0]=poly-20;
wspy[1]=poly+20;
}
else if(x==1)
{
polx = rand(40,wspx[0]);
if(random(2)) polx=rand(wspx[1],200);
poly = rand(40,wspy[0]);
if(random(2)) poly=rand(wspy[1],200);
this["object"+x]._x = polx;
this["object"+x]._y = poly;
}
}