Level Structure

BlitzPlus Forums/BlitzPlus Beginners Area/Level Structure

Tau_Aquilae(Posted 2010) [#1]
I have been playing with blitz for a little while now but there is something that I really don't get.....Level structure. I've seen something along the lines of this and Despite looking at the sample programs/games I have no clue how it works....now I DO know it has something do do with this

*it may or may not look like this....I dont have a reference on hand right now.....but lets say its for blitzanoid just for the heck of it

.level_1
data 0,0,0,0,0,0,0,0
data 1,1,1,0,0,2,2,2
data 1,1,1,0,0,2,2,2
data 0,0,0,0,0,0,0,0
data 0,0,0,0,0,0,0,0
data 0,0,0,0,0,0,0,0


Now I understand that each number represents something in the level (like a block in blitzanoid for this example) but how on earth is this called? And how on earth is does it work? Also, where do you define it?

That is all...


CS_TBL(Posted 2010) [#2]
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,  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,2,0,  0,0,0,0,  0,0,0,0,  0,2,0,0,  0,0,0,0,  0,0,0,0,  0,0,0,1
Data 1,0,0,0,  1,1,1,1,  0,0,0,0,  0,0,0,1,  1,1,1,1,  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,1,  0,0,0,0,  0,0,0,0,  1,1,1,1,  1,1,1,1
Data 1,0,0,0,  0,0,0,0,  0,0,0,0,  0,0,0,1,  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,1,  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,1,  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,  1,1,1,1,  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,  1,1,1,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,2,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


Tau_Aquilae(Posted 2010) [#3]
Yeah I figured I would use Paint to make something, although I could still use this (Weapon spawns, AI paths...and the sort)


Thanks though!