3 dimensional array

BlitzPlus Forums/BlitzPlus Programming/3 dimensional array

loonix(Posted 2015) [#1]
Hi all.....

I have been trying to work out this simple array, (well i though it was simple!)
the data are for x,y,frame cords'
i just want to read them to an array so i can just run through a loop to display them.... i have been messing about with the following code and i have tried all of the avail combinations but alas the closest i can get to displaying anything is that everything gets bunched up in the top left corner of the screen.... if any one can see the hole in it ,i would be eternally grateful ....
Graphics 512,384,16,2
SetBuffer BackBuffer()


Global item=LoadAnimImage("items.png",16,16,0,7)

Dim items(1,3,11)
	For c = 1 To 11
		For b = 1 To 3
			For a = 1 To 1
				
				Read items(a,b,c)
			
			Next
		Next
	Next
	
	
	Data 144,0,6
	Data 256,16,1
	Data 144,20,6
	Data 144,40,6
	Data 144,60,6
	Data 144,80,6
	Data 144,100,6
	Data 144,120,6
	Data 144,140,6
	Data 144,160,6
	Data 144,180,6


	While Not KeyHit(1)
	
	Cls


	For a = 1 To 11
		For b = 1 To 3
			For c = 1 To 1
		
				DrawImage(item,a,b,c)
		
			Next
		Next
	Next
		
		
		
	
	Flip
	
	Wend
	
	End



Midimaster(Posted 2015) [#2]
For this you only need a two dimensional array. Because you have 11 items (1st dimension) and the have 3 parameters (2nd dimension).

And the way you are reading is wrong:
Dim items[11,3]
.....
For i=1 to 11
         Read items[i,1]
         Read items[i,2]
         Read items[i,3]
Next
.....
For i=1 to 11
         DrawImage item, items[i,1], items[i,2], items[i,3]
Next



loonix(Posted 2015) [#3]
God damn it !!!
I knew it was simple... just couldn't see it

Many thanks, and a lesson learned..