Object "flicker"when deleted

Blitz3D Forums/Blitz3D Beginners Area/Object "flicker"when deleted

Hey, glad it works. :)

As I said before, the main cause was using Exit when you didn't need it. For example, your original muovi_proiettile() function:

Function muovi_proiettile()

	For missile.bullet=Each bullet
		missile\durata=missile\durata-1
		missile\positionx=missile\positionx
		missile\positiony=missile\positiony-missile\velocita
		counter=counter+1
		DrawImage (missile\immagine,missile\positionx,missile\positiony)
		If missile\durata=<0
			Delete missile
			Exit ;<-------- error!
		EndIf
	
		For a.alieno =Each alieno
			If ImagesCollide(bullet_image,missile\positionx,missile\positiony,0,ObjectFrames(fotogramma),a\posizionex,a\posizioney,0)
				a\vitalita=a\vitalita-missile\potenza
				Delete missile
				Exit
			EndIf
		Next
	Next

End Function


I have marked an Exit command as an error. This is wrong because it causes the 'For missile.bullet = Each bullet' loop to be exited whenever a missile's 'durata' reaches zero, meaning all the remaining bullet's that come after it in the type list don't get processed OR drawn for that frame. This constantly causes some bullets to get drawn on some frames, but not on others, hence the flickering.