# Square shower

**URL:** <https://forum.kirupa.com/t/square-shower/175587>\
**Category:** Uncategorized\
**Created:** [January 16, 2006, 5:14am UTC](https://forum.kirupa.com/t/square-shower/175587 "2006-01-16T05:14:25Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![nathan99](https://avatars.discourse-cdn.com/v4/letter/n/96bed5/32.png) [@nathan99](https://forum.kirupa.com/u/nathan99)\
**Post date:** [January 16, 2006, 5:14am UTC](https://forum.kirupa.com/t/square-shower/175587/1 "2006-01-16T05:14:25Z")

</div>

My second entry…

```auto

l = f=0;
function create(x, y, w, h, c) {
 var k = _root.createEmptyMovieClip("square"+[++l], l);
 k.beginFill(c);
 k.moveTo(-(w/2), -(h/2));
 k.lineTo(-(w/2), -(h/2));
 k.lineTo(-(w/2), h/2);
 k.lineTo(w/2, h/2);
 k.lineTo(w/2, -(h/2));
 k._y = x;
 k._x = y;
}
setInterval(function () {
 for (var i = 0; i<2; i++) {
  square1.duplicateMovieClip("nesq"+[++f], getNextHighestDepth(), {_x:square1._x+random(10), _rotation:random(360), dir:random(2), _alpha:random(50)+50, xsp:Math.random()*5, ysp:-Math.random()*20-10, onEnterFrame:function () {
   this.dir == 1 ? this._x -= this.xsp : this._x += this.xsp;
   this._y>Stage.height ? this.removeMovieClip() : this._y += this.ysp;
   !this.hitTest(square2) && !this.hitTest(square3) ? this.ysp++ : null;
   while (this.hitTest(square2) || this.hitTest(square3)) {
    this._y--;
   }
  }});
 }
}, 10);
create(Stage.height, Stage.width/2, 4, 4, "0xEE0000");
create(Stage.height/1.4, 350, 60, 20, "0x000000");
create(Stage.height/1.4, 175, 60, 20, "0x000000");

```
