toying with arrays - help pls

BlitzMax Forums/BlitzMax Beginners Area/toying with arrays - help pls

The forum is locked. These are the original blitzbasic.com forums, kept so they can still be read. No new topics, replies or edits can be made here. To join in, head over to the Blitz3D+ forums.

to explain a bit more a 320pix image is 10 32pix sprites they are added to the array at points 0-9
SuperStrict
Global iwidth%,iheight%
Global twidth%=32,theight%=32
Global tilesx%,tilesy%
Global imagemap:TImage[tilesx,tilesy]

'GFX SETUP

SetGraphicsDriver GLMax2DDriver()
'SetGraphicsDriver GLGraphicsDriver()
Graphics 1024,768,32,60

Function iLoad(image_path:String)
	Local image:TImage = LoadImage(image_path)
	iwidth = ImageWidth(image)
	iheight = ImageHeight(image)
	tilesx%=iwidth/twidth
	tilesy%=iheight/theight
	imagemap = New TImage[tilesx,tilesy]
	DebugLog "Variables Set."
End Function

Function iTile(image_path:String)
	Local animimage:TImage = LoadAnimImage(image_path , twidth , theight , 0 , tilesx*tilesy)
	Local counti%=0
	For Local i% = 0 Until tilesy-1
		For Local j% = 0 Until tilesx-1
			imagemap[j,i] = LoadImage(animimage.pixmaps[counti])
			counti:+1
		Next
	Next
	DebugLog "Added "+ counti +" images."
End Function

Function Drawtiles()
	'DebugStop()
	For Local i% = 0 Until tilesx-1
		For Local j% = 0 Until tilesy-1
			DrawImage (imagemap[i,j],i*twidth,j*theight)
		Next
	Next
	DebugLog "Tiles Drawn"
End Function

iLoad ("tilerender_test1.bmp")
iTile ("tilerender_test1.bmp")
Drawtiles()
'For Local i% = 0 Until tilesx-1
'	DrawImage (imagemap[i,3],i*32,0)
'Next

Flip
WaitKey

EndGraphics