Arrays

BlitzPlus Forums/BlitzPlus Programming/Arrays

The Forum Archive is locked. These are the original blitzbasic.com forums, kept so their posts can still be read and searched. No new topics, replies or edits can be made here. To join the conversation, head over to the Blitz3D+ forums.

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

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)


Nice one Floyd, it just shows how years of programming in Access/SQL can destroy your coding knowledge! Thanks fellah.