# Random Movement

**URL:** <https://forum.kirupa.com/t/random-movement/322770>\
**Category:** Uncategorized\
**Created:** [June 2, 2011, 3:16pm UTC](https://forum.kirupa.com/t/random-movement/322770 "2011-06-02T15:16:19Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Luigi\_Vercotti](https://avatars.discourse-cdn.com/v4/letter/l/b2d939/32.png) [@Luigi\_Vercotti](https://forum.kirupa.com/u/Luigi_Vercotti)\
**Post date:** [June 2, 2011, 3:16pm UTC](https://forum.kirupa.com/t/random-movement/322770/1 "2011-06-02T15:16:19Z")

</div>

Hello guys  
I’ve this code which is working fine…the issue is… I’ve got those “boxesFlying.boxesFlying” …about 70, so I know I’ve have to use array…? the second issue I’ve got is that the random is fine but those boxes act same random x and y so I’ve changed the delay time, but again if I will have to do about 70mc I will be sitting here all night… ☹  
Can you please help me… 😉

```auto

var min:Number = -15;
var max:Number = 15;
var fiveToFive:Number = Math.round(Math.random()*(1+ max - min) + min);
var p49:Number = boxesFlying.boxesFlying49.x;
var p49Y:Number = boxesFlying.boxesFlying49.y;
var p40X:Number = boxesFlying.boxesFlying40.x;
var p40Y:Number = boxesFlying.boxesFlying40.y;

var boxesFlyingTweenSpace40:TimelineLite = new TimelineLite();
boxesFlyingTweenSpace40.insert(new TweenLite(boxesFlying.boxesFlying40,3,{x:p40X + fiveToFive,ease:Bounce.easeOut}));
boxesFlyingTweenSpace40.append(new TweenLite(boxesFlying.boxesFlying40,3,{y:p40Y + fiveToFive,ease:Bounce.easeOut}),-2.5);
boxesFlyingTweenSpace40.append(new TweenLite(boxesFlying.boxesFlying40,3,{x:p40X - fiveToFive,ease:Bounce.easeOut}),-2);
boxesFlyingTweenSpace40.append(new TweenLite(boxesFlying.boxesFlying40,3,{y:p40Y - fiveToFive,ease:Bounce.easeOut}),-2.5);
boxesFlyingTweenSpace40.append(new TweenLite(boxesFlying.boxesFlying40,3,{x:-59.30, y:-46}),-2);

    var boxesFlyingTweenSpace:TimelineLite = new TimelineLite();
    boxesFlyingTweenSpace.insert(new TweenLite(boxesFlying.boxesFlying49,2.5,{x:p49 + fiveToFive,ease:Bounce.easeOut}));
    boxesFlyingTweenSpace.append(new TweenLite(boxesFlying.boxesFlying49,3,{y:p49Y + fiveToFive,ease:Bounce.easeOut}),-2.4);
    boxesFlyingTweenSpace.append(new TweenLite(boxesFlying.boxesFlying49,3,{x:p49 - fiveToFive,ease:Bounce.easeOut}),-2);
    boxesFlyingTweenSpace.append(new TweenLite(boxesFlying.boxesFlying49,3,{y:p49Y - fiveToFive,ease:Bounce.easeOut}),-2.9);
    boxesFlyingTweenSpace.append(new TweenLite(boxesFlying.boxesFlying49,3,{x:51.50, y:-66}),-2);

```
