the code is about 3000 line of code.....
i try to post some function instead
the strange thing is i can use those 2 variable ONLY for movement,but not for collision detection or object creations...
Here's some function
If in my main i call in a row the function for move and after the function to create object...i have a error that the object don't exist and the debugger point me to the two variable that hold the x and y position of the moving object...
i try to post some function instead
the strange thing is i can use those 2 variable ONLY for movement,but not for collision detection or object creations...
Here's some function
Function load_mainjet(image) jet.main_jet=New main_jet jet\posizionex=320;jet\posizionex+(JoyX()*jet\velocita) jet\posizioney=240;jet\posizioney+(JoyY()*jet\velocita) jet\immagine=image jet\potenza=1 jet\resistenza=20 ;successivamente si applicheranno dei modificatori (power-up) jet\velocita=1 End Function ;*now the move function Function draw_mainjet() For jet.main_jet=Each main_jet ;***** aggiunta per simulare le virate del jet assex=JoyX()*2 assey=JoyY()*2 jet\posizionex=jet\posizionex+assex jet\posizioney=jet\posizioney+assey If x => 630 Then x=x-2 If x <= 10 Then x=x+2 If startmov=0 Then fotogramma_jet=3 If joypad=0 And startmov=1 ;no left or right direction pulled and no animation started If MilliSecs()> counter+50 counter=MilliSecs() If fotogramma_jet > 3 current_frame=fotogramma_jet fotogramma_jet=current_frame-1 If fotogramma_jet=3Then fotogramma_jet=3:startmov=0 ;reset the anim to not started... EndIf If fotogramma_jet < 3 current_frame=fotogramma_jet fotogramma_jet=current_frame+1 If fotogramma_jet=3 Then fotogramma_jet=3:startmov=0 ;reset the anim to not started... EndIf EndIf EndIf If joypad=1 Then ;if joypad pull right startmov=1 If MilliSecs() > timer + 150 timer=MilliSecs() current_frame=fotogramma_jet fotogramma_jet=current_frame+1 If fotogramma_jet => 6 Then fotogramma_jet=6 EndIf EndIf If joypad=-1 Then ;if joypad pull left startmov=1 If MilliSecs() > timer + 150 timer=MilliSecs() current_frame=fotogramma_jet fotogramma_jet=current_frame-1 If fotogramma_jet < 0 Then fotogramma_jet=0 EndIf EndIf ;***** fine aggiunte... If jet\resistenza <= 0 crea_esplosione(jet\posizionex,jet\posizioney) Delete jet jetdistrutto=True Exit EndIf DrawImage(jet_image,jet\posizionex,jet\posizioney,fotogramma_jet) Next End Function ; strange is that the object move but don't loop trough anim frames.... ; here the object creation function.. Function spara_proiettili() If hi_score<=100 ;un rudimentale sistema di power-up crea_proiettile(bullet_image,6,1,jet\posizionex,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
If in my main i call in a row the function for move and after the function to create object...i have a error that the object don't exist and the debugger point me to the two variable that hold the x and y position of the moving object...