I wouldn't code it like this but it's what you asked for
and I am sure there'll be bugs in it.
You should check Blitz2D Newbies: Basic Map File Loading & Scrolling which will still help for BlitzMax especially as you're not using OOP.
The Orientation tutorial here might help as well.
SuperStrict Graphics 800, 600 Global grass:TImage = LoadImage("grass.png") Const MAPWIDTH:Int = 8000 / 32 Const MAPHEIGHT:Int = 8000 / 32 Global MapStartX:Int = 0 Global MapStartY:Int = 0 Global MapArray:Int[MAPWIDTH, MAPHEIGHT] Global mapx_offset:Int,mapy_offset:Int For Local x:Int = 0 Until MAPWIDTH For Local y:Int = 0 Until MAPHEIGHT MapArray[x, y] = Rand(0, 3) Next Next While Not KeyHit(KEY_ESCAPE) Cls DrawGrass() Flip Wend Function DrawGrass() Local endmapx:Int,endmapy:Int If mapx_offset+25 > mapheight endmapx=mapwidth Else endmapx=mapx_offset+25 EndIf If mapy_offset+18 > mapheight endmapy=mapheight Else endmapy=mapy_offset+25 EndIf For Local x:Int = mapx_offset To endmapx For Local y:Int = mapy_offset Until endmapy If MapArray[x, y] = 1 DrawImage grass, MapStartX + x * 32, MapStartY + y * 32, 0 EndIf Next Next End Function
and I am sure there'll be bugs in it.
You should check Blitz2D Newbies: Basic Map File Loading & Scrolling which will still help for BlitzMax especially as you're not using OOP.
The Orientation tutorial here might help as well.