Array creation

BlitzMax Forums/BlitzMax Programming/Array creation

Hey,

I would like to store the level information for my game in an array. Each level has 9 variables, and in total I would like to store information for 50 levels.

To do this for 3 levels...
Global LevelArray[][] = [ [0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0] ]


I know this is probably deadly obvious, but how do I easily do it for 50 levels (without a reeeeeeally long command)
ta!

use .. (It means continue on next line)
You still have a really long command, but now its over lots of lines

But someone will say load it in from a text file. Bound to.

ahh wow, ok cool thanks, bit suprised that that's the way of doing it!

Hang on They are not All zero are they?

to start with they are (i was under the impression its good practice to "format" an array before use)

I was half expecting to be able to do it with a for loop (like you can easily if its a normal 1d array), but i think im missing something!

Right, if all the elements are going to be the same size, then allocate

as: Array:int [,] = New Int[50,9]

Then for f and for g
loop 50 F
Loop 9 G
Array[f,g] = 0
next,next


The .. thing was when I thought you were actually entering data into the array

ahh there we go, thank you:)