Posted: 25th Nov 2011 19:53
Alrighty, I was attempting to recreate a simple 2D tile based engine I had played with long ago, however I've run into a problem.

I was attempting to create a type for my maps. And within each map, there are supposed to be an array of tiles. However, the compiler keeps telling me that this is not possible.

+ Code Snippet
maxmapx as integer = 15
maxmapy as integer = 12
maxmap as integer = 4

type maptype
    dim ground[maxmapx, maxmapy] as integer
    dim mask[maxmapx, maxmapy] as integer
endtype

dim map[maxmap] as maptype


And erroring out on this line...

+ Code Snippet
    dim mask[maxmapx, maxmapy] as integer


Any help would be greatly appreciated!
Posted: 25th Nov 2011 22:38
Unfortunately arrays within types aren't supported at the moment however there may be plans to have it supported later. It all depends on what TGC thinks of it.

Now for the workarounds. Take a look at this thread. You'll need to scroll down to the last couple of posts but there is a workaround explained there.

The other solution is to switch to Tier 2 and use C++ where arrays in classes are supported.

Good luck with your game.
Posted: 26th Nov 2011 6:59
Ahh, how sad. I hope they get implemented at some point, really handy feature. I'm surprised it wasn't automatically included.

That workaround is doable, little bit ugly, but doable.

Though, working in C++ doesn't sound like too bad an idea either...

Thanks for the help! Let's see how this works out.