No multi-dimentional Blitz Arrays!

BlitzPlus Forums/BlitzPlus Programming/No multi-dimentional Blitz Arrays!

Grey Alien(Posted 2005) [#1]
Just found out this won't compile:

Type LevelStruct
	Field Grid[MAX_LEVEL_WIDTH,MAX_LEVEL_HEIGHT]
End Type


bummer, gonna have to use a * sign instead of comma and then do my Y coord * MAX_LEVEL_WIDTH each time, sigh.


Arem(Posted 2005) [#2]
Can you do it like C++ where you do grid[asdf][fdsa]?


rdodson41(Posted 2005) [#3]
If you are using BlitzPlus I think you need to use () instead of [].
Try
Type LevelStruct
    Field Grid(MAX_LEVEL_WIDTH, MAX_LEVEL_HEIGHT)
End Type

Don't have access to B+ right now so I can't test it.


Regular K(Posted 2005) [#4]
Sushimasta, your example doesn't work, it gives me this error:

"Expecting 'Field' or 'End Type'"


Grey Alien(Posted 2005) [#5]
Yeah you can only use 1 dimensional Blitz Arrays (i.e. using square brackets not round ones) in fields. That's pretty much my problem. It wasn't too bad in the end as everytime I stored a value in it I did Grid(y*width+x) which worked fine.


rdodson41(Posted 2005) [#6]
Oh I didn't know you could only use 1 dim. arrays as fields. I just assumed it would be possible as it is in most languages.