I’m trying to create a program that creates a random map for a side scrolling cave.
So I need to store the roof and the grounds y coordinate into a big array, like 10 000 pieces of wall.
The only way I’ve gotten it to accept some data into the array is like this but I want something cleaner and something that can go on forever.
How should I format the first 4 lines of code so that the array accepts commands like this and expands for the for loop as needed?
level*[j] = something;
var level = [
["0","0","0","0","0","0"],//this will be the roof
["0","0","0","0","0","0"]//this will be the ground
];
//need something better for the code above
for (i=0;i<10;i++){
for (j=0;j<2;j++){
level[j]* = 1;
}
}
for (i=0;i<10;i++){
for (j=0;j<2;j++){
trace(j + "j i" + i +"-" + level[j]*);
}
}