Thxn Joshua and others,
I have to look into that. In the mean time I came up with the following
code. This takes in a vector and then calculates a 'ring' from that
position. With this, I can scale up the 'radius' and get recursively get
all the rings from a point from in to outer ring. My goal i still to
fill an array with all the points of the grid, starting from a center
point en then moving outwards in a ring.
Here is the code so far, i hope someone can maybe give some commment on it.
var i:Number = 0;
var cycle:Number = 1;
var dir:Number = 1;
var count:Number = 3;
var row:Number = 0;
function getTiles(startX:Number , startY:Number) : Void
{
//startX -= (count-1);
//startY -= (count-1);
var x:Number = 0;
var y:Number = 0;
while (cycle<=4) {
if (cycle>2 && dir == 1) {
dir = -1;
}
row = (cycle%2);
while (i<count) {
if (dir == 1) {
if (row) {
display(startX + x, startY + y);
x++;
} else {
display(startX + x, startY + y);
y++;
}
} else {
if (row) {
display(startX + x, startY + y);
x--;
} else {
display(startX + x, startY + y);
y--;
}
}
i++;
}
i = 0;
cycle++;
}
}
function display(x, y) {
trace('['+x+','+y+']');
}
getTiles(2,2)
_______________________________________________
Flashcoders@chattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com