Jicehel
Nombre de messages : 5947 Age : 51 Localisation : 77500 Date d'inscription : 18/04/2011
| Sujet: Panoram Invaders à la mode des menus Sam 18 Aoû 2012 - 22:49 | |
| J'ai repris mon Panoram Invaders Lien sur l'archive avec tous les fichiers nécessaires: Kevins_Invader.7zSource: - Code:
-
REM ************************************************************ REM * * REM * Panoram Invaders Version: 4.0 - 18/08/2012 * REM * * REM ************************************************************ REM * Touches: * REM * - "Les fléches" gauche ou droite: déplacement * REM * - "Esc" pour quitter * REM * - "CTRL" ou clic gauche pour tirer * REM * * REM ************************************************************
label labels : gosub labels
gosub constantes gosub variables gosub donnees gosub initialisations gosub form0 gosub menu gosub GUI end
labels: label constantes, variables, donnees label form0, menu, GUI, initialisations, start, tick, restart, fin, key label aide, close_aide, apropos, close_apropos, stopit label soucoupe,crash, score, inv return
constantes: dim version$ : version$ = "V04.00" dim date_cre$ : date_cre$ = "18 Août 2012" dim speed% : speed% = 10 : ' milli-secondes entre chaque mouvement dim M1% : M1% = 0 - 1 return
variables: dim no%, no1%, no2% : ' Numméro d'objets temporaires dim w%, h%, px%, py%: ' Largeur, Hauteur, Position en x et en y de la fenêtre 0 dim no_timer%, no_apropos%, no_aide%, no_config% : ' Numéro des objets importants utilisés dim no_config_v%, no_config_speed% : ' Timer, numéro des fenêtres, ... dim no_stop%, no_play%, no_start% dim xpad : ' Position de la souris dim point%, live% : ' Score et nombre de vaisseaux restants dim afs$, aflive% : ' Affichage du score et des vies dim Pause% : ' Bascule pour mettre le jeu en pause ou reprendre dim Niveau% : ' Niveau en cours dim Attente% : ' Pour lisser le mouvement attendre si on ne joue pas de son dim a%,touche%,vsou%,hsou%,soudec%, boucle%, boucle2%, boucle3%, boucle4%, dir%, pas% dim tirh%,bb%,aleat%,i%,afscore%,invader% , s$, k%, temp%, temp2% dim point$(10),tirdec%(5),tirv%(5),postir%(5), env%(40), vinv%(40),hinv%(40), nl% return
donnees: Data "ga","me","ov", "er", 150,"mi2", 151, "mi1", 152,"mi1", 153, "mi2", 200, "exp" Data 300, "sou", 301, "exps" return
form0: ' Paramètrage de la fenêtre principale du jeu left 0,px% : top 0,py% : ' Position initale de la fenêtre 0 width 0, w% : height 0,h% caption 0,"Panoram Invaders" SCENE2D 1 : ' Initialise la scene 2D top 1,0: left 1,0: width 1,600: height 1,600 :file_load 1,"nuit.bmp":full_space 1 : hide 1 return
menu: return
GUI: sound 500:file_load 500,"shot.wav": sound 501:file_load 501,"02.wav":sound 502:file_load 502,"walk3.wav": sound 503:file_load 503,"walk4.wav":sound 504:file_load 504,"explode.wav" sound 700:file_load 700,"ufohit.wav": sound 702:file_load 702,"ufo.wav" a%=0 for boucle%=0 to 3 read afs$ if boucle%=2 then a%=20 sprite 900+boucle%: SPRITE_hide 900+boucle%:SPRITE_FILE_LOAD 900+boucle%,afs$+".bmp": SPRITE_POSITION 900+boucle%, 200+boucle%*37+a%,250 next boucle% for boucle%=0 to 6 read a%:read afs$ sprite a%: SPRITE_hide a%:SPRITE_FILE_LOAD a%,afs$+".bmp" next boucle% sprite 302: sprite_hide 302:SPRITE_FILE_LOAD 302,"titre1.bmp": SPRITE_POSITION 302, 50 , 20: sprite_show 302 sprite 303: sprite_hide 303:SPRITE_FILE_LOAD 303,"titre2.bmp": SPRITE_POSITION 303, 225, 20: sprite_show 303 for boucle2%=0 to 3: temp%=11*boucle2%: for boucle%=(1+temp%) to (7+temp%): sprite boucle%+4 : sprite_hide boucle%+4 : SPRITE_FILE_LOAD boucle%+4,str$(boucle2%+1)+"1.bmp" : next boucle%: next boucle2% for boucle2%=0 to 3: temp%=11*boucle2%:for boucle%=105+temp% to 111+temp%: sprite boucle% : sprite_hide boucle% : SPRITE_FILE_LOAD boucle%,str$(boucle2%+1)+"2.bmp" : next boucle%: next boucle2% for boucle%=0 to 4: sprite 500+boucle% : SPRITE_FILE_LOAD 500+boucle%,"0.bmp": SPRITE_POSITION 500+boucle%, 250-13*boucle%,100: NEXT boucle% sprite 505: SPRITE_FILE_LOAD 505,"score.bmp":SPRITE_POSITION 505, 237-120,95 : sprite 506: SPRITE_FILE_LOAD 506,"live.bmp" :SPRITE_POSITION 506, 300,95 :sprite 507: SPRITE_FILE_LOAD 507,"0.bmp" : SPRITE_POSITION 507, 350,100 for boucle%=0 to 9: point$(boucle%)=str$(boucle%)+".bmp":next boucle% sprite 3: SPRITE_hide 3: SPRITE_FILE_LOAD 3,"mis.bmp" : sprite 4: SPRITE_FILE_LOAD 4,"vai.bmp" TIMER 61: TIMER_OFF 61 : TIMER_INTERVAL 61,50000: ON_TIMER 61,soucoupe: TIMER_OFF 61 no% = 62 : timer no% : no_timer% = no% : ' Definit le timer principal du jeu timer_interval no_timer%,speed% : on_timer no%,tick : timer_off no% no% = no% + 1 : main_menu no% : no1% = no% no% = no% + 1 : sub_menu no% : parent no%,no1% : no2% = no% caption no%,"Partie" no% = no% + 1 : sub_menu no% : parent no%,no2% : no_start% = no% caption no%,"Nouveau jeu" : on_click no%,start no% = no% + 1 : sub_menu no% : parent no%,no2% : no_stop% = no% caption no%,"Stop" : inactive no% : on_click no%,stopit no% = no% + 1 : sub_menu no% : parent no%,no2% caption no%,"-" no% = no% + 1 : sub_menu no% : parent no%,no2% caption no%,"Sortir" : on_click no%,fin no% = no% + 1 : sub_menu no% : parent no%,no1% : no2% = no% caption no%,"Aide" no% = no% + 1 : sub_menu no% : parent no%,no2% caption no%,"Mode d'emploi" : on_click no%,aide no% = no% + 1 : sub_menu no% : parent no%,no2% caption no%,"A-propos" : on_click no%,apropos no% = no% + 1 : sub_menu no% : parent no%,no1% : no2% = no% no% = no% + 1 : form no% : hide no% : no_apropos% = no% : ' Définit la fenêtre "A propos" top no%,200 : left no%,200 : caption no%,"A-propos" on_close no%,close_apropos no% = no% + 1 : alpha no% : parent no%,no_apropos% top no%,20 : left no%,20 : font_size no%,12 s$ = "Panoram Invanders"+chr$(13)+chr$(10)+chr$(10) s$ = s$ + "Version: "+version$+chr$(13)+chr$(10) s$ = s$ + "Du: "+date_cre$+chr$(13)+chr$(10)+chr$(10) s$ = s$ + "Auteur: Jean-Charles"+chr$(13)+chr$(10)+chr$(10) caption no%,s$
no% = no% + 1 : form no% : hide no% : no_aide% = no% : width no%,450 : ' Définit la fenêtre du Mode d'emploi caption no%,"Mode d'emploi" : on_close no%,close_aide no% = no% + 1 : alpha no% : parent no%,no_aide% top no%,20 : left no%,20 : font_size no_aide%,10 : k% = 2 s$ = "Bienvenu dans Panoram Invanders !" + chr$(13)+chr$(10)+chr$(10) : k%=k%+1 s$ = s$ + "Vous dirigez le vaisseau en bas de l'écran à l'aide" + chr$(13)+chr$(10): k%=k%+1 s$ = s$ + "des touches de direction (droite) et (gauche)." + chr$(13)+chr$(10): k%=k%+1 s$ = s$ + "Vous tirez avec la touche (Espace)" + chr$(13)+chr$(10): k%=k%+1 s$ = s$ + chr$(13)+chr$(10): k%=k%+1 s$ = s$ + "Vous devez détruire tous les aliens pour passer au" + chr$(13)+chr$(10): k%=k%+1 s$ = s$ + "niveau suivant, mais attention, ils tirent aussi..." + chr$(13)+chr$(10): k%=k%+1 s$ = s$ + "Détruisez la soucoupe pour marquer plus de points" + chr$(13)+chr$(10): k%=k%+2 top no%-1,150 : left no%-1,200 : height no%-1,20*k% caption no%,s$
return
initialisations: w%= 600 : h% = 600 : ' Largeur et Hauteur de la fenêtre 0 px% = 0 : py% = 0 : ' Position en x et en y de la fenêtre 0 return
stopit: timer_off no_timer% inactive no_stop% active no_start% return
start: active no_stop% inactive no_start% Pause% = 0 : niveau%= 0 : point%=0 : live%=3 aflive%=10+live% : afs$=str$(aflive%) : SPRITE_FILE_LOAD 507,point$(val(mid$(afs$,2,1))):SPRITE_POSITION 507, 350,100 show 1 on_key_down 0,key restart: timer_off no_timer% bb%=0:hsou%=700 :vsou%=170: a%=280: invader%=28 : pas% = 1 for boucle4%=1 to 5:tirdec%(boucle4%)=0: next boucle4% sprite_hide 150: sprite_hide 151: sprite_hide 3 : sprite_hide 152 : sprite_hide 153: sprite_hide 900: sprite_hide 901: sprite_hide 902: sprite_hide 903 niveau% = niveau% + 1 caption 0,"Panoram Invaders - Niveau actuel :" + str$(Niveau%) SPRITE_POSITION 4,a%,500 : dir%=1 for boucle2%=0 to 3:temp%=11*boucle2%: for boucle%=1 to 7 : env%(boucle%+temp%)=1:hinv%(boucle%+temp%)=170+30*(boucle%) :vinv%(boucle%+temp%)=200+25*boucle2%:sprite_show boucle%+temp%+4: next boucle%: next boucle2% timer_on 61 timer_on no_timer% return
inv: if boucle% > 4 then return temp%=dir%*pas%: temp2%=(boucle%-1)*11 hinv%(1+temp2%)=hinv%(1+temp2%)+temp%:hinv%(2+temp2%)=hinv%(2+temp2%)+temp%:hinv%(3+temp2%)=hinv%(3+temp2%)+temp%:hinv%(4+temp2%)=hinv%(4+temp2%)+temp% hinv%(5+temp2%)=hinv%(5+temp2%)+temp%:hinv%(6+temp2%)=hinv%(6+temp2%)+temp%:hinv%(7+temp2%)=hinv%(7+temp2%)+temp% for boucle2%= (1+temp2%) to (7+temp2%) if env%(boucle2%)<>0 if nl%=0 and hinv%(boucle2%)=550 then dir%=-1 : nl%=1 if nl%=0 and hinv%(boucle2%)=0 then dir%=1: nl%=1 if bb%=0 then SPRITE_POSITION boucle2%+4, hinv%(boucle2%),vinv%(boucle2%):sprite_hide boucle2%+104:SPRITE_SHOW boucle2%+4 if bb%=1 then SPRITE_POSITION boucle2%+104, hinv%(boucle2%),vinv%(boucle2%): sprite_hide boucle2%+4:SPRITE_SHOW boucle2%+104 if postir%(5) > (hinv%(boucle2%)-12) then if postir%(5) < (hinv%(boucle2%)+3) then if tirv%(5)>vinv%(boucle2%) then if tirv%(5)<(vinv%(boucle2%)+16) then point%=point%+50-10*boucle%: SPRITE_hide boucle2%+4+100*bb%: :play 501 :SPRITE_POSITION 200, hinv%(boucle2%),vinv%(boucle2%) : SPRITE_SHOW 200: wait 25: env%(boucle2%)=0 : SPRITE_HIDE 200 : tirdec%(5)=0 : SPRITE_HIDE 3:tirv%(5)=0: point%=point%+30 :invader%=invader%-1 :gosub score if aleat%=boucle2% and tirdec%(boucle%)=0 then tirv%(boucle%)=vinv%(boucle2%) : postir%(boucle%)=hinv%(boucle2%) : tirdec%(boucle%)=1:SPRITE_POSITION 149+boucle%,postir%(boucle%),tirv%(boucle%):Sprite_Show 149+boucle% end_if next boucle2% return
soucoupe: if soudec%<>1 then soudec%=1 hsou%=hsou%-2 if hsou%=550 or hsou%=250 then play 700 if soudec%=1 then SPRITE_POSITION 300,hsou%,vsou%: sprite_show 300 :if hsou%=-100 then SPRITE_hide 300 : soudec%=0 :hsou%=700 return
score: afscore%=1000000+point% afs$=str$(afscore%) for boucle4% = 0 to 4: SPRITE_FILE_LOAD 500+boucle4%,point$(val(mid$(afs$,7-boucle4%,1))): SPRITE_POSITION 500+boucle4%, 250-13*boucle4%,100:next boucle4% return
crash: play 504: live%=live%-1: timer_off_all for boucle4%=1 to 3: SPRITE_HIDE 4: wait 100: SPRITE_SHOW 4: wait 100: next boucle4% aflive%=10+live% : afs$=str$(aflive%) : SPRITE_FILE_LOAD 507,point$(val(mid$(afs$,2,1))):SPRITE_POSITION 507, 350,100 for boucle4%=1 to 4 if tirdec%(boucle4%)=1 SPRITE_Hide 149+boucle4% tirdec%(boucle4%)=0 : postir%(boucle4%)=0 : tirv%(boucle4%)=0 end_if next boucle4% if live%=0 then goto fin timer_on 61 return
tick: timer_off no_timer% aleat%=int(rnd(40)+1) nl%=0 for boucle%=1 to 4 if tirdec%(boucle%)=1 then tirv%(boucle%)=tirv%(boucle%)+5: SPRITE_POSITION 149+boucle%,postir%(boucle%),tirv%(boucle%): if tirv%(boucle%)=530 then SPRITE_Hide 149+boucle% : tirdec%(boucle%)=0 if postir%(boucle%) >=a%-13 if postir%(boucle%) <=(a%+16) if tirv%(boucle%)>=477 if tirv%(boucle%)< 523 then gosub crash end_if end_if end_if gosub inv next boucle% if nl%=1 for boucle%=0 to 3 temp%=(boucle%)*11: vinv%(1+temp%)=vinv%(1+temp%)+25: vinv%(2+temp%)=vinv%(2+temp%)+25: vinv%(3+temp%)=vinv%(3+temp%)+25 vinv%(4+temp%)=vinv%(4+temp%)+25: vinv%(5+temp%)=vinv%(5+temp%)+25: vinv%(6+temp%)=vinv%(6+temp%)+25: vinv%(7+temp%)=vinv%(7+temp%)+25 next boucle% end_if if soudec%=1 then gosub soucoupe if tirdec%(5)=1 tirv%(5)=tirv%(5)-8 : SPRITE_POSITION 3,postir%(5),tirv%(5) if soudec%=1 then if tirv%(5)>vsou% then if tirv%(5)<vsou%+24 then if (postir%(5) > (hsou%-15) and postir%(5) < (hsou%+16)) then SPRITE_Hide 300:SPRITE_POSITION 301, hsou%,vsou%: sprite_show 301:play 702 : wait 200: soudec%=0 : SPRITE_hide 301: tirdec%(5)=0 : SPRITE_HIDE 3 : tirv%(5)=0 : hsou%=700 : soudec%=0 : point%=point%+300 if tirv%(5) <=172 then SPRITE_HIDE 3 : tirdec%(5)=0 end_if
if bb%=0 then play 503: bb%=1 : else : bb%=0 if invader% = 0 then gosub restart timer_on no_timer% return
key: touche%=scancode if touche%=37 then i%=-4 if touche%=39 then i%=4 if touche%=27 then goto fin if touche%=32 or touche%=1 then if tirdec%(5)=0 then tirdec%(5)=1 : tirv%(5)=500 :play 500: SPRITE_SHOW 3:postir%(5)=a% a%=a%+i%:i%=0 : SPRITE_POSITION 4,a%,500 return
aide: inactive 0 show no_aide% return
close_aide: active 0 return
apropos: inactive 0 show no_apropos% return
close_apropos: active 0 return
fin: timer_off_all : OFF_KEY_DOWN 0 : sprite_hide 3: tirdec%(5)=0: sprite_hide 150 :tirdec%(1)=0 sprite_hide 151 :tirdec%(2)=0: sprite_hide 152 :tirdec%(3)=0 :sprite_hide 153 :tirdec%(4)=0 gosub stopit for boucle4% = 1 to 4 sprite_show 900: sprite_show 901: sprite_show 902: sprite_show 903: wait 200 if boucle4% < 4 then sprite_hide 900: sprite_hide 901: sprite_hide 902 :sprite_hide 903: wait 200 next boucle4% if message_confirmation_yes_no("Voulez-vous rejouer ?")=1 then sprite_hide 900: sprite_hide 901 : sprite_hide 902: sprite_hide 903: goto start terminate | |
|