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 :
* 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 )
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 !!…
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