Delay when fireing

Blitz3D Forums/Blitz3D Beginners Area/Delay when fireing

Here's the function i have writed times ago for a simple game...it fire a bullet at a certain time-rate...
Function create_missile() 
	a.missile=New missile
	a\image=missile
	a\posx=MouseX() ;the x position of missile creation is the mouse coords(the same coords of my jet of course) 
	a\posy=a\posy+MouseY()-30 ;the missile creation start a bit up to the jet(for simulating the launch-bay hehe) 
	a\avanzamento=4 ;the speed of the missile 
	a\contatore=0 ;the starting value of the animation 
End Function 

Function play_missile() 
	For a.missile=Each missile  
		DrawImage a\image,a\posx,a\posy 
		a\posy=a\posy-a\avanzamento ;this move the missile up 
		a\contatore=a\contatore+a\avanzamento ;this start the counter of the missile course 
		For b.alieno=Each alieno
			If ImagesCollide(a\image,a\posx,a\posy,0,b\image,b\movx,b\movy,0) ;if the alien collide with the missile the energy go down of one unit
					b\energia=b\energia-1
					If b\energia=<0 Then ;Delete b
					crea_esplosione()
					Delete b
					EndIf
					Delete a ;if the missile collide with the alien the missile stop it's existance :P
					Exit ;exit loop if missile is dead. will cause error as they's no missile to check against the aliens
			EndIf
		Next
	Next 
End Function 

And here's some snippet of the main code to shoot at intervals while holding the mouse button!
DrawImage aereo,MouseX(),MouseY() 
	
	If MouseDown(1)=1 ;if i hit the mouse button i create a missile 
	
		If MilliSecs() > timer_proiettili1 + 150 ;i use a "slowdown"of 100 millisecs to each fired bullet
		timer_proiettili1=MilliSecs() 
			create_missile() 
		EndIf 
	EndIf
	
	play_missile() ;this start the missil anim


I hope it's clear....