Sorry about the Rhyme :p . Anyways, I'm currently working on a map generator script for a 2d tile based map editor. However, I've run into yet another problem I can't seem to solve. Alright, so at the beginning of my code, I define this Dynamic Array:
Type type_Tiles
x `image xpos
y `Image ypos
TrueX `Xposition of tile in game.
YrueY `Yposition of tile in game.
il `Image left border
ir `Image Right border
it `Image top border
ib `Image bottom border
solid `Solid/Not solid.
endtype
Dim Array_MapTile(0) as type_Tiles `Generated map size in tiles.
This is defined with all my globals of course at the beginning of the source file. The array will hold data for each individual Tile on the map.
The user is suppose to choose the screen width and height X x Y and then the code divides the X and Y by 16 to get the number of tiles (variable local_TotalTiles). The code to do this happens within a Function as well, which is why I can't (I think) define a global Array thatI can access in any function.
if twGetGadgetLeftClickCount(g_MakeMap) > 0
local_MapX$ = twGetGadgetText(g_MapSizeX)
local_MapY$ = twGetGadgetText(g_MapSizeY)
local_MapX = val(local_MapX$) : local_MapY = val(local_MapY$)
local_TotalTiles = (g_MapSizeX / 16) * (g_MapSizeY / 16)
local_BorderCount = 0
it = 131 : il = 0 : ir = 16 : ib = 147 `setup individual map tile bounds.
`Generate Tile Spaces.
for local_CurTile = 1 to local_TotalTiles
add to queue Array_MapTile()
Next local_CurTile
endif
However, if I try to create anything with say 1000+ tiles the program just completely locks up. I just think there has to be another way to accomplish what I want. Perhaps I'm not using the dynamic arrays correctly? Any ideas?
Check out my dev forums at:
http://z15.invisionfree.com/ProjectRWP