Autorisation : Membre
Nb de messages : 595
Inscrit le : Mer 04 Avr 2007, 13:29
Posté le : Lun 24 Déc 2007, 18:39
Chose promise chose due. Voilà le Snake, qui selon moi est le meilleur que l'on puisse faire en basic.
Ce programme n'est pas du tout de moi !! C'est celui de Ratuss auquel j'ai apporté pas mal d'améliorations (vitesse, scores, ajout de 3 labyrinthes, sauvegarde, pause, correction des labyrinthes préexistants).
J'ai recopié le programme tel quel, donc j'ai mis ma présentation, mais vous pourrez la changer aisément si vous voulez, elle est tout au début.
En tout il y a dix labyrinthes répartis sur 2 niveaux. Pour passer au labyrinthe suivant il faut avoir fais plus de 30 points au précédent (j'ai essayé de les classer par ordre de grandeur).
Je tiens également à dire que le labyrinthe 10 a été créé par coc5.
Il faut utiliser les touches fléchées, et [ENTER] pour accéder au mode pause. Via ce mode, il est possible de :
* reprendre immédiatement la partie
* quitter le jeu tout en sauvegardant le partie de manière à la poursuivre ultérieurement (en choisissant l'option charger lorsque on relance le programme )
* quitter définitivement la partie
Attention : pour que le mode sauvegarde fonction, il ne faut toucher ni à W, ni aux liste L4,L5, ni à la fenêtre graphique.
Les scores sont visibles depuis l'option "scores" dans le mode principal. Ils sont enregistrés dans la liste L6.
Le jeu est séparé en 2 programmes qu'il faut impérativement nommer "SNAKE" et "[teta]SNAKE"
Attention : pour les bidouilleurs, il ne faut pas les rassembler en un seul sinon ça va ramer !!…
Snake
Nom du programme : "[SNAKE]"
Code
If W=1
Goto [teta]
PlotsOff
FnOff
ClrHome
FullScreen
ClrDraw
0->Xmin
94->Xmax
0->Ymin
62->Ymax
CoordOff
LabelOff
AxesOff
Horizontal 0
Horizontal 62
Vertical 0
Vertical 94
For (A,1,7
Text (10,A, "VIBRA
End
For (A,1,13
Text (18,A, "2007G
End
For (A,1,13
Text (A,53,"PRESENTE : "
End
Text (52,28,"VERSION 9.2
For (A,1,35
Text (35,A,"SNAKE // ajoutez un espace avant le S, évite la trainée
End
Pause
Lbl [teta]
If W=/=1
Then
0->Xmin
94->Xmax
-62->Ymin
0->Ymax
Lbl X
0->F
ClrDraw
16->A
18->B
44->C
77->D
1->E
2->N
If dim L6<11 // dès ti82stats, fermez bien la parenthèse, dim(L6)<11
11-> dim L6
1->P
Menu ("SNAKE","JOUER",6,"SCORES",9,"QUITTER",Z
Else
Menu ("SNAKE","CHARGER",W,"JOUER",6,"SCORES",9,"QUITTER",Z
End
Lbl W
3->F
DispGraph
Pause
Goto 8
Lbl Z
ClrDraw
-10->Xmin
10->Xmax
-6->Ymin
6->Ymax
1->Yscl
AxesOn
ClrHome
ClrList L4,L5
0->W
0->F
Stop
Lbl 9
Text (0,25,"NIVEAU 1 : "
Text (9,1,"1 : VIDE"
Text (9,70,L6(1
Text (17,1,"2 : FONTAINE
Text (17,70,L6(2
Text (25,1,"3 : PORTE
Text (25,70,"L6(3
Text (33,1,"4 : VERSAILLES
Text (33,70,L6(4
Text (41,1,"5 : DIAGONALE
Text (41,70,L6(5
Text (49,1,"6 : BOITE
Text (49,70,L6(6 <- //
Text (57,1,"7 : DAMIER
Text (57,70,L6(7
Pause
ClrDraw
Text (0,25,"NIVEAU 2 :
Text (9,1,"1 : CROIX
Text (9,70,L6(8
Text (17,1,"2 : DEDAL
Text (17,70,L6(9
Text (25,1,"3 : SATIONNEMENT
Text (25,70,L6(10
Pause
ClrDraw
Goto x
Lbl R
ClrHome
Disp "BLOQUE
Pause
Lbl 6
Menu ("LABYRINTHES","NIVEAU 1",S,"NIVEAU 2",T
Lbl T
Menu (NIVEAU 2","CROIX",H,"DEDAL",I,"STATIONNEMENT",J
Lbl S
Menu ("NIVEAU 1","VIDE",A,"FONTAINE",B,"PORTES",C,"VERSAILLES",D,"DIAGONALE",E,"BOITE,F,"DAMIER",G
Lbl J
If 30>=L6(9
Goto R
10->P
26->A
For ([teta],0,3
Line (8,-45+[teta],27,-45+[teta]
Line (67,-45+[teta],86,-45+[teta]
Line (8,-25+[teta],86,-25+[teta]
Line (28+[teta],-55,28+[teta],-32
Line (63+[teta],-55,63+[teta],-32
Line (28+[teta],-21,28+[teta],-7
Line (63+[teta],-10,63+[teta],-7
End
Goto A
Lbl I
If 30>L6(8
Goto R
9->P
8->B
For ([teta],0,3
Line (33+[teta],-55,33+[teta]-32
Line (58+[teta],-30,58+[teta] ,-7
Line (8,-25+[teta] ,46,-25+[teta]
<- //
Line (48,-40+[teta] ,86,-40+[teta]
End
Goto A
Lbl H
If 30>L6(7
Goto R
21->A
8->P
For ([teta] ,0,3
Line (43+[teta] ,-55,43+[teta] ,-7
Line (8,-30+[teta] ,86,-30+[teta]
End
Goto A
Lbl E
If 30>L6(4
Goto R
5->P
38->B
For ([teta] ,23,68,5
For (Z,13,16
Line ([teta] ,Z-[teta] , [teta] +3,Z-[teta]
End
End
Goto A
Lbl F
If 30>L6(5
Goto R
26->A
6->P
For ([teta],0,3
Line (8,-55+[teta] ,86,-55+[teta]
Line (8,-7-[teta] ,86,-7-[teta]
Line (8+[teta] ,-11,8+[teta] ,-51
Line (86-[teta] ,-11,86-[teta] ,-51
End
Goto A
Lbl G
If 30>L6(6
Goto R
6->A
7->P
For ([teta] ,1,15
13+5int (rand14)->I
5int (rand8+3)->J
For (Z,0,3
Line (I,Z-J,I+3,Z-J
End
End
Goto A
Lbl C
3->P
Lbl D
If 30>L6(3-int(P/3))
Goto R
For ([teta] ,7,10
For (Z,0,45,45
Line (8,- [teta] –Z,41,- [teta] –Z
Line (53,- [teta] –Z,86,- [teta] –Z
End
For (Z,1,76,75
Line ([teta]+Z,-11,[teta]+Z,-25
Line ([teta]+Z,-37,[teta] +Z,-51
End
End
If P=3
Goto A
4->P
Lbl B
If 30>L6(1
Goto R
For ([teta] ,27,35
Line (28,- [teta] ,66,- [teta]
End
Line (32,-31,62,-31,0
If P=1
2->P
Lbl A
L6(P)->O // ceci est la lettre O
ClrList L4,L5
99->dim L4
99->dim L5
For ([teta] ,1,6,1.4
Line (88,-int [teta] ,6,-int [teta]
End
Line (6,-57,88,-57
Line (88,-56,88,-6
Line (6,-6,6,-56
Text (0,13,"SCORE : "
Text (0,53,"HIGH : "
Text (0,72,(int L6(P
Lbl 8
prgm[teta]SNAKE
If F=1
Goto X
If F=2
Goto Z
Goto 8
Nom du programme : "[teta]SNAKE"
Code
If F=3
Goto L
69 !
-8-5int (rand10)->I
8+5int (rand16)->J
If pxl-Test(-I,J)=1
Return
Line (J,I,(J+2),(I-2
Line (J,(I-2),(J+2),I
Goto 3
Lbl 2
6+50fPart ((A+C)/50)->A
8+80fPart ((B+D)/80)->B
If pxl-Test ((A+2),B)=1
Goto 4
Text (A,B, "[degré]
Lbl 3
Round (1+NfPart (E/N),0->E
Text (L4(E),L5(E), " " {5 espaces}
A->L4(E
B->L5(E
getKey ->K
If K=0
Goto 2
If K=105
Goto M
Lbl L
0->F
If D=72
Then
If K=24
67->D
If K=26
77->D
If K=24 or K=26
44->C
Goto 2
End
If C=/=44
Goto 2
If K=25
39->C
If K=34
49->C
If K=25 or K=34
72->D
Goto 2
Lbl 4
Text (A,B,"[degré]
If N=99
Then
Text (27,31,"GAGNE !
Goto 8
End
Line (B+1,(-A-3),(B+2),(-A-2
If –I=/=(A+2) or J=/=B
Goto Q
N+1->N
Text (0,37,(N+1)
Return
Lbl Q
If (N+1)>L6(P
(N+1)->L6(P
Text (27,31, "GAME OVER
Pause
1->F
Return
Lbl 8
ClrDraw
ClrHome
ClrList L4,L5
Lbl M
Menu ("PAUSE","REPRENDRE",W,"QUITTER",N
Lbl N
Menu ("ENREGISTRER","OUI",O, "NON",Z
Lbl Z
2->F
Return
Lbl O
1->W
Stop
Lbl W
DispGraph
Pause
Goto L
---------------------- Vive la programmation et vive le vibraphone !!!
Autorisation : Membre
Nb de messages : 595
Inscrit le : Mer 04 Avr 2007, 13:29
Posté le : Lun 24 Déc 2007, 23:10
J'ai pas le cable ni vti ni ti connect…
Et je me suis tapé les 2000 octets à la main !
Mais toi si tu fais un petit copié collé tu pourais le faire non ?
---------------------- Vive la programmation et vive le vibraphone !!!
Autorisation : Membre
Nb de messages : 891
Inscrit le : Sam 16 Jui 2007, 13:37
Posté le : Jeu 27 Déc 2007, 18:31
Il faudrait juste re-traduire dans le sens inverse les codes du genre -> = ü
Sinon la description est prometteuse, mais je ne vois pas de quel labyrinthe tu parles, je ne me rappelles pas en avoir fait ?
Autorisation : Membre
Nb de messages : 891
Inscrit le : Sam 16 Jui 2007, 13:37
Posté le : Ven 28 Déc 2007, 11:56
Ah bon^^ ?
Au fait, au lieu de faire des trucs du genre -51+[theta] essaie de marquer [theta]-51 au total tu économiseras bien 20 octets et le code seras plus claire (pas de risque de faire le mauvais moins pour ceux qui ne connaissent pas )