A Wee Tank Game

Miscellaneous Forums/Blitz Showcase/A Wee Tank Game

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.

Anyone asked for 'in-code' sound effects?
Print "You have a 12 mm stationary machinegun"
Print "The enemy is attacking!"
Const lenght=9600*6-1
Dim sarr#(lenght)
For a=0 To 180 Step 5
	factor#=Sin(a)
	rate=(1+a)*1
	arrsize=lenght/rate+5
	Dim fixs#(arrsize)
	For b=0 To arrsize
		fixs(b)=Rnd(-1,1)*factor*.99990^(b*rate)
	Next
	For b=0 To lenght
		a1#=fixs(b/rate)
		a2#=fixs(b/rate+1)
		b2#=b Mod rate
		b1#=(rate-b2)/rate
		b2=b2/rate
		sarr(b)=sarr(b)+a1*b1+a2*b2
	Next
Next
out=WriteFile("gun.wav")
WriteByte out,16*5+2
WriteByte out,16*4+9
WriteByte out,16*4+6
WriteByte out,16*4+6
WriteByte out,16*6+14
WriteByte out,16*12+2
WriteByte out,16*0+1
WriteByte out,16*0+0
WriteByte out,16*5+7
WriteByte out,16*4+1
WriteByte out,16*5+6
WriteByte out,16*4+5
WriteByte out,16*6+6
WriteByte out,16*6+13
WriteByte out,16*7+4
WriteByte out,16*2+0
WriteByte out,16*1+0
WriteByte out,16*0+0
WriteByte out,16*0+0
WriteByte out,16*0+0
WriteByte out,16*0+1
WriteByte out,16*0+0
WriteByte out,16*0+1
WriteByte out,16*0+0
WriteByte out,16*0+0
WriteByte out,16*7+7
WriteByte out,16*0+1
WriteByte out,16*0+0
WriteByte out,16*0+0
WriteByte out,16*14+14
WriteByte out,16*0+2
WriteByte out,16*0+0
WriteByte out,16*0+2
WriteByte out,16*0+0
WriteByte out,16*1+0
WriteByte out,16*0+0
WriteByte out,16*6+4
WriteByte out,16*6+1
WriteByte out,16*7+4
WriteByte out,16*6+1
WriteInt out,lenght*2+2
For a=0 To lenght
	If a<300 Then sarr(a)=sarr(a)*a/300.0
	If a>20000 Then sarr(a)=sarr(a)+.12*sarr(a-20000)
	WriteShort out,Int(sarr(a)*4000)
Next
CloseFile out
sound=LoadSound("gun.wav")
DeleteFile("gun.wav")
Print "Fire at will!"
timer=MilliSecs()*2
While Not KeyHit(1)
	If KeyDown(57) Then channel=PlaySound(sound)
	While timer>MilliSecs()*2
		Delay 1
	Wend
	timer=timer+125
Wend