# Ahh confused - Positioning grid generation in movie clip

**URL:** <https://forum.kirupa.com/t/ahh-confused-positioning-grid-generation-in-movie-clip/214002>\
**Category:** Uncategorized\
**Created:** [January 24, 2007, 9:41pm UTC](https://forum.kirupa.com/t/ahh-confused-positioning-grid-generation-in-movie-clip/214002 "2007-01-24T21:41:32Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![kingscooty](https://avatars.discourse-cdn.com/v4/letter/k/73ab20/32.png) [@kingscooty](https://forum.kirupa.com/u/kingscooty)\
**Post date:** [January 24, 2007, 9:41pm UTC](https://forum.kirupa.com/t/ahh-confused-positioning-grid-generation-in-movie-clip/214002/1 "2007-01-24T21:41:32Z")

</div>

Heya, this is my first post, but i hope someone can help me with my problem 🙂 Here’s a chunk of my code:

```auto
//This function uses loops to generate the grid from the array below.
function drawIt(theMap)
{
 var pos = 0;
 var diameter = 60;
 
 for (var y=0; y< diameter; y++)
 {
  for (var x=0; x<diameter; x++)
  {
   pos = x + (y * diameter)
 
   if (theMap[y][x] == 0)
   {
    _root.attachMovie("myTile2", "tile_" + pos, pos)
 
    _root["tile_" + pos]._x = x * diameter;
    _root["tile_" + pos]._y = y * diameter;
   } 
   else if (theMap[y][x] == 1) 
   {
    _root.attachMovie("myTile", "tile_" + pos, pos)
    _root["tile_" + pos]._x = x * diameter;
    _root["tile_" + pos]._y = y * diameter;
   }   
  }
 }
}
//This is the the grid structure, 0's mean you can walk on it. 1's mean u can't.
function generateMap()
{
 var genMap ="1,1,1,0,1,1,1,1,1,1|1,0,0,0,0,1,0,0,0,1|1,0,0,0,1,0,0,0,1,1|1,0,0,1,1,1,0,1,1,1|1,0,0,0,1,0,0,0,1,1|1,0,0,0,0,0,0,0,0,1|1,1,1,1,0,1,1,1,1,1|1,0,0,0,0,0,0,0,0,1|1,0,0,0,0,0,0,0,0,1|1,1,1,1,1,1,1,1,0,1";
 genMap = genMap.split('|');
 for (var i = 0; i< genMap.length; i++) {
    map* = genMap*.split(',');
}

```

Basically, it generates a grid from two movie clips which are just different coloured squares. It reads in generateMap function to decide whether it will be a red square or a white square. 0 = white 1 = red. (the reds are going to prevent a sprite from travelling on them)

Anyway, at the moment the starting point for generating this grid is at 0,0 of the movie clip. I want it to generate at say 150,0 so i can add a console on the left which can control a sprite around this grid.

Any ideas? 🙂  
I’ll gladly post more code or information if i’ve explained myself badly _hides_ lol  
Cheers!
