nostalgie
Publié : mar. 06/nov./2007 21:14
				
				yo, j' ai bien aimé le jeu "mine storm" sur vectrex.
je me suis amusé, a le refaire sous pure...
en basic, pas en asm, une premiere pour moi !
 
voici, le code , pas vraiment finie, mais jouable. je le peaufinerai...
			je me suis amusé, a le refaire sous pure...
en basic, pas en asm, une premiere pour moi !
voici, le code , pas vraiment finie, mais jouable. je le peaufinerai...
Code : Tout sélectionner
InitSprite():InitKeyboard() :InitSound()                                      
Dim depastx.f(300): Dim depasty.f(300):Dim dirastx.f(300) :Dim dirasty.f(300):Dim tailast.f(300):Dim vitast.f(300):Dim typast(300)
Dim postirxx.f(200):Dim postiryy.f(200):Dim tirxx.f(200):Dim tiryy.f(200):Dim angtx.f(200):Dim angty.f(200):Dim typtir(200):Dim tramtir(200):Dim cielx(200):Dim ciely(200):Dim tail_ciel(200)
Dim posproxx.f(2000):Dim posproyy.f(2000):Dim proxx.f(2000):Dim proyy.f(2000):Dim trampro(2000):Dim typpro(2000)
Dim alienx.f(1):Dim alieny.f(1):Dim depalienx.f(1):Dim depalieny.f(1)
ExamineDesktops():larg=DesktopWidth(0):long = DesktopHeight(0):Depth=DesktopDepth(0):OpenScreen(larg,long,Depth,"")  
larg1.f=larg:long1.f=long:posx.f:posy.f:rotm.f:rotm1.f:angle_l.f 
pi.f=3.14159:pi2.f=3.14159/2:level=1
friction.f=0.99
vitesse.f=0.10
test_vais.l
test_enne.l
tail.f:
tail_ast.f
vit_ast.f
posalienx.f
posalieny.f
angtxx.f:angtyy.f
    depastx2.f
    depasty2.f
     depastx1.f
    depasty1.f
    zone.f=10
    ori_prox.f:ori_proy.f
angle_tir.f:ori_tirx.f:ori_tiry.f:nb_trame.l:vit_tir.f
tram.l:tram1.l:vaisseau.l:vaisseau1.l:ver_sound_vai.l:ver_sound_exp.l:ver_sound_exp1.l:ver_sound_tir.l
depmx.f:depmy.f:cosrot.f:sinrot.f:tirx.f:tiry.f:postirx.f:postiry.f:initirx.f:initiry.f
tirx1.f:tiry1.f:postirx1.f:postiry1.f:initirx1.f:initiry1.f:long_tir.f:init_angle_ast.f
angle_asterox.f:angle_asteroy.f: cos_magnet.f:sin_magnet.f
angle_tirx.f:angle_tiry.f
vie1=3
Gosub init_jeu
Gosub gene_son
init:
StopSound(1)
StopSound(2)
StopSound(3)
StopSound(8)
StopSound(0)
Gosub moins_vie
test_vais=1
test_enne=0
nb_astero=0
For nb_tir=0 To 200:typtir(nb_tir)=0 :Next
For nb_ast=0 To 300:typast(nb_ast)=0 :Next
For nb_pro=0 To 2000:typpro(nb_pro)=0 :Next
trame22=0
trame2=0
trame222=0
ene_oui=0
posx=larg/2
posy=long/2
rotm=0
tram=0:tram1=0:vaisseau=10:vaisseau1=1:ver_sound_vai=0:ver_sound_exp=0:ver_sound_exp1=0:ver_sound_tir=0
depmx=0:depmy=0:postirx=1000:postiry=1000
postirx1=1000:postiry1=1000: tail_l.f=1
Gosub num_level
   main: 
   
   
   If vie1=0:Delay(20):Goto saut1:EndIf
   
    If test_vais=0 And nb_trame=1900:vie1-1:Gosub moins_vie: Goto init:EndIf  
    If nb_astero=256 :level+1 :Goto init: EndIf
    saut1:
   
 ;   Delay(10)                                   
    ClearScreen(0)                            
    ExamineKeyboard()  
    trame1+trame 
    trame2+trame22
    StartDrawing(ScreenOutput())  
    Gosub convasci
    tail_l.f=0.6
         dep_cl.f=0
 dep_car.f=0
  pos_lx=20
   pos_ly=30
depx_car.f=(30*tail_l)
depy_car=0;(35*tail_l)
angle_l=0
adress=?score
    Gosub message1  
     If vie1=0: test_vais=0:Gosub over:Goto finie_jeu:EndIf
    
     
    If trame22=0
    level2=level+18
   
    trame2+1:If trame2>200: trame22=1: EndIf
        tail_l.f=0.6
         dep_cl.f=0
 dep_car.f=0
  pos_lx=larg-200
   pos_ly=long-30
depx_car.f=(30*tail_l)
depy_car=0;(35*tail_l)
angle_l=0
adress=?vie
    Gosub message1  
    
     tail_l.f=1
     dep_cl.f=0
 dep_car.f=0
  pos_lx=larg/2-140
   pos_ly=long/2-50
depx_car.f=(30*tail_l)
depy_car=0;(35*tail_l)
angle_l=0
adress=?niveau
    Gosub message1  
   
    
    
    If level>9 :level1.l=19 : dep_l.l=level1*32*4
    pos_lx=larg/2+100
    Gosub message:level2.l=level+8:EndIf
    dep_l.l=level2*32*4
    pos_lx=larg/2+125
    Gosub message
    EndIf 
    
    
  finie_jeu:
   Gosub ciel   
   Gosub vaisseau
   Gosub  aff_tir
   Gosub asteroide 
   Gosub enemi
   Gosub col_tir
    Gosub col_obj
   Gosub affpro
   
StopDrawing()                            
FlipBuffers()  
 Gosub clavier                                                 
        
  Goto main
 
 
 ;- colision tir ---
 col_tir:
  posalix=alienx(0)
  posaliy=alieny(0)
 For testt=0 To 199
  If  typtir(testt)=0 :Goto pas_testt:EndIf
    postirx=postirxx(testt)
  postiry=postiryy(testt)
 
  For testa=0 To 256
  If typast(testa)=0 :Goto pas_testa:EndIf
  depastx=depastx(testa)
  depasty=depasty(testa)
   zone1=zone*tailast(testa)
  If  postirx<depastx+zone1 And postirx>depastx-zone1 And postiry<depasty+zone1 And postiry>depasty-zone1
   ori_prox=depastx
 ori_proy=depasty
  If typast(testa)=2:score1+10:EndIf
  If typast(testa)=3:score1+20:EndIf
  If typast(testa)=5:score1+30:EndIf
  If typast(testa)=6:score1+40:EndIf
  If typast(testa)=11:score1+50:EndIf
  If typast(testa)=5 Or typast(testa)=6:Gosub creafra:EndIf:Gosub explosion_a:typtir(testt)=0:memtyp=typast(testa):typast(testa)=0:Gosub div_2:Goto pas_testt:EndIf
 pas_testa: 
  Next testa
  
  fragm:
  
  If  typtir(testt)=2 :Gosub tir_alien:Goto pas_testt: EndIf
  If  test_enne=0:Goto pas_testt: EndIf
  If  postirx<posalix+30 And postirx>posalix-30 And postiry<posaliy+30 And postiry>posaliy-30
  ori_prox=posalix
 ori_proy=posaliy
 typtir(testt)=0
 trame222=0:test_enne=0:StopSound(8)
 score1+100
 Gosub explosion_e:EndIf
  
 
 
  pas_testt:
 
 Next testt
 Return
 tir_alien:
  If test_vais=0:Return:EndIf
   If  postirx<posx+30 And postirx>posx-30 And postiry<posy+30 And postiry>posy-30
  ori_prox=posalix
 ori_proy=posaliy
 typtir(testt)=0
 Gosub explosion_v:test_vais=0:EndIf
 Return 
 div_2:
 memtail.f=tailast(testa)
 If memtail>2
 angle_asterox=Angty(testt)
 angle_asteroy=Angtx(testt)
 angle_asterox1.f=angle_asterox
 angle_asteroy1.f=angle_asteroy
 ori_astx=depastx(testa)
 ori_asty=depasty(testa)
 ori_astx1=ori_astx
 ori_asty1=ori_asty
 tail_ast=memtail-1
 vit_ast=4/(memtail-1)
 type_ast=memtyp
 
 ori_astx=ori_astx+angle_asterox*80
 ori_asty=ori_asty-angle_asteroy*80
 
 angle_asterox=angle_asterox1
 angle_asteroy=-angle_asteroy1
 Gosub creaast1
 
 ori_astx=ori_astx1-angle_asterox1*80
 ori_asty=ori_asty1+angle_asteroy1*80
 
 angle_asterox=-angle_asterox1
 angle_asteroy=angle_asteroy1
 Gosub creaast1
 EndIf
 Return
 col_obj:;- colision objet ---
  
   For testa1=0 To 256
  If typast(testa1)=0 :Goto pas_testa1:EndIf
  depastx=depastx(testa1)
  depasty=depasty(testa1)
 posalienx=alienx(0)
 posalieny=alieny(0)
   zone1=zone*tailast(testa1)
    If test_vais=0: Goto pas_testa2:EndIf
  If  posx<depastx+zone1+20 And posx>depastx-zone1-20 And posy<depasty+zone1+20 And posy>depasty-zone1-20
  ori_prox=posx
 ori_proy=posy
  Gosub explosion_v:test_vais=0:EndIf
  pas_testa2:
   If  test_enne=0:Goto pas_testa1:EndIf
   If  posalienx<depastx+zone1+20 And posalienx>depastx-zone1-20 And posalieny<depasty+zone1+20 And posalieny>depasty-zone1-20
  ori_prox=posalienx
 ori_proy=posalieny
  Gosub explosion_e:Gosub div_2:test_enne=0:trame222=0:EndIf
 pas_testa1:
  Next testa1
     
     If test_enne=0 Or test_vais=0:Return:EndIf
    If  posalienx-20<posx+20 And posalienx+20>posx-20 And posalieny-20<posy+20 And posalieny+20>posy-20
  ori_prox=posx
 ori_proy=posy
  Gosub explosion_v:test_vais=0
   ori_prox=posalienx
 ori_proy=posalieny
 trame222=0:test_enne=0
  Gosub explosion_e:EndIf 
 Return
 
 ;- *********************
 
enemi:;- ennemi
 If test_enne=1:Goto mouv_ennemi:EndIf
 trame222+1
 If trame222>2000
 test_enne=1
  PlaySound(8,1)
 
 alienx(0)=0
 alieny(0)=Random(512)
 depalienx(0)=2
 depalieny(0)=0.5
 EndIf
 Return  
mouv_ennemi:
 Gosub evit_astero
 If Random(150)=1 
 nb_trame=100
 magnet_x1.f=posx-alienx(0):magnet_y1.f=posy-alieny(0)
 If  magnet_x1>larg/2:magnet_x1=posx-larg -alienx(0): EndIf  
 If  magnet_x1<-larg/2:magnet_x1=posx+larg -alienx(0):EndIf 
 If  magnet_y1>long/2:magnet_y1=posy-long -alieny(0):EndIf
 If  magnet_y1< -long/2:magnet_y1=posy+long -alieny(0):EndIf
 vec_magnet1.f=Sqr(magnet_x1*magnet_x1+magnet_y1*magnet_y1)
 angle_tirx=-(magnet_x1/vec_magnet1):angle_tiry=-(magnet_y1/vec_magnet1)
 vit_tir=-4
 type_tir=2
 ori_tirx=alienx(0)
 ori_tiry=alieny(0)
 angtxx=angle_tirx
 angtyy=angle_tiry
 Gosub creatir1
 EndIf
 If Random(200)=1:depalienx(0)=Sin (Random(614)/100)*2:depalieny(0)=-Cos(Random(614)/100)*2:EndIf
 alienx(0)+depalienx(0)
 alieny(0)+depalieny(0)
 Gosub alien
 Return
 evit_astero:;-evite asteroide
 num_ast=0
 evite:
 If tailast(num_ast)=0:Goto pas_evite:EndIf
 ast_alix.f= depastx(num_ast)
 ast_aliy.f= depasty(num_ast)
 If  alienx(0)>ast_alix-80 And  alienx(0)<ast_alix+80 And  alieny(0)>ast_aliy-80 And  alieny(0)<ast_aliy+80
 depalienx(0)=dirastx(num_ast)*vitast(num_ast)*1.5
 depalieny(0)=dirasty(num_ast)*vitast(num_ast)*2
 EndIf
 pas_evite:
 num_ast+1
 If num_ast<16:Goto evite:EndIf
 Return
 aster_suiveur:;- suiveur
  If test_vais=0 :Return:EndIf
 magnet_x.f=posx-depastx(nbast_l):magnet_y.f=posy-depasty(nbast_l)
 If  magnet_x>larg/2:magnet_x=posx-larg -depastx(nbast_l): EndIf  
 If  magnet_x<-larg/2:magnet_x=posx+larg -depastx(nbast_l):EndIf 
 If  magnet_y>long/2:magnet_y=posy-long -depasty(nbast_l):EndIf
 If  magnet_y< -long/2:magnet_y=posy+long -depasty(nbast_l):EndIf
 vec_magnet.f=Sqr(magnet_x*magnet_x+magnet_y*magnet_y)
 dirastx(nbast_l)=(magnet_x/vec_magnet):dirasty(nbast_l)=(magnet_y/vec_magnet):Return
 clavier:;- clavier
 ExamineKeyboard()
 If  test_vais=0:Goto t_esc:EndIf 
 If  KeyboardPushed(#PB_Key_Left): rotm-0.1:If rotm<0 :rotm=2*pi :EndIf:EndIf
 If  KeyboardPushed(#PB_Key_Right):rotm+0.1:If rotm>2*pi :rotm=0 :EndIf:EndIf
 If  KeyboardPushed( #PB_Key_Up):depmx=depmx+Sin(rotm)*vitesse:depmy=depmy-Cos(rotm)*vitesse
 push0=1:Else:push0=0:EndIf
 If  KeyboardPushed( #PB_Key_Space):If verrou_tir<>0:verrou_tir=0
 nb_trame=50:angle_tir=rotm:vit_tir=-7:type_tir=1:ori_tirx=posx:ori_tiry=posy:
 angtxx=Sin(rotm):angtyy=-Cos(rotm):Gosub creatir :PlaySound(1,0)
 EndIf: Else:verrou_tir=1:EndIf:
 t_esc:
 If KeyboardPushed(#PB_Key_Escape):End:EndIf:Return:
 explosion_v:;- explosion vaisseau
 PlaySound(3,0):StopSound(0):For nomb_pro = 0 To 500:nb_trame=Random(200)+1:angle_pro.f=(Random (614))/100
 vit_pro.f=(Random(100)/40)+0.2:type_pro=1:ori_prox=posx:ori_proy=posy:Gosub creapro:Next:Return
 explosion_a:;- explosion asteroide 
 PlaySound(2,0):For nomb_pro = 0 To 50:nb_trame=Random(50)+1:angle_pro.f=(Random (614))/100
 vit_pro.f=(Random(100)/60)+1:type_pro=1:type_pro=1:Gosub creapro: Next:Return
 explosion_e:;- explosion  ennemi
 PlaySound(2,0):StopSound(8):For nomb_pro = 0 To 200:nb_trame=Random(50)+1:angle_pro.f=(Random (614))/100
 vit_pro.f=(Random(100)/60)+1:type_pro=1:type_pro=1:Gosub creapro: Next:Return
 creatir:;- création tir
 angle_tirx=-Sin(angle_tir):angle_tiry=Cos(angle_tir)
 creatir1:
 nb_tir2=0
 dej_tir1:
 If typtir(nb_tir2)<>0:nb_tir2+1:Goto dej_tir1:EndIf
 tramtir(nb_tir2)=nb_trame:tirxx(nb_tir2)=angle_tirx*vit_tir: tiryy(nb_tir2)=angle_tiry*vit_tir
 typtir(nb_tir2)=type_tir:postirxx(nb_tir2)=ori_tirx:postiryy(nb_tir2)=ori_tiry
 angtx(nb_tir2)=angtxx:angty(nb_tir2)=angtyy:Return
 creapro:;- création projectil
 angle_prox.f=-Sin(angle_pro):angle_proy.f=Cos(angle_pro)
 creapro1:
 nb_pro=0
 dej_pro:
 If typpro(nb_pro)<>0:nb_pro+1:Goto dej_pro:EndIf:trampro(nb_pro)=nb_trame
 proxx(nb_pro)=angle_prox*vit_pro:proyy(nb_pro)=angle_proy*vit_pro:typpro(nb_pro)=type_pro
 posproxx(nb_pro)=ori_prox:posproyy(nb_pro)=ori_proy:Return
 creafra:;- création fragment
 memtail.f=tailast(testa):angle_asterox1.f=Angty(testt):angle_asteroy1.f=Angtx(testt)
 ori_astx=depastx(testa):ori_asty=depasty(testa):tail_ast=1.4:vit_ast=4:type_ast=11
 ori_asty=depasty(testa)
 angle_asterox=angle_asterox1:angle_asteroy=-angle_asteroy1: Gosub creaast1
 angle_asterox=-angle_asterox1:angle_asteroy=angle_asteroy1:Gosub creaast1
 angle_asterox=-angle_asteroy1:angle_asteroy=-angle_asterox1: Gosub creaast1
 angle_asterox=angle_asteroy1: angle_asteroy=angle_asterox1:Gosub creaast1:Return
creatyp1:;- création astéroide initial
 type_ast=2 :  Gosub n_suiv : Return
creatyp2:
type_ast=3 :  Gosub o_suiv :Return
creatyp3:
 type_ast=5 : Gosub n_suiv :Return
creatyp4:
 type_ast=6 : Gosub o_suiv:Return
n_suiv:
  init_angle_ast=Random(628)/100
  ori_astx=Random(1024):ori_asty=0:tail_ast=4:vit_ast=1:Gosub creaast : Return
o_suiv:  
  ori_astx=Random(1024):ori_asty=0:tail_ast=4:vit_ast=1:Gosub creaast :Return
 creaast:;- création asteroide
 angle_asterox=-Sin(init_angle_ast):angle_asteroy=Cos(init_angle_ast)
 creaast1:
 nb_ast=0
 dej_ast:
 If typast(nb_ast)<>0:nb_ast+1:Goto dej_ast:EndIf:dirastx(nb_ast)=angle_asterox:dirasty(nb_ast)=angle_asteroy
 typast(nb_ast)=type_ast:depastx(nb_ast)=ori_astx:depasty(nb_ast)=ori_asty:tailast(nb_ast)=tail_ast
 vitast(nb_ast)=vit_ast:Return
;- AFFICHAGE 
message:;- affiche un caractere vectoriel 
 If angle_l>2*pi :angle_l=0 :EndIf:If angle_l<0 :angle_l=2*pi :EndIf
 cosrot_l.f=Cos(angle_l):sinrot_l.f=Sin(angle_l)
 point_l1.l = PeekL(?lettre+dep_l): If  point_l1=-1: Goto fincarac : EndIf
 point_l2.l = PeekL(?lettre+dep_l+4):point_l1*8:point_l2*8
 coox1_l.l=PeekL(?carac+point_l1)+ori_rotx:cooy1_l.l=PeekL(?carac+point_l1+4)+ori_roty
 coox2_l.l=PeekL(?carac+point_l2)+ori_rotx:cooy2_l.l=PeekL(?carac+point_l2+4)+ori_roty
 coox11_l.f=cosrot_l * coox1_l - sinrot_l *cooy1_l :cooy11_l.f=sinrot_l * coox1_l + cosrot_l *cooy1_l
 coox22_l.f=cosrot_l * coox2_l - sinrot_l *cooy2_l :cooy22_l.f=sinrot_l * coox2_l + cosrot_l *cooy2_l 
 coox11_l=coox11_l*tail_l:coox22_l=coox22_l*tail_l: cooy11_l=cooy11_l*tail_l:cooy22_l=cooy22_l*tail_l
 LineXY(pos_lx+coox11_l,pos_ly+cooy11_l,pos_lx+coox22_l,pos_ly+cooy22_l,RGB(255,255,255))
  dep_l+8 :Goto message 
 fincarac:Return 
 message1:;- affiche une chaine vectoriel 
  pos_lx+depx_car
  pos_ly+depy_car
  ori_rotx.l=0
  ori_roty.l=0
  angle_l+0.000
  car_l1.b = PeekB(adress+dep_cl): If  car_l1=0: Goto fincarac1 : EndIf
  If car_l1=32:dep_cl+1:Goto message1:EndIf
  car_l1-30
  dep_l.l=car_l1*32*4
   Gosub message
    dep_cl+1 :Goto message1
 fincarac1:
  Return
 ciel:;- affiche ciel etoilé 
 For ciel_l= 0 To 199:Circle(cielx(ciel_l),ciely(ciel_l),tail_ciel(ciel_l),RGB(255,255,255)):Next:Return
 asteroide:;- affiche asteroide
 nb_astero=0
 nbast_l=0
 affast:
 If typast(nbast_l)=0:nb_astero+1:Goto pas_aff_ast:EndIf
 If typast(nbast_l)=3 Or typast(nbast_l)=6:If vaisseau1>0: Gosub  aster_suiveur:EndIf:EndIf
 depastx(nbast_l)+dirastx(nbast_l)*vitast(nbast_l)
 depasty(nbast_l)+dirasty(nbast_l)*vitast(nbast_l)
 depastx1=depastx(nbast_l)
 depasty1=depasty(nbast_l)
 If depastx1>larg1:depastx1=0:If typast(nbast_l)=11:typast(nbast_l)=0:EndIf:EndIf
 If depasty1>long1:depasty1=0:If typast(nbast_l)=11:typast(nbast_l)=0:EndIf:EndIf
 If depastx1<0:depastx1=larg1:If typast(nbast_l)=11:typast(nbast_l)=0:EndIf:EndIf
 If depasty1<0:depasty1=long1:If typast(nbast_l)=11:typast(nbast_l)=0:EndIf:EndIf
 depastx(nbast_l)=depastx1
 depasty(nbast_l)=depasty1
 tail_l=tailast(nbast_l)
 dep_l=typast(nbast_l)*32*4
 pos_lx=depastx1
 pos_ly=depasty1
 angle_l=0
 ori_rotx=0
 ori_roty=15
 Gosub message
 pas_aff_ast:
 nbast_l+1
 If nbast_l < 256:Goto affast:EndIf
 
 Return
 vaisseau:;- affiche vaisseau
 If test_vais=0:Return:EndIf:depmx=depmx*friction :depmy=depmy*friction:posx=posx+depmx:posy=posy+depmy
 If posx>larg:posx=0:EndIf:If posy>long:posy=0: EndIf:If posx<0: posx=larg:EndIf:If posy<0:posy=long:EndIf
 dep_l=0*32*4: pos_lx=posx :pos_ly=posy: ori_rotx=0:  ori_roty=10: tail_l=1.4:angle_l=rotm: Gosub message
 If push0=1:If Random(1)=1:dep_l=1*32*4:pos_lx=posx:pos_ly=posy:angle_l=rotm:ori_rotx=0:ori_roty=50:tail_l=1.5:Gosub message
 EndIf: If ver_sound_vai=0 :ver_sound_vai=1:PlaySound(0,1) :EndIf
 Else :  If ver_sound_vai=1 :ver_sound_vai=0:StopSound(0) :EndIf:EndIf:Return
 alien:;- affiche alien
 If test_enne=0:Return:EndIf
 posalienx= alienx(0)
 posalieny= alieny(0)
 dep_l=9*32*4
 pos_lx=posalienx
 pos_ly=posalieny
 ori_rotx=0
 ori_roty=10
 tail_l=1.4
 angle_l=pi2
 If    posalienx>larg1:   posalienx=0:EndIf
 If    posalieny>long1:  posalieny=0:EndIf
 If    posalienx<0:   posalienx=larg1:EndIf
 If    posalieny<0:   posalieny=long1:EndIf
 alienx(0)=posalienx
 alieny(0)=posalieny
 Gosub message
 Return
aff_tir:;- affiche tir 
 nb_tir=0
 ret_tir:
 If typtir(nb_tir)=0:nb_tir+1:If nb_tir>190 :Goto fin_tir:EndIf:Goto ret_tir: EndIf
 postirxx(nb_tir)+tirxx(nb_tir)
 postiryy(nb_tir)+tiryy(nb_tir)
 postirx=postirxx(nb_tir)
 postiry=postiryy(nb_tir)
 
 tramtir(nb_tir)-1
 If tramtir(nb_tir)=0:typtir(nb_tir)=0:tirxx(nb_tir)=0:tiryy(nb_tir)=0: EndIf
 If postirx>larg:postirx=0:postirxx(nb_tir)=postirx:EndIf
 If postiry>long:postiry=0:postiryy(nb_tir)=postiry:EndIf
 If postirx<0:postirx=larg:postirxx(nb_tir)=postirx:EndIf
 If postiry<0:postiry=long:postiryy(nb_tir)=postiry:EndIf
 
 
 Circle (postirx,postiry,3,RGB(255,255,255)) 
 nb_tir+1:If nb_tir<190: Goto ret_tir:EndIf
 fin_tir:
 If ver_sound_tir=0 :ver_sound_tir=1:PlaySound(4,1) :EndIf
   If ver_sound_tir=1 :ver_sound_tir=0:StopSound(4) :EndIf
 Return  
 affpro:;- affiche explosion
 nb_proj=0
 nb_trame=0
 ret_proj:
 If typpro(nb_proj)=0:nb_trame+1:Goto pas_proj:EndIf
 posproxx(nb_proj)+proxx(nb_proj)
 posproyy(nb_proj)+proyy(nb_proj)
 posprox=posproxx(nb_proj)
 posproy=posproyy(nb_proj)
 
 trampro(nb_proj)-1
 If trampro(nb_proj)=0:typpro(nb_proj)=0:proxx(nb_proj)=0:proyy(nb_proj)=0: EndIf
 If posprox>larg:posprox=0:posproxx(nb_proj)=posprox:EndIf
 If posproy>long:posproy=0:posproyy(nb_proj)=posproy:EndIf
 If posprox<0:posprox=larg:posproxx(nb_proj)=posprox:EndIf
 If posproy<0:posproy=long:posproyy(nb_proj)=posproy:EndIf
 
 
 Circle (posprox,posproy,3,RGB(255,255,255)) 
 pas_proj:
 nb_proj+1
 If nb_proj<1900: Goto ret_proj:EndIf
 Return 
 init_jeu:;- initialisation jeu 
 For ini_ciel=0 To 199:cielx(ini_ciel)=Random(larg):ciely(ini_ciel)=Random(long):tail_ciel(ini_ciel)=Random(3)-1:Next
 
 Return
 convasci:;- convetis score ASCI
  divid.l=100000
  dep_sc=0
  decim.l=0
  conv_sc:
  score3.l=0
  score2.l=score1
  score3=score2
  For sco=0 To 5
  score2/divid
  decim=score2
  score3=score3-decim*divid
  score2=score3
  divid/10
  decim+48
  PokeB(?score+dep_sc,decim)
  dep_sc+1
  Next
  PokeB(?score+dep_sc,0)
 Return
 moins_vie:
  PokeB(?vie+vie1-1,0)
 Return
 over:
     tail_l.f=1
     dep_cl.f=0
 dep_car.f=0
  pos_lx=larg/2-140
   pos_ly=long/2-50
depx_car.f=(30*tail_l)
depy_car=0;(35*tail_l)
angle_l=0
adress=?fin_jeu
    Gosub message1  
    Return
 
 init_tableau:;- initialisation tableau 
 num_level:;- section niveau
For initast=0 To 15:tailast(initast)=0:depasty(initast)=0:Next
If level=1:Gosub creatyp1:Gosub creatyp1:Gosub creatyp1:Gosub creatyp1: EndIf
If level=2:Gosub creatyp1:Gosub creatyp1:Gosub creatyp1:Gosub creatyp2: EndIf
If level=3:Gosub creatyp1:Gosub creatyp1:Gosub creatyp1:Gosub creatyp3: EndIf
If level=4:Gosub creatyp1:Gosub creatyp1:Gosub creatyp1:Gosub creatyp4: EndIf
If level=5:Gosub creatyp1:Gosub creatyp1:Gosub creatyp2:Gosub creatyp4: EndIf
If level=6:Gosub creatyp1:Gosub creatyp1:Gosub creatyp3:Gosub creatyp4: EndIf
If level=7:Gosub creatyp1:Gosub creatyp1:Gosub creatyp4:Gosub creatyp4: EndIf
If level=8:Gosub creatyp1:Gosub creatyp2:Gosub creatyp4:Gosub creatyp4: EndIf
If level=9:Gosub creatyp1:Gosub creatyp3:Gosub creatyp4:Gosub creatyp4: EndIf
If level=10:Gosub creatyp1:Gosub creatyp4:Gosub creatyp4:Gosub creatyp4: EndIf
If level=11:Gosub creatyp2:Gosub creatyp4:Gosub creatyp4:Gosub creatyp4: EndIf
If level=12:Gosub creatyp3:Gosub creatyp4:Gosub creatyp4:Gosub creatyp4: EndIf
If level=13:Gosub creatyp4:Gosub creatyp4:Gosub creatyp4:Gosub creatyp4: EndIf
Return
gene_son:
   !MOV  dword[add_dat],0
   For br=0 To 6000;- bruit reacteur
   brh0.f=Random(65000)-32000
   brsong.w=brh0
   !PUSH eax
   !PUSH ebx
   !PUSH edi
   !MOV  ax,word[v_brsong]
   !LEA  edi,[br_rea]
   !ADD  edi,[add_dat]
   !ADD  dword[add_dat],4
   !MOV  word[edi],ax
   !MOV  word[edi+2],ax
   !POP  edi
   !POP  ebx
   !POP  eax
   Next br
   CatchSound(0,?music0)
   SoundVolume(0, 50)
   SoundFrequency(0, 1500)
  
  !MOV  dword[add_dat],0 
 For br=0 To 6000;- bruit ennemi
   a.f+0.1
 
   brh0.f=Sin(a*a)*32000
   brsong.w=brh0
   !PUSH eax
   !PUSH ebx
   !PUSH edi
   !MOV  ax,word[v_brsong]
   !LEA  edi,[br_enn]
   !ADD  edi,[add_dat]
   !ADD  dword[add_dat],4
   !MOV  word[edi],ax
   !MOV  word[edi+2],ax
   !POP  edi
   !POP  ebx
   !POP  eax
   Next br
   CatchSound(8,?music8)
   SoundVolume(8, 30)
   SoundFrequency(8,  1450)
   
    ral0.f=1
  !MOV  dword[add_dat],0
   For br=0 To 60000
   ral0+0.02
   brh0.f=Random(500000)/ral0
   brsong.w=brh0
   !PUSH eax
   !PUSH ebx
   !PUSH edi
   !MOV  ax,word[v_brsong]
   !LEA  edi,[br_exp]
   !ADD  edi,[add_dat]
   !ADD  dword[add_dat],4
   !MOV  word[edi],ax
   !MOV  word[edi+2],ax
   !POP  edi
   !POP  ebx
   !POP  eax
   Next br
   CatchSound(2,?music2)
   SoundVolume(2, 60)
   SoundFrequency(2, 4000)
   
   
    b.f=3;- bruit tir
     !MOV  dword[add_dat],0
 For br=0 To 60000
   a.f+b
 b-0.0008
   brh0.f=Sin(a)*15000
   brsong.w=brh0
   !PUSH eax
   !PUSH ebx
   !PUSH edi
   !MOV  ax,word[v_brsong]
   !LEA  edi,[br_tir]
   !ADD  edi,[add_dat]
   !ADD  dword[add_dat],4
   !MOV  word[edi],ax
   !MOV  word[edi+2],ax
   !POP  edi
   !POP  ebx
   !POP  eax
   Next br
   CatchSound(1,?music1)
   SoundVolume(1, 60)
   SoundFrequency(1, 7500)
 !MOV  dword[add_dat],0
 a.f=1;- bruit explosion vaisseau
   b.f=65000 
  For br=0 To 60000
  a-0.00035
  b-10
   brh0.f=(Random(b)-b/2)*a
   brsong.w=brh0
    !PUSH eax
   !PUSH ebx
   !PUSH edi
   !MOV  ax,word[v_brsong]
   !LEA  edi,[br_expv]
   !ADD  edi,[add_dat]
   !ADD  dword[add_dat],4
   !MOV  word[edi],ax
   !MOV  word[edi+2],ax
   !POP  edi
   !POP  ebx
   !POP  eax
   Next br
   CatchSound(3,?music3)
   SoundVolume(3, 100)
   SoundFrequency(3, 1800)
   Return
   
 !section '.data' align 16
 niveau:
  !db  "NIVEAU",0,0  
 nine1: 
 !db  "ASTEROIDE SIMPLE",0,0 
  nine2: 
 !db  "ASTEROIDE MAGNETIQUE",0,0 
   nine3: 
 !db  "ASTEROIDE A FRAGMENTATION",0,0 
    nine4: 
 !db  "ASTEROIDE MAGNETIQUE A FRAGMENTATION",0,0 
   score:
  !db "1234567890",0,0 
    vie:
  !db 30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,0
  fin_jeu:
  !db "FIN DE JEU",0,0
 carac:
  ! dd  -10,-30,-5,-30,0,-30,5,-30,10,-30 
  ! dd  -10,-25,-5,-25,0,-25,5,-25,10,-25 
  ! dd  -10,-20,-5,-20,0,-20,5,-20,10,-20 
  ! dd  -10,-15,-5,-15,0,-15,5,-15,10,-15 
  ! dd  -10,-10,-5,-10,0,-10,5,-10,10,-10 
  ! dd  -10,-5,-5,-5,0,-5,5,-5,10,-5 
  ! dd  -10, 0,-5, 0,0, 0,5, 0,10, 0 
  ! dd  -10, 5,-5, 5,0, 5,5, 5,10, 5 
  ! dd  -10,10,-5,10,0,10,5,10,10,10 
  ! dd  -10,15,-5,15,0,15,5,15,10,15 
 lettre:
  !dd   2,16,16,48,46,18,18,2,32,26,26,30,30,46,34,28,28,32,34,48,12,16,16,18,18,12,-1,0,0,0,0,0
  !dd   2,11,11,32,32,13,13,2,2,15,15,47,47,19,19,2,-1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
  !dd   5,16,16,25,25,22,22,29,29,18,18,9,9,12,12,5,-1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
  !dd   10,6,6,11,11,12,12,8,8,14,14,13,13,18,18,24,24,28,28,23,23,22,22,26,26,20,20,21,21,16,16,10
  !dd   -1,-1,-1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
  !dd   5,16,16,25,25,22,22,29,29,18,18,9,9,12,12,5,11,23,13,21,-1,0,0,0,0,0,0,0,0,0,0,0
  !dd   10,6,6,11,11,12,12,8,8,14,14,13,13,18,18,24,24,28,28,23,23,22,22,26,26,20,20,21,21,16,16,10
  !dd   11,23,13,21,-1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
  !dd   0,4,4,30,-1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
  !dd   4,2,2,7,7,6,6,10,10,20,20,26,26,27,27,32,32,34,34,29,29,28,28,23,23,24,24,14,14,13,13,8
  !dd   8,9,9,4,6,26,7,27,-1,-1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
  !dd   6,10,10,16,16,25,25,21,21,22,22,27,27,29,29,23,23,19,19,8,8,12,12,6,-1,0,0,0,0,0,0,0
  !dd   0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
  !dd   0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
  !dd   0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
  !dd   0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
  !dd   0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
  !dd   0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
  
  !dd   1,5,5,25,25,31,31,33,33,29,29,9,9,3,3,1,-1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
  !dd   6,2,2,32,31,33,-1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
  !dd   5,1,1,3,3,9,9,14,14,30,30,34,-1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
  !dd   5,1,1,3,3,9,9,14,14,18,18,16,18,24,24,29,29,33,33,31,31,25,-1,0,0,0,0,0,0,0,0,0
  !dd   3,20,20,24,3,33,-1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
  !dd   4,0,0,15,15,18,18,24,24,29,29,33,33,31,31,25,-1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
  !dd   9,3,3,1,1,5,5,25,25,31,31,33,33,29,29,24,24,18,18,16,16,20,-1,0,0,0,0,0,0,0,0,0
  !dd   0,4,4,30,-1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
  !dd   1,5,5,10,10,16,16,20,20,25,25,31,31,33,33,29,29,24,24,18,18,14,14,9,9,3,3,1,16,18,-1,0
  !dd   25,31,31,33,33,29,29,9,9,3,3,1,1,5,5,10,10,16,16,18,18,14,-1,0,0,0,0,0,0,0,0,0
   
  !dd   0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
  !dd   0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
  !dd   0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
  !dd   0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
  !dd   0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
  !dd   0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
  !dd   0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
 
  !dd   1,3,3,14,14,34,1,10,10,30,15,19,-1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 
  !dd   0,3,3,9,9,14,14,18,18,24,24,29,29,33,33,30,30,0,15,18,-1,0,0,0,0,0,0,0,0,0,0,0
  !dd   9,3,3,1,1,5,5,25,25,31,31,33,33,29,-1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
  !dd   3,0,0,30,30,33,33,29,29,9,9,3,-1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
  !dd   4,0,0,30,30,34,15,18,-1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 
  !dd   4,0,0,30,15,18,-1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
  !dd   9,3,3,1,1,5,5,25,25,31,31,33,33,29,29,19,19,18,-1,0,0,0,0,0,0,0,0,0,0,0,0,0
  !dd   0,30,4,34,15,19,-1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
  !dd   1,3,2,32,31,33,-1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 
  !dd   4,29,29,33,33,31,31,25,-1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
  !dd   0,30,15,17,17,4,17,34,-1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
  !dd   0,30,30,34,-1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
  !dd   30,0,0,12,12,4,4,34,-1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 
  !dd   30,0,0,34,34,4,-1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
  !dd   3,1,1,5,5,25,25,31,31,33,33,29,29,9,9,3,-1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
  !dd   15,18,18,14,14,9,9,3,3,0,0,30,-1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
  !dd   3,1,1,5,5,25,25,31,31,33,33,29,29,9,9,3,22,34,-1,0,0,0,0,0,0,0,0,0,0,0,0,0 
  !dd   0,3,3,9,9,14,14,18,18,24,24,34,0,30,15,18,-1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
  !dd   9,3,3,1,1,5,5,10,10,16,16,18,18,24,24,29,29,33,33,31,31,25,-1,0,0,0,0,0,0,0,0,0
  !dd   0,4,2,32,-1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
  !dd   0,25,25,31,31,33,33,29,29,4,-1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 
  !dd   0,32,32,4,-1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
  !dd   0,30,30,22,22,34,34,4,-1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
  !dd   0,34,4,30,-1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
  !dd   0,17,17,4,17,32,-1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 
  !dd   0,4,4,30,30,34,-1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
  !dd   4,1,1,5,5,25,25,31,31,34,-1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
  !dd   3,0,0,30,30,33,33,29,29,9,9,3,-1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
 
 !section '.data' align 16
  !add_dat:
  !dd  0
 music0:
  !db   052h,049h,046h,046h
  !dd   6000-8
  !db   057h,041h,056h,045h,066h,06dh,074h,020h
  !dd   16
  !dw   1,2
  !dd   22050,88200
  !dw   4,16
  !db   064h,061h,074h,061h
  !dd   6000-44
  !br_rea: 
  !rd  60000  
  !section '.data' align 16
 music1:
  !db   052h,049h,046h,046h
  !dd   15000-8
  !db   057h,041h,056h,045h,066h,06dh,074h,020h
  !dd   16
  !dw   1,2
  !dd   22050,88200
  !dw   4,16
  !db   064h,061h,074h,061h
  !dd   15000-44
  !br_tir: 
  !rd  30000  
  !section '.data' align 16 
  music2:
  
  !db   052h,049h,046h,046h
  !dd   6000-8
  !db   057h,041h,056h,045h,066h,06dh,074h,020h
  !dd   16
  !dw   1,2
  !dd   22050,88200
  !dw   4,16
  !db   064h,061h,074h,061h
  !dd   6000-44
  !br_exp: 
  !rd  620000  
  !section '.data' align 16
   music3:
  
  !db   052h,049h,046h,046h
  !dd   15000-8
  !db   057h,041h,056h,045h,066h,06dh,074h,020h
  !dd   16
  !dw   1,2
  !dd   22050,88200
  !dw   4,16
  !db   064h,061h,074h,061h
  !dd   15000-44
  !br_expv: 
  !rd  60000  
  !section '.data' align 16
  music8:
  
  !db   052h,049h,046h,046h
  !dd   6000-8
  !db   057h,041h,056h,045h,066h,06dh,074h,020h
  !dd   16
  !dw   1,2
  !dd   22050,88200
  !dw   4,16
  !db   064h,061h,074h,061h
  !dd   6000-44
  !br_enn: 
  !rd  80000