Bug or my fault? (types related)

Blitz3D Forums/Blitz3D Beginners Area/Bug or my fault? (types related)

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.

Ok i have tried to recreate some code that do the same error:
Graphics 640,480,32,2

Global bullet_image=LoadImage("bullet1.bmp")
Global bomb_image=LoadImage("bullet3.bmp")
Global jet_image=LoadAnimImage("jet-strip1.bmp",42,54,0,7)
Global jet.main_jet
Global assex
Global assey
Global joypad
Global x=320
Global y=240
MidHandle jet_image
MidHandle bomb_image
MidHandle bullet_image
Global missile.bullet	






Type bullet
	Field immagine
	Field positionx
	Field positiony
	Field potenza
	Field velocita
	Field durata
End Type

Type main_jet
	Field posizionex
	Field posizioney
	Field immagine
	Field potenza
	Field resistenza
	Field velocita
End Type

Function load_mainjet(image)
	jet.main_jet=New main_jet
	jet\posizionex=320
	jet\posizioney=240
	jet\immagine=image
	jet\potenza=1
	jet\resistenza=20		;successivamente si applicheranno dei modificatori (power-up)
	jet\velocita=1
End Function

Function crea_proiettile(immagine,speed,power,posx,posy,lunghezza)
	missile.bullet=New bullet
	missile\immagine=immagine
	missile\positionx=posx
	missile\positiony=posy
	missile\potenza=power
	missile\velocita=speed
	missile\durata=lunghezza
End Function


Function spara_proiettili()
	If hi_score<=100	;un rudimentale sistema di power-up
		crea_proiettile(bullet_image,6,1,jet\posizionex-10,jet\posizioney-20,50)	;proiettilenormale
	EndIf
	If hi_score >100	;se il punteggio e superiore a 100 crea un altro proiettile...
						;posso usare un'altra condizione(aver raccolto un power-up)
						;aumentare il danno ecc ecc
		crea_proiettile(bullet_image,6,1,jet\posizionex-10,jet\posizioney-20,50)	;proiettilenormale
		crea_proiettile(bullet_image,6,1,jet\posizionex+10,jet\posizioney-20,50)	;proiettilenormale
	EndIf
End Function


Function muovi_proiettile()

	For missile.bullet = Each bullet
		missile\durata = missile\durata-1
		

		If missile\durata=<0
			Delete missile
		Else
			missile\positionx = missile\positionx ;This does nothing.
			missile\positiony = missile\positiony-missile\velocita
			counter = counter+1 ;This doesn't appear to be used.
			DrawImage (missile\immagine,missile\positionx,missile\positiony)
		EndIf		
	Next
End Function


Function prova()
	For jet.main_jet=Each main_jet
		assex=JoyX()*2
		assey=JoyY()*2
		joypad=JoyX()
		jet\posizionex=jet\posizionex+assex
		jet\posizioney=jet\posizioney+assey
		If jet\posizionex => 630 Then jet\posizionex=jet\posizionex-2
		If jet\posizionex <= 10 Then jet\posizionex=jet\posizionex+2
		If startmov=0 Then fotogramma2=3
		
		If joypad=0 And startmov=1	;no left or right direction pulled and no animation started
			If MilliSecs() > counter+50
				counter=MilliSecs()
				If fotogramma2 > 3
					current_frame=fotogramma2
					fotogramma2=current_frame-1
					If fotogramma2=3
						fotogramma2=3
						startmov=0	;reset the anim to not started...
					EndIf
				EndIf
				If fotogramma2 < 3
					current_frame=fotogramma2
					fotogramma2=current_frame+1
					If fotogramma2=3 
						fotogramma2=3
						startmov=0	;reset the anim to not started...
					EndIf
				EndIf
			EndIf
		EndIf

		If joypad=1 Then 	;if joypad pull right
			startmov=1
			If orologio > timer + 150
				timer=orologio
				current_frame=fotogramma2
				fotogramma2=current_frame+1
				If fotogramma2 => 6 Then fotogramma2=6
			EndIf
		EndIf

		If joypad=-1 Then	;if joypad pull left
			startmov=1
			If orologio > timer2 + 150
				timer2=orologio
				current_frame=fotogramma2
				fotogramma2=current_frame-1
				If fotogramma2 < 0 Then fotogramma2=0
			EndIf
		EndIf
		
		If jet\resistenza <= 0 
			Delete jet
			jetdistrutto=True
			Exit
		EndIf
		
		DrawImage(jet_image,jet\posizionex,jet\posizioney,fotogramma2)
		jet_collisionx=jet\posizionex
		jet_collisiony=jet\posizioney
		DebugLog fotogramma2
		DebugLog timer
		DebugLog counter
		DebugLog startmov
		DebugLog orologio
	Next
End Function



;M A I N 
load_mainjet(jet_image)

While Not KeyHit(1)=True
SetBuffer BackBuffer() : Cls
joybutton1=JoyHit(1)
joybutton2=JoyHit(2)	
prova()
If jetdistrutto=False	;se il jet non e stato distrutto spari,altrimenti non spari ^^
	If joybutton1=True		;se premo il tasto sinistro del mouse
		spara_proiettili()
	EndIf
	If joybutton2=True ;se premo il tasto destro del mouse
		crea_proiettile(bomb_image,4,5,jet\posizionex,jet\posizioney-20,30)	;proiettile + potente (bomba)
	EndIf
EndIf

muovi_proiettile()

Flip True
Wend


Now when you hit the two joypad button....the error occur.
The same error that some other function in other program gave me!(so i think i made the same error)