Arrays

BlitzPlus Forums/BlitzPlus Programming/Arrays

Podge(Posted 2008) [#1]
Hi guys, its been along time since I dabbled with Blitz but its time to ditch the SQL and do some proper programming! Thing is, after all these years I forgotten the basics.

I'd like the code below to output (reflecting the order in the array):-

12
34

Instead its outputting like:-

1
23
4

Where am i going wrong?!

Graphics 800,600
Dim screenTiles(2,2)

Restore tileData

For rows = 1 To 2
For columns = 1 To 2
Read screenTiles(rows,columns)
Next
Next

textX = 0
textY = 0

For rows = 1 To 2
For columns = 1 To 2

Text textx,texty,screentiles(rows,columns)

textx = columns * 16 - 16
texty = rows * 16


Next
Next

WaitKey()

End


.tileData
Data 1,2
Data 3,4


Floyd(Posted 2008) [#2]
You are displaying the text before setting the textx,texty values. It should be like this:

		textx = columns * 16 - 16
		texty = rows * 16 

		Text textx,texty,screentiles(rows,columns)



Podge(Posted 2008) [#3]
Nice one Floyd, it just shows how years of programming in Access/SQL can destroy your coding knowledge! Thanks fellah.