|
Trouver une ressource
Vous ne trouvez pas de réponse à votre problème ? Alors posez la question dans le forum. Souvenez-vous qu'il n'y a jamais de question bête, mais rester dans l'ignorance parce que l'on n'ose pas poser une question, ça c'est une erreur !
JEU DE BOULE
Information sur la source
Description
simple jeu en langage pascal, une boule tombe sur une règle,le jeu contunue jusqu'a la boule va touche l'interieur du regle 3 fois,
Source
- program exe;
- uses Crt,Graph;
- Label 1;
- Const R=5;n=20;
- var
- touche: Char;
- score,A,B,X,Y: integer;
- Graphdriver, Graphmode: Integer;
- test,votre_choix:shortint;
- Bas:Boolean;
- ValeurR:LongInt;
-
- Procedure Preparer;
- Var i:Integer;
- Ch:String;
- Begin
- For i:=1 to 3 Do
- begin
- setcolor(15);outtextxy(getmaxx div 2,getmaxy div 2,'attendez s.v.p');
- Delay(1000);
- Sound(100);Delay(300);NoSound;
- End;
- setcolor(0);outtextxy(getmaxx div 2,getmaxy div 2,'attendez s.v.p');delay(900); Sound(200);Delay(500);NoSound;
- End;
- Procedure Boule(X,Y,Coul,col:Integer);
- Var i:Integer;
- Begin
- setcolor(col);
- SetFillStyle(Coul,random(getmaxcolor)+1);
- FillEllipse(X,Y,R,R);
- End;
-
- Procedure Barre(x1,y1,x2,y2,col1:integer);
- Begin
- SetColor(Col1);
- Rectangle(x1,y1,x2,y2);
- End;
-
- Begin
- clrscr;
- X:=0;
- Y:=0;
- A:=0;
- B:=0; score:=0;
- textcolor(14);
- GotoXy(20,2);Write('ooOoo JEU DE LA BOULE ooOoo');
- GotoXy(20,3);Write('---------------------------');
- GotoXy(20,4);Write('1. facile');
- GotoXy(20,5);Write('2. moyen');
- GotoXy(20,6);Write('3. defficile');
- GotoXy(20,7);Write('0. Quitter');
- Repeat
- GotoXy(20,9);Write('Faites votre choix S.V.P...:');Readln(votre_choix);
- Case votre_Choix Of
- 3:begin ValeurR:=5;end;
- 2:begin ValeurR:=10;end;
- 1:begin ValeurR:=15;end;
- 0:Exit;
- End;
- Until (votre_Choix>=0)And(votre_Choix<=3);
- nosound;
- Graphdriver := Detect;
- InitGraph(Graphdriver, Graphmode, ' ');
- if GraphResult <> grOk then Halt(1);
- Preparer;
- Randomize;
- X:=300;Y:=GetMaxY-N;
- Bas:=True;
- Repeat
- If Not keypressed Then
- begin
- Boule(A,B,0,0);
- If B=R Then Begin Bas:=True; A:=Random(GetMaxX); End;
- If B=GetMaxY-R Then begin b:=r; test:=test+1; end;
- if test=3 then
- Begin SetColor(15);OutTextXy(200,200,' Vous avez perdu ! '); Readln; Goto 1; End;
- B:=B+1;
- Boule(A,B,1,random(getmaxcolor)+1);
- Delay(ValeurR);
- Boule(x+25+r,y-r-2,0,0);
- End
- Else touche := Readkey;
- If touche=#0 then
- Begin
- Barre(X,Y,X+25,Y+5,0);
- touche := Readkey;
- If touche=#77 then If X>=GetMaxX Then X:=0 else X:=X+10;
- If touche=#75 then If X<=0 Then X:=getmaxX else X:=X-10;
- Barre(X,Y,X+25,Y+5,random(getmaxcolor)+1);
- End;
- If (X<=A+R) And (A<=X+25+R)And(B=Y-R-2) Then Begin Boule(A,B,0,0); sound(200);delay(10);Nosound;b:=r;
- score:=score+10; if(votre_choix<=3) then begin if (valeurr<=3) and (score mod 30 = 0) then valeurr:=valeurr-4; end; End;
- Until touche=#27;
- 1:CloseGraph;
- textcolor(2);
- gotoxy(30,12);
- write('votre score est: ', score);
- readln;
- clrscr;
- end.
program exe;
uses Crt,Graph;
Label 1;
Const R=5;n=20;
var
touche: Char;
score,A,B,X,Y: integer;
Graphdriver, Graphmode: Integer;
test,votre_choix:shortint;
Bas:Boolean;
ValeurR:LongInt;
Procedure Preparer;
Var i:Integer;
Ch:String;
Begin
For i:=1 to 3 Do
begin
setcolor(15);outtextxy(getmaxx div 2,getmaxy div 2,'attendez s.v.p');
Delay(1000);
Sound(100);Delay(300);NoSound;
End;
setcolor(0);outtextxy(getmaxx div 2,getmaxy div 2,'attendez s.v.p');delay(900); Sound(200);Delay(500);NoSound;
End;
Procedure Boule(X,Y,Coul,col:Integer);
Var i:Integer;
Begin
setcolor(col);
SetFillStyle(Coul,random(getmaxcolor)+1);
FillEllipse(X,Y,R,R);
End;
Procedure Barre(x1,y1,x2,y2,col1:integer);
Begin
SetColor(Col1);
Rectangle(x1,y1,x2,y2);
End;
Begin
clrscr;
X:=0;
Y:=0;
A:=0;
B:=0; score:=0;
textcolor(14);
GotoXy(20,2);Write('ooOoo JEU DE LA BOULE ooOoo');
GotoXy(20,3);Write('---------------------------');
GotoXy(20,4);Write('1. facile');
GotoXy(20,5);Write('2. moyen');
GotoXy(20,6);Write('3. defficile');
GotoXy(20,7);Write('0. Quitter');
Repeat
GotoXy(20,9);Write('Faites votre choix S.V.P...:');Readln(votre_choix);
Case votre_Choix Of
3:begin ValeurR:=5;end;
2:begin ValeurR:=10;end;
1:begin ValeurR:=15;end;
0:Exit;
End;
Until (votre_Choix>=0)And(votre_Choix<=3);
nosound;
Graphdriver := Detect;
InitGraph(Graphdriver, Graphmode, ' ');
if GraphResult <> grOk then Halt(1);
Preparer;
Randomize;
X:=300;Y:=GetMaxY-N;
Bas:=True;
Repeat
If Not keypressed Then
begin
Boule(A,B,0,0);
If B=R Then Begin Bas:=True; A:=Random(GetMaxX); End;
If B=GetMaxY-R Then begin b:=r; test:=test+1; end;
if test=3 then
Begin SetColor(15);OutTextXy(200,200,' Vous avez perdu ! '); Readln; Goto 1; End;
B:=B+1;
Boule(A,B,1,random(getmaxcolor)+1);
Delay(ValeurR);
Boule(x+25+r,y-r-2,0,0);
End
Else touche := Readkey;
If touche=#0 then
Begin
Barre(X,Y,X+25,Y+5,0);
touche := Readkey;
If touche=#77 then If X>=GetMaxX Then X:=0 else X:=X+10;
If touche=#75 then If X<=0 Then X:=getmaxX else X:=X-10;
Barre(X,Y,X+25,Y+5,random(getmaxcolor)+1);
End;
If (X<=A+R) And (A<=X+25+R)And(B=Y-R-2) Then Begin Boule(A,B,0,0); sound(200);delay(10);Nosound;b:=r;
score:=score+10; if(votre_choix<=3) then begin if (valeurr<=3) and (score mod 30 = 0) then valeurr:=valeurr-4; end; End;
Until touche=#27;
1:CloseGraph;
textcolor(2);
gotoxy(30,12);
write('votre score est: ', score);
readln;
clrscr;
end.
Sources de la même categorie
Sources en rapport avec celle ci
Commentaires et avis
Discussions en rapport avec ce code source dans le forum
programmation jeu de dames sur delphi4.0 en pascal [ par Laurie ]
Comment programmer un jeu de dames avec un stringgrid pour que les pionts ne puissent pas reculer? Comment faire apparaître une dame et controler ses
Livre Delphi ou Pascal ? [ par stailer ]
Salut,Comme je l'ai déjà dit plus bas dans ce forum je programme en Delphi depuis 3 mois.Je m'en sors assez bien avec les bases de données et les comp
DelphiX: ralentissements!! [ par costello ]
AAAARGGHH (cri de détresse) ! je développe 1 jeu depuis quelques jours, sous DelphiX / Delphi 7 perso (tout tourne très bien jusqu'à maintenant, ya ja
Isoler un caractère d'une chaîne... [ par mentral ]
Bonjour à tous ! Je viens du monde Pascal sous DOS et j'assure une transition sur le Delphi. Sous Pascal, je peux isoler les caractères d'une chaîne e
est-il utile d'apprendre le language pascal ? [ par msoin ]
slt, tous.Alors, je debute sous delphi 7.Mais malgré toutes les fonctions, certaines doivent être programmées manuelement, sauf que je comprend pas tr
comprendre le pascal ? [ par msoin ]
slt, tous.Alors, je debute sous delphi 7.Mais malgré toutes les fonctions, certaines doivent être programmées manuelement, sauf que je comprend pas tr
exemple de programme en turbo pascal [ par romualdus ]
je suis a la recherche d'exemples de programmes en turbo pascal pour mieux comprendre la methode pour pouvoir ecrire des programmes dans ce langage .M
Pascal hier Delphi aujourd'hui [ par sysdis ]
Bonjour,J'ai utilisé pascal pendant 6 ans 1982-1988.Je voudrai savoir comment je peux bien débuter Delphi.Mes salutations.
Problème d'implémentation Huffman en pascal [ par nikhil ]
J'ai problème lors de la création de l'arbre du Huffman. Je n'arrive pas à le relire. Vous pouvez trouver le code source : http://nikhil.free.fr/huf.p
jeu complet opengl [ par norton ]
Bonjour je voudrai savoir si c'est possible de faire un jeu complet comme cs ou hl ou encore unreal tournament en opengl en language Delphi ?? (pascal
|
Téléchargements
Logiciels à télécharger sur le même thème :
|