# Grid with random defined rotation

**URL:** <https://forum.kirupa.com/t/grid-with-random-defined-rotation/105626>\
**Category:** Uncategorized\
**Created:** [March 28, 2004, 3:18am UTC](https://forum.kirupa.com/t/grid-with-random-defined-rotation/105626 "2004-03-28T03:18:05Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![enriquepr](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/enriquepr/32/459_2.png) [@enriquepr](https://forum.kirupa.com/u/enriquepr)\
**Post date:** [March 28, 2004, 3:18am UTC](https://forum.kirupa.com/t/grid-with-random-defined-rotation/105626/1 "2004-03-28T03:18:05Z")

</div>

Hey,

I have made a grid that loads great but I want to add a little flavor by having two events occur:

I want the grid boxes (all duplicates of an mc named “sq”) to rotate either 90, 180, 270 or 360 degrees. The thing is I have written a script to make them rotate 90 degrees with each new duplicate but I realized that doesn’t look as good as what I’m going for. That code is here:

```auto

gridx = 31;
gridy = 31;
	num = 0;
	for (var i = 0; i<20; i++) {
		for (var j = 0; j<8; j++) {
			sq.duplicateMovieClip("sq"+num, num);
			mc = this["sq"+num];
			setProperty("mc", _rotation, n);
			n = n+90;
			mc._x = gridx*i;
			mc._y = gridy*j+130;
		num++;
		}
	}

```

I am trying to get them to randomly change their \_rotation to one of the four numbers. I tried an array but got confused how to apply it to a property and gave up.

Ok, that’s effect one. The second is that when they get duplicated into the grid, if there was a way to make them duplicate out of order and one after another (instead of duplicating all at one time). I looked at some setinterval stuff but nothing seemed to be directed to what I was looking for.

Any help is greatly appreciated!
