Creating Track Map

Blitz3D Forums/Blitz3D Beginners Area/Creating Track Map

The forum is locked. These are the original blitzbasic.com forums, kept so they can still be read. No new topics, replies or edits can be made here. To join in, head over to the Blitz3D+ forums.

Yes, first draw the map onto a temp. image.
This image needs to be masked. Then draw the circle mask on it. The circle map is another transparent image: the circle should be transparent and the rest should be filled with the transparent color of the first image.
The temp. image and the circle mask image should have different transparent colors and the transparent color of the temp. image should not appear in the tiles of the map:
	;setup graphics
	Graphics 800, 600, 0, 2
	SetBuffer BackBuffer()
	
	;create mask image (black circle on purple background)
	mask = CreateImage(100, 100)
	SetBuffer ImageBuffer(mask)
	Color 255, 255, 0
	Rect 0, 0, 100, 100
	Color 0, 0, 0
	Oval 0, 0, 100, 100
	
	;create temp image (purple=transparent)
	temp = CreateImage(100, 100)
	MaskImage temp, 255, 255, 0
	MidHandle temp
	
	;main loop
	Repeat
	
		;draw to temp image
		SetBuffer ImageBuffer(temp)
		Cls
		
		;draw random text
		Color 255, 255, 255
		For i = 0 To 50
			p$ = ""
			For t = 1 To 6
				p$ = p$ + Chr$(Rand(65, 65+26))
			Next
			Text Rand(100), Rand(100), p$, 1, 1
		Next
		
		;draw circle mask
		DrawImage mask, 0, 0
		
		;draw on backbuffer
		SetBuffer BackBuffer()
		
		;draw background lines
		Cls
		Color 0, 0, 255
		For i = 0 To 800 Step 20
		Line i, 0, i, 600
		Line 0, i, 800, i
		Next
		
		;draw temp image, leaving out purple parts
		DrawImage temp, 400 + Sin(time) * 200, 300
		time = time + 1
		
		Flip
		
	Until KeyHit(1)
	
	End