I use the for each because if i don't all the field type return me the error" variable musty be a type" or "object don't exist" if i try to process some field type inside other function.
I don't understand what do you mean for different variable name....i use jet.mainjet because jet.mainjet is the type instance....if i use,for example,this_jet.mainjet=each mainjet....if i try to access type field inside other function...i get a "object doesn't exist" error...because i don't have declared global the instance of this_jet.mainjet
Now i write some code to see if you tell me (if you want of course!) what the error is.
In this function i use 3 calls to millisecs() in a row....so if i take the same code in a function don't work....if i take the EXACT code in the main...work!
Orologio is declared global at the start of the code.
I don't understand what do you mean for different variable name....i use jet.mainjet because jet.mainjet is the type instance....if i use,for example,this_jet.mainjet=each mainjet....if i try to access type field inside other function...i get a "object doesn't exist" error...because i don't have declared global the instance of this_jet.mainjet
Now i write some code to see if you tell me (if you want of course!) what the error is.
In this function i use 3 calls to millisecs() in a row....so if i take the same code in a function don't work....if i take the EXACT code in the main...work!
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 ;x=x+assex ;y=y+assey ;If x => 630 Then x=x-2 ;If x <= 10 Then x=x+2 If startmov=0 Then fotogramma2=3 If joypad=0 And startmov=1 ;no left or right direction pulled and no animation started If orologio > counter+50 counter=orologio 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 ;For jet.main_jet = Each main_jet If jet\resistenza <= 0 crea_esplosione(jet\posizionex,jet\posizioney) Delete jet jetdistrutto=True Exit EndIf ;Next 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
Orologio is declared global at the start of the code.