Unconfigured Ad Widget

Collapse

Anúncio

Collapse
No announcement yet.

Jogo Desenvolvido em Pascal

Collapse
X
 
  • Filter
  • Tempo
  • Show
Clear All
new posts

  • Font Size
    #1

    Pascal Jogo Desenvolvido em Pascal

    Sales Soft - Mr.NeT
    Download do jogo no 4shared:
    Apenas usuários registrados e ativados podem ver os links., Clique aqui para se cadastrar...

    Jogo desenvolvido em pascal ao melhor estilo old school.
    O código fonte esta aque (por favor, jogo criado por mim e uma contribuição de um amigo e claro um agradecimento a toda internet, se possível não seja um hipster :

    VIVA O OPEN-SOURCE

    //Software Livre, Compartilhe essa ideia!
    {Sales Soft - Mr.NeT 2012-2014 Logerfo 2012-2014;}
    uses crt;
    var
    iNav1,iNav2:array[1..4] of integer;
    iNPC,iScore : array[1..2] of integer;
    iMenu : array[1..3] of integer;
    sJogar : array[1..4] of string;
    cControl : array[1..6] of char;
    iGanhou,iTemp,iCont :integer;
    cKey:char;
    sNome : array[1..2] of string;
    lTiro1,lTiro2,lFlag : boolean;
    //varscore : file of integer;
    label Inicio,Fim,ToPack;
    procedure Zerar;
    begin for iCont:=1 to 4 do begin iNav1[iCont] := 0;iNav2[iCont] := 0;sJogar[iCont]:=' ';end;
    iNPC[1] := 0;
    iNPC[2] := 0;
    iGanhou := 0;
    iTemp := 0;
    lTiro1 := FALSE;
    lTiro2 := FALSE;
    lFlag := FALSE;
    if cKey <> #13 then
    begin
    cControl[1] := #75;
    cControl[2] := #77;
    cControl[3] := #72;
    cControl[4] := 'a';
    cControl[5] := 'd';
    cControl[6] := ' ';
    end;
    cKey := ' ';
    end;
    procedure Contagem;
    begin
    textcolor;
    gotoxy(36,10);
    write(' ____ ');
    gotoxy(36,11);
    write(' |___ \ ');
    gotoxy(36,12);
    write(' __) |');
    gotoxy(36,13);
    write(' |__ < ');
    gotoxy(36,14);
    write(' ___) |');
    gotoxy(36,15);
    write(' |____/ ');
    gotoxy(15,20);
    write('Player 1 utiliza os direcionais do teclado por padrao.');
    gotoxy(15,21);
    write('Player 2 utiliza as teclas A,D,Space do teclado por padrao.');
    delay(500);
    clrscr;
    gotoxy(37,10);
    write(' ___ ');
    gotoxy(37,11);
    write(' |__ \ ');
    gotoxy(37,12);
    write(' ) |');
    gotoxy(37,13);
    write(' / / ');
    gotoxy(37,14);
    write(' / /_ ');
    gotoxy(37,15);
    write(' |____|');
    gotoxy(15,20);
    write('Player 1 utiliza os direcionais do teclado por padrao.');
    gotoxy(15,21);
    write('Player 2 utiliza as teclas A,D,Space do teclado por padrao.');
    delay(500);
    clrscr;
    gotoxy(39,10);
    write(' __ ');
    gotoxy(39,11);
    write('/_ |');
    gotoxy(39,12);
    write(' | |');
    gotoxy(39,13);
    write(' | |');
    gotoxy(39,14);
    write(' | |');
    gotoxy(39,15);
    write(' |_|');
    gotoxy(15,20);
    write('Player 1 utiliza os direcionais do teclado por padrao.');
    gotoxy(15,21);
    write('Player 2 utiliza as teclas A,D,Space do teclado por padrao.');
    delay(500);
    gotoxy(15,20);
    write('Player 1 utiliza os direcionais do teclado por padrao.');
    gotoxy(15,21);
    write('Player 2 utiliza as teclas A,D,Space do teclado por padrao.');
    clrscr;
    gotoxy(32,10);
    write(' _____ _ ');
    gotoxy(32,11);
    write(' / ____| | |');
    gotoxy(32,12);
    write(' | | __ ___ | |');
    gotoxy(32,13);
    write(' | | |_ |/ _ \| |');
    gotoxy(32,14);
    write(' | |__| | (_) |_|');
    gotoxy(32,15);
    write(' \_____|\___/(_)');
    gotoxy(15,20);
    write('Player 1 utiliza os direcionais do teclado por padrao.');
    gotoxy(15,21);
    write('Player 2 utiliza as teclas A,D,Space do teclado por padrao.');
    delay(500);
    textbackground(0);
    clrscr;
    goto ToPack;
    end;
    procedure Jogar;
    begin
    sJogar[1] := 'Player 1';
    sJogar[2] := 'Player 2';
    sJogar[3] := ' NPC 1 ';
    sJogar[4] := ' NPC 2 ';
    iMenu[1] := 1;
    iMenu[2] := 20;
    repeat
    gotoxy(iMenu[2],12);
    write('< ',sJogar[iMenu[1]],' >');
    while not(keypressed) do
    begin end;
    cKey := readkey;
    case cKey of
    #75: if iMenu[1] > 1 then
    DEC(iMenu[1])
    else
    iMenu[1] := 4;
    #77: if iMenu[1] < 4 then
    INC(iMenu[1])
    else
    iMenu[1] := 1;
    #13: begin
    if ((iMenu[1] = 1) or (iMenu[1] = 2)) and (lFlag = TRUE) then
    begin
    cursoron;
    gotoxy(50,15);
    write('Digite o nome: ');
    gotoxy(50,16);
    readln(sNome[2]);
    cursoroff;
    end;
    if iMenu[2] = 20 then
    begin
    if ((iMenu[1] = 1) or (iMenu[1] = 2)) and (lFlag = FALSE) then
    begin
    lFlag := TRUE;
    cursoron;
    gotoxy(20,15);
    write('Digite o nome: ');
    gotoxy(20,16);
    readln(sNome[1]);
    cursoroff;
    end
    else
    if iMenu[1] > 2 then
    lFlag := TRUE;
    gotoxy(10,10);
    iMenu[3] := iMenu[1];
    INC(iMenu[1]);
    if iMenu[1] > 4 then
    iMenu[1] := 1;
    iMenu[2] := 50;
    cKey := ' ';
    end;
    end;
    end;
    if (iMenu[3] = 1) and (iMenu[1] = 1) and (cKey = #75) then
    iMenu[1] := 4
    else
    if (iMenu[3] = 1) and (iMenu[1] = 1) and (cKey = #77) then
    iMenu[1] := 2;
    if (iMenu[3] = 2) and (iMenu[1] = 2) and (cKey = #77) then
    iMenu[1] := 3
    else
    if (iMenu[3] = 2) and (iMenu[1] = 2) and (cKey = #75) then
    iMenu[1] := 1;
    if (iMenu[3] = 3) and (iMenu[1] = 3) and (cKey = #75) then
    iMenu[1] := 2
    else
    if (iMenu[3] = 3) and (iMenu[1] = 3) and (cKey = #77) then
    iMenu[1] := 4;
    if (iMenu[3] = 4) and (iMenu[1] = 4) and (cKey = #77) then
    iMenu[1] := 1
    else
    if (iMenu[3] = 4) and (iMenu[1] = 4) and (cKey = #75) then
    iMenu[1] := 3;
    if (iMenu[3] = 1) and (iMenu[1] = 3) and (cKey = #77) then
    iMenu[1] := 4
    else
    if (iMenu[3] = 1) and (iMenu[1] = 3) and (cKey = #75) then
    iMenu[1] := 2;
    if (iMenu[3] = 2) and (iMenu[1] = 4) and (cKey = #75) then
    iMenu[1] := 3
    else
    if (iMenu[3] = 2) and (iMenu[1] = 4) and (cKey = #77) then
    iMenu[1] := 1;

    if (iMenu[3] = 4) and (iMenu[1] = 2) and (cKey = #75) then
    iMenu[1] := 1
    else
    if (iMenu[3] = 4) and (iMenu[1] = 2) and (cKey = #77) then
    iMenu[1] := 3;

    if (iMenu[3] = 3) and (iMenu[1] = 1) and (cKey = #75) then
    iMenu[1] := 4
    else
    if (iMenu[3] = 3) and (iMenu[1] = 1) and (cKey = #77) then
    iMenu[1] := 2;
    until (iMenu[2] = 50) and (cKey = #13) and (lFlag = TRUE);
    clrscr;
    Contagem;
    end;
    procedure Configuracoes;
    begin
    iMenu[1] := 1;
    repeat
    if cKey = #9 then
    begin
    textbackground(15);
    if iMenu[1] = 1 then
    begin
    gotoxy(34,16);
    write('Esquerda - Left');
    if iMenu[1] = 1 then
    cControl[1] := readkey;
    if cControl[1] = #0 then
    cControl[1] := readkey;
    end;
    if iMenu[1] = 2 then
    begin
    gotoxy(34,18);
    write('Direita - Right');
    if iMenu[1] = 2 then
    cControl[2] := readkey;
    if cControl[2] = #0 then
    cControl[2] := readkey;
    end;
    if iMenu[1] = 3 then
    begin
    gotoxy(39,20);
    write('Tiro');
    if iMenu[1] = 3 then
    cControl[3] := readkey;
    if cControl[3] = #0 then
    cControl[3] := readkey;
    end;
    end;
    textcolor(12);
    if iMenu[1] = 1 then
    textbackground(9)
    else
    textbackground(0);
    textcolor(12);
    gotoxy(34,16);
    writeln('Esquerda - Left');
    if iMenu[1] = 2 then
    textbackground(9)
    else
    textbackground(0);
    gotoxy(34,18);
    writeln('Direita - Right');
    if iMenu[1] = 3 then
    textbackground(9)
    else
    textbackground(0);
    gotoxy(39,20);
    writeln('Tiro');
    textbackground(0);
    gotoxy(1,24);
    write('Precione <TAB> para trocar a tecla de controle do Player 1!');
    gotoxy(1,25);
    write('Precione <enter> para Jogar!');
    cKey := readkey;
    case cKey of
    #72: if iMenu[1] > 1 then
    DEC(iMenu[1])
    else
    iMenu[1] := 3;
    #80: if iMenu[1] < 3 then
    INC(iMenu[1])
    else
    iMenu[1] := 1;
    end;
    until cKey = #13;
    clrscr;
    Jogar;
    end;
    procedure Menu;
    begin
    for iCont := 1 to 2 do
    begin
    iScore[iCont] := 0;
    sNome[iCont] := ' ';
    end;
    textcolor(15);
    writeln('SS - SalesSoft - ToPack Beta 1.0 - QBSN - BCL - CTI 2012-2014');
    writeln('contato: quintinobsneto[at]gmail[dot]com');
    write('Pressione uma tecla para carregar o jogo! ');
    readkey;
    clrscr;
    Zerar;
    iMenu[1] := 1;
    repeat
    textbackground(9);
    textcolor(11);
    gotoxy(15,4);
    write('####### ###### # ');
    writeln;
    gotoxy(15,5);
    write(' # # # # ');
    writeln;
    gotoxy(15,6);
    write(' # ##### # # ###### ##### # ## ');
    writeln;
    gotoxy(15,7);
    write(' # # # ###### # # # # # ');
    writeln;
    gotoxy(15,8);
    write(' # # # # # # # ### ');
    writeln;
    gotoxy(15,9);
    write(' # # # # # ## # # # ');
    writeln;
    gotoxy(15,10);
    write(' # ##### # #### # ##### # ## ');
    textcolor(12);
    if iMenu[1] = 1 then
    textbackground(9)
    else
    textbackground(0);
    textcolor(12);
    gotoxy(37,16);
    writeln('Jogar');
    if iMenu[1] = 2 then
    textbackground(9)
    else
    textbackground(0);
    gotoxy(34,18);
    writeln('Configuracoes');
    if iMenu[1] = 3 then
    textbackground(9)
    else
    textbackground(0);
    gotoxy(38,20);
    writeln('Sair');
    while not(keypressed) do
    begin end;
    cKey := readkey;
    case cKey of
    #72: if iMenu[1] > 1 then
    DEC(iMenu[1])
    else
    iMenu[1] := 3;
    #80: if iMenu[1] < 3 then
    INC(iMenu[1])
    else
    iMenu[1] := 1;
    #27: goto Fim;
    end;
    until cKey = #13;
    clrscr;
    if iMenu[1] = 1 then
    begin
    Jogar;
    end;
    if iMenu[1] = 2 then
    Configuracoes;
    if iMenu[1] = 3 then
    begin
    iGanhou := 0;
    textbackground(0);
    goto Fim;
    end;
    end;
    procedure Nav1R;
    begin
    if iNav1[2] + 2 < 79 then
    begin
    INC(iNav1[1]);
    INC(iNav1[2]);
    end;
    end;
    procedure Nav1L;
    begin
    if iNav1[2] > 2 then
    begin
    DEC(iNav1[1]);
    DEC(iNav1[2]);
    end;
    end;
    procedure Nav2R;
    begin
    if iNav2[2] + 2 < 79 then
    begin
    INC(iNav2[1]);
    INC(iNav2[2]);
    end;
    end;
    procedure Nav2L;
    begin
    if iNav2[2] > 2 then
    begin
    DEC(iNav2[1]);
    DEC(iNav2[2]);
    end;
    end;
    procedure Tiro1;
    begin
    lTiro1 := TRUE;
    INC(iNav1[4]);
    gotoxy(iNav1[3],iNav1[4]);
    textcolor(lightgreen);
    write(#254);
    if iNav1[4] > 4 then
    begin
    gotoxy(iNav1[3],(iNav1[4]-2));
    write(' ');
    end;
    delay(15);
    if ((iNav2[2] + 1 = iNav1[3]) and (iNav1[4] = 24) or (iNav2[2] = iNav1[3]) and (iNav1[4] = 25) or (iNav2[2] + 2 = iNav1[3]) and (iNav1[4] = 25)) then
    begin
    iGanhou := 1;
    goto Fim;
    end;
    if iNav1[4] = 25 then
    begin
    lTiro1 := FALSE;
    iNav1[3] := 0;
    iNav1[4] := 0;
    clrscr;
    goto Inicio;
    end;
    end;
    procedure Tiro2;
    begin
    lTiro2 := TRUE;
    DEC(iNav2[4]);
    gotoxy(iNav2[3],iNav2[4]);
    textcolor(11);
    write(#254);
    if iNav2[4] < 22 then
    begin
    gotoxy(iNav2[3],(iNav2[4]+2));
    write(' ');
    end;
    delay(15);
    if ((iNav1[2] + 1 = iNav2[3]) and (iNav2[4] = 2) or (iNav1[2] = iNav2[3]) and (iNav2[4] = 1) or (iNav1[2] + 2 = iNav2[3]) and (iNav2[4] = 1)) then
    begin
    iGanhou := 2;
    goto Fim;
    end;
    if iNav2[4] = 1 then
    begin
    lTiro2 := FALSE;
    iNav2[3] := 0;
    iNav2[4] := 0;
    clrscr;
    goto Inicio;
    end;
    end;
    procedure Print;
    begin
    textcolor(15);
    gotoxy(1,3);
    write(sNome[1],' ',iScore[1],' X ',iScore[2],' ',sNome[2]);
    textcolor(12);
    gotoxy(iNav1[1],1);
    write(#254,#254,#254);
    gotoxy(iNav1[2],2);
    write(' ',#254);
    textcolor(lightblue);
    gotoxy(iNav2[1],25);
    write(#254,#254,#254);
    gotoxy(iNav2[2],24);
    write(' ',#254);
    end;
    procedure NPC1;
    begin
    if (iMenu[1] = 3) or (iMenu[3] = 3) then
    begin
    if ((iNav2[3] = iNav1[2] + 1) and (iNav2[4] <= 5)) then
    begin
    if iNav1[2] > 70 then
    Nav1L
    else
    if iNav1[2] < 10 then
    Nav1R
    else
    begin
    iNPC[1] := random(2);
    if iNPC[1] = 0 then
    Nav1L
    else
    Nav1R
    end;
    end
    else
    begin
    if iNav2[2] + 1 < iNav1[2] + 1 then Nav1L;
    if iNav2[2] + 1 > iNav1[2] + 1 then Nav1R;
    if lTiro1 = FALSE then begin iNav1[3] := iNav1[2] + 1;Tiro1;end;
    end;
    if ((iNav2[3] = iNav1[2]) and (iNav2[4] <= 5)) then
    Nav1R;
    if ((iNav2[3] = iNav1[2] + 2) and (iNav2[4] <= 5 )) then
    Nav1L;
    clrscr;
    Print;
    iTemp := 0;
    end;
    end;
    procedure NPC2;
    begin
    if (iMenu[1] = 4) or (iMenu[3] = 4) then
    begin
    if ((iNav1[3] = iNav2[2] + 1) and (iNav1[4] >= 20)) then
    begin
    if iNav2[2] > 70 then
    Nav2L
    else
    if iNav2[2] < 10 then
    Nav2R
    else
    begin
    iNPC[2] := random(2);
    if iNPC[2] = 0 then
    Nav2L
    else
    Nav2R
    end;
    end
    else
    begin
    if iNav1[2] + 1 < iNav2[2] + 1 then Nav2L;
    if iNav1[2] + 1 > iNav2[2] + 1 then Nav2R;
    if lTiro2 = FALSE then begin iNav2[3] := iNav2[2] + 1;iNav2[4] := 25;Tiro2;
    end;
    end;
    if (iNav1[3] = iNav2[2]) and (iNav1[4] >= 20) then
    Nav2R;
    if ((iNav1[3] = iNav2[2] + 2) and (iNav1[4] >= 20)) then
    Nav2L;
    clrscr;
    Print;
    iTemp := 0;
    end;
    end;
    procedure key;
    begin
    if (iMenu[3] = 1) or (iMenu[3] = 2) or (iMenu[2] = 1) or (iMenu[2] = 2) then
    begin
    if cControl[1] = cKey then
    Nav1L;
    end;
    if cControl[2] = cKey then
    Nav1R;
    if cControl[3] = (cKey) then
    if lTiro1 = FALSE then
    begin
    iNav1[3] := iNav1[2] + 1;
    iNav1[4] := 2;
    Tiro1;
    end;
    if cControl[4] = (cKey)then
    Nav2L;
    if cControl[5] = (cKey) then
    Nav2R;
    if cControl[6] = (cKey) then
    if lTiro2 = FALSE then
    begin
    iNav2[3] := iNav2[2] + 1;
    iNav2[4] := 24;
    Tiro2;
    end;
    if cKey = #9 then
    readkey;
    end;
    begin
    cursoroff;
    cKey := ' ';
    Menu;
    ToPack:
    randomize;
    cursoroff;
    while (iNav1[1] < 1) or (iNav1[1] > 78) do
    begin
    iNav1[1] := random(80);
    iNav1[2] := iNav1[1];
    end;
    while (iNav2[1] < 1) or (iNav2[1] > 78) do
    begin
    iNav2[1] := random(80);
    iNav2[2] := iNav2[1];
    end;
    Inicio:
    repeat
    NPC1;
    NPC2;
    Print;
    while not(keypressed) do
    begin
    if lTiro1 then Tiro1;
    if lTiro2 then Tiro2;
    if iTemp > 1 then
    begin
    NPC1;
    NPC2;
    end;
    INC(iTemp);
    end;
    begin
    if lTiro1 then Tiro1;
    if lTiro2 then Tiro2;
    cKey := readkey;
    if cKey = #0 then
    cKey := readkey;
    key;
    clrscr;
    end;
    until cKey = #27;
    Fim:
    clrscr;
    textcolor(lightgreen);
    gotoxy(1,1);
    if iGanhou > 0 then
    begin
    writeln('Player ',iGanhou,': Ganhou !');
    if iGanhou = 1 then
    INC(iScore[1])
    else
    INC(iScore[2]);
    writeln;
    gotoxy(11,8);
    write(' ___ __ __ __ ____ _____ _ _ ____ ____ /\');
    writeln;
    gotoxy(11,9);
    write(' / __) /__\ ( \/ )( ___) ( _ )( \/ )( ___)( _ \ )(');
    writeln;
    gotoxy(11,10);
    write('( (_-. /(__)\ ) ( )__) )(_)( \ / )__) ) / \/');
    writeln;
    gotoxy(11,11);
    write(' \___/(__)(__)(_/\/\_)(____) (_____) \/ (____)(_)\_) ()');
    writeln;
    gotoxy(1,22);
    end;
    write('Pressione <enter> para jogar novamente');
    writeln;
    write('Pressione <Back Space> para ir ao menu');
    writeln;
    write('Pressione <ESC> para sair');
    while (cKey <> #27) or (cKey <> ' ') or (cKey <> #13) do
    begin
    cKey := (readkey);
    Case cKey of
    #27: exit;
    #13: begin clrscr; Zerar; Contagem; goto ToPack; end;
    #8: begin clrscr; iMenu[1] := 0; iMenu[2] := 0; iMenu[3] := 0; Menu; end;
    end;
    end;
    end.
    //©© Todos os direitos reservados
    tb anexei um txt com o fonte.
    Attached Files
    Use Débian, Aprenda Slackware e Brinque Muito Com Back|Track

    "O conhecimento é em si mesmo um poder"

    "Não subestime os fracos pois eles não agem com a força e sim com a mente"
    Similar Threads

  • Font Size
    #2
    Parece bom, vamos testar. poderia colocar ume descrição de como o jogo é... vou ter que instalar o pascal para testar.

    Comment

    X
    Working...
    X