Hello,
I’m having a problem creating If loops with multiple-dimensions. What I am trying to do is simple in concept: create “boxes” (square movie clips) surrounding another movie clip (one to the left, to the right, above and below). Essentially what I have so far looks like this:
--------SQUARE-------
SQUARE-Center-SQUARE
--------SQUARE-------
For the above setup I have a code that runs a bit like this:
function createsquares() {
for (…) {
…
statements
…
}
}
What I want to do is create squares around the already created squares so it looks more like this:
----------------SQUARE-----------------
--------SQUARE-SQUARE-SQUARE--------
SQUARE-SQUARE-Center-SQUARE-SQUARE
--------SQUARE-SQUARE-SQUARE--------
----------------SQUARE-----------------
What I have so far is this:
function createsquares(makes them around Center) {
for (…) {
…
statements
…
if (createmoresquares==true) {
createmoresquares=false
createsquares(makes them around the newly created square)
}
}
}
The problem with this is that as soon as I use the function createmoresquares, the for loop is run again for that second set of squares, but the original for loop to create the original set of squares is forgotten so that I end up with this:
----------------SQUARE--------
--------Center-SQUARE-SQUARE
----------------SQUARE--------
I know this all seems very confusing but the basic mistake I am making should be easy to resolve. I have the same problem creating multiple-dimensional arrays. Can anybody help me out?
Thanks a lot in advance,
-Raven~Storm