I guess it couldn't be simpler than this!
Graphics 640,480
image=CreateImage(16,16,3) ; 3 image frames of 16x16 pixels
; let's make 3 images
SetBuffer ImageBuffer(image,0) ; frame 0, dark blue sky
ClsColor 0,0,64:Cls
SetBuffer ImageBuffer(image,1) ; frame 1, brick
ClsColor 192,64,9:Cls
Color 160,160,160
Rect 0,0,16,2
Rect 0,8,16,2
Rect 4,0,2,8
Rect 12,8,2,8
SetBuffer ImageBuffer(image,2) ; frame 2, some sorta blockwhatever
ClsColor 160,160,160:Cls
Color 224,224,224
Rect 0,0,15,1
Rect 0,0,1,15
Color 96,96,96
Rect 1,15,15,1
Rect 15,1,1,15
SetBuffer BackBuffer()
Dim map(32,24)
For y=0 To 23
For x=0 To 31
Read map(x,y)
Next
Next
For y=0 To 23
For x=0 To 31
DrawImage image,x*16,y*16,map(x,y)
Next
Next
Flip
WaitKey()
End
Data 1,0,0,0, 0,0,0,0, 0,0,0,0, 0,0,0,0, 0,0,0,0, 0,0,0,0, 0,0,0,0, 0,0,0,1
Data 1,0,0,0, 0,0,0,0, 0,0,0,0, 0,0,0,0, 0,0,0,0, 0,0,0,0, 0,0,0,0, 0,0,0,1
Data 1,0,0,0, 0,0,0,0, 0,0,0,0, 0,0,0,0, 0,0,0,0, 0,0,0,0, 0,0,0,0, 0,0,0,1
Data 1,0,0,0, 0,0,0,0, 0,0,0,0, 0,0,0,0, 0,0,0,0, 0,0,0,0, 0,0,0,0, 0,0,0,1
Data 1,0,0,0, 0,0,0,0, 0,0,0,0, 0,0,0,0, 0,0,0,0, 0,0,0,0, 0,0,0,0, 0,0,0,1
Data 1,0,0,0, 0,0,0,0, 0,0,0,0, 0,0,0,0, 0,0,0,0, 0,0,0,0, 0,0,0,0, 0,0,0,1
Data 1,0,0,0, 0,0,0,0, 0,0,0,0, 0,0,0,0, 0,0,0,0, 0,0,0,0, 0,0,0,0, 0,0,0,1
Data 1,0,0,0, 0,0,0,0, 0,0,0,0, 0,0,0,0, 0,0,0,0, 0,0,0,0, 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0, 0,0,0,0, 0,2,0,0, 0,0,0,1
Data 1,0,0,0, 0,0,0,0, 0,0,0,0, 0,0,0,0, 0,2,2,0, 0,0,0,0, 0,2,0,0, 0,0,0,1
Data 1,1,1,1, 1,1,1,1, 1,1,1,1, 1,1,1,1, 1,1,1,1, 1,1,1,1, 1,1,1,1, 1,1,1,1
It's a 2d map. But using DATA like this is not how typical games are being made. People use an external map editor, and import such a map file as a binary file into Blitz[any version]. You can also create functions to actually generate the content of such arrays, but that's a lesson for a later moment.. :P
|