Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<stdlib.h>
- #include<stdio.h>
- #include<time.h>
- #include<conio.h> // não faz parte das bibliotecas originais do Code:Blocks, deve ser instalada. Video de ajuda que utilizei <https://www.youtube.com/watch?v=6NZKOn8k7Bw>
- #include<windows.h>
- // ################### Atualização 3.0 #####################
- // Atualizem a versão caso façam alguma modificação no codigo!!
- // Video base da biblioteca conio.h : https://www.youtube.com/watch?v=9m5-LHzJoTY
- /*
- PRESCISAMOS IMPREMENTAR UMA FUNÇÃO OU PROCEDIMENTO PARA MOVER OS FANTASMAS. ACREDITO QUE PODEMOS UTILIZAR APENAS 2 LOGICAS DE MOVIMENTAÇÃO. 1° SEGUIR FIELMENTE O PACMAN; 2º ALEATÓRIA
- COM A 1º FUNÇÃO PODEMOS TANTO FAZER O PACMAN "ASSUSTADO" OU "ATACANTE" MUDANDO APENAS A "POSIÇÃO DE PERSEGUIÇAO" DOS FANTASMAS
- PARA DAR MAIS VIDA AOS FANTASMA DA PRA UTILIZAR UM CONTADOR "TIMER", A CADA TEMPO MUDA O COMPORTAMENTO DOS FANTASMA (ATACANTE E ALEATÓRIO),
- O COMPORTAMENTO ASSUSTADO APENAS SERÁ ATIVO QUANDO O PACMAN COMER A FRUTINHA...
- */
- int x=24, y=21, xx=0, yy=0, fps=150, nv=1; // pacman
- int pts=0; //pontos
- int vx=14,vy=21,valorv,valorv2,cv=0,corv=12,tipv=5; // variaveis do fantasma vermelho
- int ax=16,ay=21,valora=4,ca=0,pts2=0,cora=5,tipa=5; // variaveis fantasma azul / pts2 = controle da saida dos fantasmas
- int lx=16,ly=19,valorl=4,cl=0,corl=2,tipl=5; //variaveis fantasma verde
- int vvx=16,vvy=23,valorvv=4,cvv=0,corvv=6,tipvv=5,mvv=0; //variaveis fantasma laranja
- int destinovermelhox,destinovermelhoy; //fantasma laranja
- int cf=0; //controle fruta
- int cm=0,k=0,pts3=0,un=0,r=0; // cm = controle morte / pts3 = controle tempo de cm=1 /
- int tot=0, cm2=0,cm3=0,cm4=0,cm5=0; // tot= controle das pilulas consumidas
- int pts4=0,pts5=0;
- void mapa();
- void zerar();
- void begin();
- int cenario[32][43] =
- {
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 80, 79, 78, 84, 79, 83, 58, 0, 0, 0, 0, 0, 86, 73, 68, 65, 83, 58, 2, 2, // MENUS DE PONTOS, VIDAS...
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 201, 205, 205, 205, 205, 205, 205, 205, 205, 205, 205, 205, 205, 205, 205, 205, 205, 205, 205, 205, 187, 0, 201, 205, 205, 205, 205, 205, 205, 205, 205, 205, 205, 205, 205, 205, 205, 205, 205, 205, 205, 205, 187,
- 186, 254, 250, 250, 250, 250, 250, 250, 250, 250, 250, 250, 250, 250, 250, 250, 250, 250, 250, 250, 186, 0, 186, 250, 250, 250, 250, 250, 250, 250, 250, 250, 250, 250, 250, 250, 250, 250, 250, 250, 250, 254, 186,
- 186, 250, 201, 205, 205, 205, 205, 205, 187, 250, 201, 205, 205, 205, 205, 205, 205, 205, 187, 250, 186, 0, 186, 250, 201, 205, 205, 205, 205, 205, 205, 205, 187, 250, 201, 205, 205, 205, 205, 205, 187, 250, 186,
- 186, 250, 186, 0, 0, 0, 0, 0, 186, 250, 186, 0, 0, 0, 0, 0, 0, 0, 186, 250, 186, 0, 186, 250, 186, 0, 0, 0, 0, 0, 0, 0, 186, 250, 186, 0, 0, 0, 0, 0, 186, 250, 186,
- 186, 250, 200, 205, 205, 205, 205, 205, 188, 250, 200, 205, 205, 205, 205, 205, 205, 205, 188, 250, 200, 205, 188, 250, 200, 205, 205, 205, 205, 205, 205, 205, 188, 250, 200, 205, 205, 205, 205, 205, 188, 250, 186,
- 186, 250, 250, 250, 250, 250, 250, 250, 250, 0, 250, 250, 250, 250, 250, 250, 250, 250, 250, 0, 250, 250, 250, 0, 250, 250, 250, 250, 250, 250, 250, 250, 250, 0, 250, 250, 250, 250, 250, 250, 250, 250, 186,
- 186, 250, 201, 205, 205, 205, 205, 205, 187, 250, 201, 205, 187, 250, 201, 205, 205, 205, 205, 205, 205, 205, 205, 205, 205, 205, 205, 205, 187, 250, 201, 205, 187, 250, 201, 205, 205, 205, 205, 205, 187, 250, 186,
- 186, 250, 200, 205, 205, 205, 205, 205, 188, 250, 186, 0, 186, 250, 200, 205, 205, 205, 205, 187, 0, 0, 0, 201, 205, 205, 205, 205, 188, 250, 186, 0, 186, 250, 200, 205, 205, 205, 205, 205, 188, 250, 186,
- 186, 250, 250, 250, 250, 250, 250, 250, 250, 250, 186, 0, 186, 250, 250, 250, 250, 250, 250, 186, 0, 0, 0, 186, 250, 250, 250, 250, 250, 250, 186, 0, 186, 250, 250, 250, 250, 250, 250, 250, 250, 250, 186,
- 200, 205, 205, 205, 205, 205, 205, 205, 187, 250, 186, 0, 200, 205, 205, 205, 205, 187, 250, 186, 0, 0, 0, 186, 250, 201, 205, 205, 205, 205, 188, 0, 186, 250, 201, 205, 205, 205, 205, 205, 205, 205, 188,
- 0, 0, 0, 0, 0, 0, 0, 0, 186, 250, 186, 0, 201, 205, 205, 205, 205, 188, 250, 200, 205, 205, 205, 188, 250, 200, 205, 205, 205, 205, 187, 0, 186, 250, 186, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 186, 250, 186, 0, 186, 250, 250, 250, 250, 250, 250, 250, 250, 250, 250, 250, 250, 250, 250, 250, 250, 250, 186, 0, 186, 250, 186, 0, 0, 0, 0, 0, 0, 0, 0,
- 205, 205, 205, 205, 205, 205, 205, 205, 188, 250, 200, 205, 188, 250, 201, 205, 205, 205, 205, 205, 205, 205, 205, 205, 205, 205, 205, 205, 187, 250, 200, 205, 188, 250, 200, 205, 205, 205, 205, 205, 205, 205, 205,
- 250, 250, 250, 250, 250, 250, 250, 250, 250, 0, 250, 250, 250, 250, 186, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 186, 250, 250, 250, 250, 0, 250, 250, 250, 250, 250, 250, 250, 250, 250,
- 205, 205, 205, 205, 205, 205, 205, 205, 187, 250, 201, 205, 187, 250, 200, 205, 205, 205, 205, 205, 205, 205, 205, 205, 205, 205, 205, 205, 188, 250, 201, 205, 187, 250, 201, 205, 205, 205, 205, 205, 205, 205, 205,
- 0, 0, 0, 0, 0, 0, 0, 0, 186, 250, 186, 0, 186, 250, 250, 250, 250, 250, 250, 250, 250, 250, 250, 250, 250, 250, 250, 250, 250, 250, 186, 0, 186, 250, 186, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 186, 250, 186, 0, 186, 250, 201, 205, 205, 205, 205, 205, 205, 205, 205, 205, 205, 205, 205, 205, 187, 250, 186, 0, 186, 250, 186, 0, 0, 0, 0, 0, 0, 0, 0,
- 201, 205, 205, 205, 205, 205, 205, 205, 188, 250, 200, 205, 188, 250, 200, 205, 205, 205, 205, 187, 0, 0, 0, 201, 205, 205, 205, 205, 188, 250, 200, 205, 188, 250, 200, 205, 205, 205, 205, 205, 205, 205, 187,
- 186, 250, 250, 250, 250, 250, 250, 250, 250, 0, 250, 250, 250, 250, 250, 250, 250, 250, 250, 186, 0, 0, 0, 186, 250, 250, 250, 250, 250, 250, 250, 250, 250, 0, 250, 250, 250, 250, 250, 250, 250, 250, 186,
- 186, 250, 201, 205, 205, 205, 205, 205, 187, 250, 201, 205, 205, 205, 205, 205, 205, 187, 250, 186, 0, 0, 0, 186, 250, 201, 205, 205, 205, 205, 205, 205, 187, 250, 201, 205, 205, 205, 205, 205, 187, 250, 186,
- 186, 250, 200, 205, 205, 205, 187, 0, 186, 250, 200, 205, 205, 205, 205, 205, 205, 188, 250, 200, 205, 205, 205, 188, 250, 200, 205, 205, 205, 205, 205, 205, 188, 250, 186, 0, 201, 205, 205, 205, 188, 250, 186,
- 186, 250, 250, 250, 250, 250, 186, 0, 186, 250, 250, 250, 250, 250, 250, 250, 250, 250, 250, 250, 250, 250, 250, 250, 250, 250, 250, 250, 250, 250, 250, 250, 250, 250, 186, 0, 186, 250, 250, 250, 250, 250, 186,
- 200, 205, 205, 205, 187, 250, 186 , 0, 186, 250, 201, 205, 187, 250, 201, 205, 205, 205, 205, 205, 205, 205, 205, 205, 205, 205, 205, 205, 187, 250, 201, 205, 187, 250, 186, 0, 186, 250, 201, 205, 205, 205, 188,
- 201, 205, 205, 205, 188, 250, 200, 205, 188, 250, 186, 0, 186, 250, 200, 205, 205, 205, 205, 187, 0, 0, 0, 201, 205, 205, 205, 205, 188, 250, 186, 0, 186, 250, 200, 205, 188, 250, 200, 205, 205, 205, 187,
- 186, 250, 250, 250, 250, 250, 250, 250, 250, 250, 186, 0, 186, 250, 250, 250, 250, 250, 250, 186, 0, 0, 0, 186, 250, 250, 250, 250, 250, 250, 186, 0, 186, 250, 250, 250, 250, 250, 250, 250, 250, 250, 186,
- 186, 250, 201, 205, 205, 205, 205, 205, 205, 205, 188, 0, 200, 205, 205, 205, 205, 187, 250, 186, 0, 0, 0, 186, 250, 201, 205, 205, 205, 205, 188, 0, 200, 205, 205, 205, 205, 205, 205, 205, 187, 250, 186,
- 186, 250, 200, 205, 205, 205, 205, 205, 205, 205, 205, 205, 205, 205, 205, 205, 205, 188, 250, 200, 205, 205, 205, 188, 250, 200, 205, 205, 205, 205, 205, 205, 205, 205, 205, 205, 205, 205, 205, 205, 188, 250, 186,
- 186, 254, 250, 250, 250, 250, 250, 250, 250, 250, 250, 250, 250, 250, 250, 250, 250, 250, 0, 250, 250, 250, 250, 250, 0, 250, 250, 250, 250, 250, 250, 250, 250, 250, 250, 250, 250, 250, 250, 250, 250, 254, 186,
- 200, 205, 205, 205, 205, 205, 205, 205, 205, 205, 205, 205, 205, 205, 205, 205, 205, 205, 205, 205, 205, 205, 205, 205, 205, 205, 205, 205, 205, 205, 205, 205, 205, 205, 205, 205, 205, 205, 205, 205, 205, 205, 188,
- };
- int cenario2[32][43] =
- {
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 80, 79, 78, 84, 79, 83, 58, 0, 0, 0, 0, 0, 86, 73, 68, 65, 83, 58, 2, 2, // MENUS DE PONTOS, VIDAS...
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 201, 205, 205, 205, 205, 205, 205, 205, 205, 205, 205, 205, 205, 205, 205, 205, 205, 205, 205, 205, 187, 0, 201, 205, 205, 205, 205, 205, 205, 205, 205, 205, 205, 205, 205, 205, 205, 205, 205, 205, 205, 205, 187,
- 186, 254, 250, 250, 250, 250, 250, 250, 250, 250, 250, 250, 250, 250, 250, 250, 250, 250, 250, 250, 186, 0, 186, 250, 250, 250, 250, 250, 250, 250, 250, 250, 250, 250, 250, 250, 250, 250, 250, 250, 250, 254, 186,
- 186, 250, 201, 205, 205, 205, 205, 205, 187, 250, 201, 205, 205, 205, 205, 205, 205, 205, 187, 250, 186, 0, 186, 250, 201, 205, 205, 205, 205, 205, 205, 205, 187, 250, 201, 205, 205, 205, 205, 205, 187, 250, 186,
- 186, 250, 186, 0, 0, 0, 0, 0, 186, 250, 186, 0, 0, 0, 0, 0, 0, 0, 186, 250, 186, 0, 186, 250, 186, 0, 0, 0, 0, 0, 0, 0, 186, 250, 186, 0, 0, 0, 0, 0, 186, 250, 186,
- 186, 250, 200, 205, 205, 205, 205, 205, 188, 250, 200, 205, 205, 205, 205, 205, 205, 205, 188, 250, 200, 205, 188, 250, 200, 205, 205, 205, 205, 205, 205, 205, 188, 250, 200, 205, 205, 205, 205, 205, 188, 250, 186,
- 186, 250, 250, 250, 250, 250, 250, 250, 250, 0, 250, 250, 250, 250, 250, 250, 250, 250, 250, 0, 250, 250, 250, 0, 250, 250, 250, 250, 250, 250, 250, 250, 250, 0, 250, 250, 250, 250, 250, 250, 250, 250, 186,
- 186, 250, 201, 205, 205, 205, 205, 205, 187, 250, 201, 205, 187, 250, 201, 205, 205, 205, 205, 205, 205, 205, 205, 205, 205, 205, 205, 205, 187, 250, 201, 205, 187, 250, 201, 205, 205, 205, 205, 205, 187, 250, 186,
- 186, 250, 200, 205, 205, 205, 205, 205, 188, 250, 186, 0, 186, 250, 200, 205, 205, 205, 205, 187, 0, 0, 0, 201, 205, 205, 205, 205, 188, 250, 186, 0, 186, 250, 200, 205, 205, 205, 205, 205, 188, 250, 186,
- 186, 250, 250, 250, 250, 250, 250, 250, 250, 250, 186, 0, 186, 250, 250, 250, 250, 250, 250, 186, 0, 0, 0, 186, 250, 250, 250, 250, 250, 250, 186, 0, 186, 250, 250, 250, 250, 250, 250, 250, 250, 250, 186,
- 200, 205, 205, 205, 205, 205, 205, 205, 187, 250, 186, 0, 200, 205, 205, 205, 205, 187, 250, 186, 0, 0, 0, 186, 250, 201, 205, 205, 205, 205, 188, 0, 186, 250, 201, 205, 205, 205, 205, 205, 205, 205, 188,
- 0, 0, 0, 0, 0, 0, 0, 0, 186, 250, 186, 0, 201, 205, 205, 205, 205, 188, 250, 200, 205, 205, 205, 188, 250, 200, 205, 205, 205, 205, 187, 0, 186, 250, 186, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 186, 250, 186, 0, 186, 250, 250, 250, 250, 250, 250, 250, 250, 250, 250, 250, 250, 250, 250, 250, 250, 250, 186, 0, 186, 250, 186, 0, 0, 0, 0, 0, 0, 0, 0,
- 205, 205, 205, 205, 205, 205, 205, 205, 188, 250, 200, 205, 188, 250, 201, 205, 205, 205, 205, 205, 205, 205, 205, 205, 205, 205, 205, 205, 187, 250, 200, 205, 188, 250, 200, 205, 205, 205, 205, 205, 205, 205, 205,
- 250, 250, 250, 250, 250, 250, 250, 250, 250, 0, 250, 250, 250, 250, 186, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 186, 250, 250, 250, 250, 0, 250, 250, 250, 250, 250, 250, 250, 250, 250,
- 205, 205, 205, 205, 205, 205, 205, 205, 187, 250, 201, 205, 187, 250, 200, 205, 205, 205, 205, 205, 205, 205, 205, 205, 205, 205, 205, 205, 188, 250, 201, 205, 187, 250, 201, 205, 205, 205, 205, 205, 205, 205, 205,
- 0, 0, 0, 0, 0, 0, 0, 0, 186, 250, 186, 0, 186, 250, 250, 250, 250, 250, 250, 250, 250, 250, 250, 250, 250, 250, 250, 250, 250, 250, 186, 0, 186, 250, 186, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 186, 250, 186, 0, 186, 250, 201, 205, 205, 205, 205, 205, 205, 205, 205, 205, 205, 205, 205, 205, 187, 250, 186, 0, 186, 250, 186, 0, 0, 0, 0, 0, 0, 0, 0,
- 201, 205, 205, 205, 205, 205, 205, 205, 188, 250, 200, 205, 188, 250, 200, 205, 205, 205, 205, 187, 0, 0, 0, 201, 205, 205, 205, 205, 188, 250, 200, 205, 188, 250, 200, 205, 205, 205, 205, 205, 205, 205, 187,
- 186, 250, 250, 250, 250, 250, 250, 250, 250, 0, 250, 250, 250, 250, 250, 250, 250, 250, 250, 186, 0, 0, 0, 186, 250, 250, 250, 250, 250, 250, 250, 250, 250, 0, 250, 250, 250, 250, 250, 250, 250, 250, 186,
- 186, 250, 201, 205, 205, 205, 205, 205, 187, 250, 201, 205, 205, 205, 205, 205, 205, 187, 250, 186, 0, 0, 0, 186, 250, 201, 205, 205, 205, 205, 205, 205, 187, 250, 201, 205, 205, 205, 205, 205, 187, 250, 186,
- 186, 250, 200, 205, 205, 205, 187, 0, 186, 250, 200, 205, 205, 205, 205, 205, 205, 188, 250, 200, 205, 205, 205, 188, 250, 200, 205, 205, 205, 205, 205, 205, 188, 250, 186, 0, 201, 205, 205, 205, 188, 250, 186,
- 186, 250, 250, 250, 250, 250, 186, 0, 186, 250, 250, 250, 250, 250, 250, 250, 250, 250, 250, 250, 250, 250, 250, 250, 250, 250, 250, 250, 250, 250, 250, 250, 250, 250, 186, 0, 186, 250, 250, 250, 250, 250, 186,
- 200, 205, 205, 205, 187, 250, 186 , 0, 186, 250, 201, 205, 187, 250, 201, 205, 205, 205, 205, 205, 205, 205, 205, 205, 205, 205, 205, 205, 187, 250, 201, 205, 187, 250, 186, 0, 186, 250, 201, 205, 205, 205, 188,
- 201, 205, 205, 205, 188, 250, 200, 205, 188, 250, 186, 0, 186, 250, 200, 205, 205, 205, 205, 187, 0, 0, 0, 201, 205, 205, 205, 205, 188, 250, 186, 0, 186, 250, 200, 205, 188, 250, 200, 205, 205, 205, 187,
- 186, 250, 250, 250, 250, 250, 250, 250, 250, 250, 186, 0, 186, 250, 250, 250, 250, 250, 250, 186, 0, 0, 0, 186, 250, 250, 250, 250, 250, 250, 186, 0, 186, 250, 250, 250, 250, 250, 250, 250, 250, 250, 186,
- 186, 250, 201, 205, 205, 205, 205, 205, 205, 205, 188, 0, 200, 205, 205, 205, 205, 187, 250, 186, 0, 0, 0, 186, 250, 201, 205, 205, 205, 205, 188, 0, 200, 205, 205, 205, 205, 205, 205, 205, 187, 250, 186,
- 186, 250, 200, 205, 205, 205, 205, 205, 205, 205, 205, 205, 205, 205, 205, 205, 205, 188, 250, 200, 205, 205, 205, 188, 250, 200, 205, 205, 205, 205, 205, 205, 205, 205, 205, 205, 205, 205, 205, 205, 188, 250, 186,
- 186, 254, 250, 250, 250, 250, 250, 250, 250, 250, 250, 250, 250, 250, 250, 250, 250, 250, 0, 250, 250, 250, 250, 250, 0, 250, 250, 250, 250, 250, 250, 250, 250, 250, 250, 250, 250, 250, 250, 250, 250, 254, 186,
- 200, 205, 205, 205, 205, 205, 205, 205, 205, 205, 205, 205, 205, 205, 205, 205, 205, 205, 205, 205, 205, 205, 205, 205, 205, 205, 205, 205, 205, 205, 205, 205, 205, 205, 205, 205, 205, 205, 205, 205, 205, 205, 188,
- };
- void pontuacao(){ // Contador de pontos
- if (tot > 391){
- zerar(); // zerar as variaveis
- system("cls");
- nv++; // nivel do jogo
- gotoxy(30,15);
- textcolor(10); // Fonte cor VERDE
- printf("NIVEL: %i", nv);
- Sleep(1000);
- tot=0;
- fps=fps-25; // aumentar velocidade
- begin();
- mapa();
- }
- if (cenario[x][y]==250){
- tot=tot+1;
- pts=pts+10; // Pontos pirula pequena
- gotoxy(30+1,1);
- textcolor(10); // Fonte cor VERDE
- printf("%i", pts);
- }
- else if(cenario[x][y]==14){
- tot=tot+1;
- pts=pts+500; // pontos de fruta
- gotoxy(30+1,1);
- textcolor(10); // Fonte cor VERDE
- printf("%i", pts);
- }
- else if(cenario[x][y]==254){
- pts=pts+50; // Pontos pirula grande
- tot=tot+1;
- cm=1; // indica que uma pilula grande foi comida
- cm2=1; // indica que o fantasma vermelho esta no modo assustado
- cm3=1; // indica que o fantasma azul esta no modo assustado
- cm4=1; // indica que o fantasma verde esta no modo assustado
- cm5=1; // indica que o fantasma laranja esta no modo assustado
- pts3=0; // temporizar
- corv=9; // cor do fantasma vermelho recebe nove, indica que o fantasma ficou azul
- cora=9; // cor do fantasma azul recebe nove, indica que o fantasma ficou azul
- corl=9; // cor do fantasma verde recebe nove, indica que o fantasma ficou azul
- corvv=9; // cor do fantasma laranja recebe nove, indica que o fantasma ficou azul
- Beep(2500,4);
- gotoxy(30+1,1);
- textcolor(10); // Fonte cor VERDE
- printf("%i", pts);
- }
- }
- void mapa(){ // funçao para printar o mapa
- int i, j;
- for(i=0;i<32;i++){
- for(j=0;j<43;j++){
- if (cenario[i][j] == 250 || cenario[i][j] <100 || cenario[i][j]==254){
- gotoxy(j+1,i);
- textcolor(14); //COR CARACTER AMARELO
- printf("%c", cenario[i][j]);
- }else{
- gotoxy(j+1,i);
- textcolor(9); //COR CARACTER AZUL
- printf("%c", cenario[i][j]);
- }
- }
- printf("\n");
- }
- }
- void pacman (){ // Imprime na tela Pacman atual
- cenario[x][y] = 2; // Adiciona no vetor a posição do Pacman atual
- gotoxy(y+1,x);
- textcolor(14); // cor caracter amarelo
- printf("%c", 2);
- }
- void ex_pacman (){ // Exclui posição anterior Pacman
- xx=x;
- yy=y;
- gotoxy(yy+1,xx);
- textcolor(14); // cor caracter amarelo
- printf("%c", 0);
- }
- void bip(){ // Som da pirula pequena
- if (cenario[x][y]==250){/*printf("%c", 7)*/;Beep(1200,25);}
- else if(cenario[x][y]==14){Beep(1500,25);}
- }
- int restriesquerda(int a,int b){ // funçao utilizada para que tanto o pacman quanto os fantasmas so percorram as trilhas nos lugares certos
- int t;
- if (a<=32 && cenario[a][b-1] != 201 && cenario[a][b-1] != 200 && cenario[a][b-1] != 187 && cenario[a][b-1] != 188 && cenario[a][b-1] != 205 && cenario[a][b-1] != 186){
- t=1;}
- else
- t=0;
- return(t);
- }
- int restridireita(int a,int b){ // funçao utilizada para que tanto o pacman quanto os fantasmas so percorram as trilhas nos lugares certos
- int t;
- if (a>=0 && cenario[a][b+1] != 201 && cenario[a][b+1] != 200 && cenario[a][b+1] != 187 && cenario[a][b+1] != 188 && cenario[a][b+1] != 205 && cenario[a][b+1] != 186){
- t=1;}
- else
- t=0;
- return(t);
- }
- int restricima(int a,int b){ // funçao utilizada para que tanto o pacman quanto os fantasmas so percorram as trilhas nos lugares certos
- int t;
- if (cenario[a-1][b] != 201 && cenario[a-1][b] != 200 && cenario[a-1][b] != 187 && cenario[a-1][b] != 188 && cenario[a-1][b] != 205 && cenario[a-1][b] != 186){
- t=1;}
- else
- t=0;
- return(t);
- }
- int restribaixo(int a,int b){ // funçao utilizada para que tanto o pacman quanto os fantasmas so percorram as trilhas nos lugares certos
- int t;
- if (cenario[a+1][b] != 201 && cenario[a+1][b] != 200 && cenario[a+1][b] != 187 && cenario[a+1][b] != 188 && cenario[a+1][b] != 205 && cenario[a+1][b] != 186) {
- t=1;}
- else
- t=0;
- return(t);
- }
- int tunelesquerda(int a,int b){ // funçao utilizada que o tunel esquerdo funcione
- int t;
- if(b==0 && a==16){
- t=1;
- }
- else
- t=0;
- return(t);
- }
- int tuneldireita(int a,int b){ // funçao utilizada para que o tunel direito funcione
- int t;
- if(a==16 && b==42){
- t=1;
- }
- else
- t=0;
- return(t);}
- void apagafantasma(int a,int b){ // funçao utilizada para apagar a posiçao anterior do fantasma
- gotoxy(b+1,a);
- textcolor(14);
- printf("%c",cenario[a][b]);
- }
- int teste(int a,int b){ // funçao utilizada para testar a posiçao do pacman em relaçao ao fantasma vermelho
- int t;
- if(x<=a && y<=b)
- t=1;
- else if(x<=a && y>=b)
- t=2;
- else if(x>=a && y<=b)
- t=3;
- else if(x>=a && y>=b)
- t=4;
- return(t);
- }
- int teste2(int a,int b,int c,int d){ // // funçao utilizada para testar a posiçao do pacman em relaçao ao fantasma laranja
- int t;
- if(c<=a && d<=b)
- t=1;
- else if(c<=a && d>=b)
- t=2;
- else if(c>=a && d<=b)
- t=3;
- else if(c>=a && d>=b)
- t=4;
- return(t);
- }
- int aleatorio12(void){ // gera um numero aleatorio ou 1 ou 2
- int t;
- t=(rand()%2)+1;
- return(t);
- }
- int aleatorio13(void){ // gera um numero aleatorio ou 1 ou 3
- int t,xi;
- xi=rand()%2;
- if(xi==0)
- t=1;
- else
- t=3;
- return(t);
- }
- int aleatorio02(void){ // gera um numero aleatorio ou 0 ou 2
- int t,xi;
- xi=rand()%2;
- if(xi==0)
- t=0;
- else
- t=2;
- return(t);
- }
- int aleatorio03(void){ // gera um numero aleatorio ou 0 ou 2
- int t,xi;
- xi=rand()%2;
- if(xi==0)
- t=3;
- else
- t=0;
- return(t);
- }
- void fantasma (){ // funçao para movimentar o fantasma vermelho, é levado em conta a funçao teste e a posiçao anterior do fantasma para evitar que este volte pelo mesmo caminho
- int xi;
- if(cv==1){
- if(restridireita(vx,vy)==1 && restribaixo(vx,vy)==1){
- if(valorv==1){
- if(restricima(vx,vy)==1){
- if(teste(vx,vy)==1)
- valorv=3;
- else if(teste(vx,vy)==2){
- valorv=aleatorio13();
- }
- else if(teste(vx,vy)==3){
- valorv=2;
- }
- else if(teste(vx,vy)==4){
- valorv=aleatorio12();
- }
- }
- else{
- if(teste(vx,vy)==1)
- valorv=aleatorio12();
- else if(teste(vx,vy)==2)
- valorv=1;
- else if(teste(vx,vy)==3)
- valorv=2;
- else if(teste(vx,vy)==4)
- valorv=aleatorio12();
- }
- }
- else if(valorv==2){
- if(restriesquerda(vx,vy)==1){
- if(teste(vx,vy)==1)
- valorv=0;
- else if(teste(vx,vy)==2)
- valorv=1;
- else if(teste(vx,vy)==3)
- valorv=aleatorio02();
- else if(teste(vx,vy)==4)
- valorv=aleatorio12();
- }
- else{
- if(teste(vx,vy)==1)
- valorv=aleatorio12();
- else if(teste(vx,vy)==2)
- valorv=1;
- else if(teste(vx,vy)==3)
- valorv=2;
- else if(teste(vx,vy)==4)
- valorv=aleatorio12();
- }
- }
- else if(valorv==3){
- if(restriesquerda(vx,vy)==0 && restricima(vx,vy)==0){
- valorv=1;
- }
- else if(restriesquerda(vx,vy)==0 && restricima(vx,vy)==1){
- if(teste(vx,vy)==1)
- valorv=3;
- else if(teste(vx,vy)==2)
- valorv=aleatorio13();
- else if(teste(vx,vy)==3)
- valorv=aleatorio13();
- else if(teste(vx,vy)==4)
- valorv=1;
- }
- else if(restriesquerda(vx,vy)==1 && restricima(vx,vy)==0){
- if(teste(vx,vy)==1)
- valorv=0;
- else if(teste(vx,vy)==2)
- valorv=1;
- else if(teste(vx,vy)==3)
- valorv=0;
- else if(teste(vx,vy)==4)
- valorv=1;
- }
- else if(restriesquerda(vx,vy)==1 && restricima(vx,vy)==1){
- if(teste(vx,vy)==1)
- valorv=aleatorio03();
- else if(teste(vx,vy)==2)
- valorv=aleatorio13();
- else if(teste(vx,vy)==3)
- valorv=0;
- else if(teste(vx,vy)==4)
- valorv=1;
- }
- }
- else if(valorv==0){
- if(restriesquerda(vx,vy)==0 && restricima(vx,vy)==0){
- valorv=2;
- }
- else if(restriesquerda(vx,vy)==0 && restricima(vx,vy)==1){
- if(teste(vx,vy)==1)
- valorv=3;
- else if(teste(vx,vy)==2)
- valorv=3;
- else if(teste(vx,vy)==3)
- valorv=2;
- else if(teste(vx,vy)==4)
- valorv=2;
- }
- else if(restriesquerda(vx,vy)==1 && restricima(vx,vy)==0){
- if(teste(vx,vy)==1)
- valorv=0;
- else if(teste(vx,vy)==2)
- valorv=aleatorio02();
- else if(teste(vx,vy)==3)
- valorv=aleatorio02();
- else if(teste(vx,vy)==4)
- valorv=2;
- }
- else if(restriesquerda(vx,vy)==1 && restricima(vx,vy)==1){
- if(teste(vx,vy)==1)
- valorv=aleatorio03();
- else if(teste(vx,vy)==2)
- valorv=3;
- else if(teste(vx,vy)==3)
- valorv=aleatorio02();
- else if(teste(vx,vy)==4)
- valorv=2;
- }
- }
- }
- else if(restriesquerda(vx,vy)==1 && restribaixo(vx,vy)==1){
- if(valorv==1){
- if(restridireita(vx,vy)==0 && restricima(vx,vy)==0){
- valorv=2;
- }
- else if(restridireita(vx,vy)==0 && restricima(vx,vy)==1){
- if(teste(vx,vy)==1)
- valorv=3;
- else if(teste(vx,vy)==2)
- valorv=3;
- else if(teste(vx,vy)==3)
- valorv=2;
- else if(teste(vx,vy)==4)
- valorv=2;
- }
- else if(restridireita(vx,vy)==1 && restricima(vx,vy)==0){
- if(teste(vx,vy)==1)
- valorv=aleatorio12();
- else if(teste(vx,vy)==2)
- valorv=1;
- else if(teste(vx,vy)==3)
- valorv=2;
- else if(teste(vx,vy)==4)
- valorv=aleatorio12();
- }
- else if(restridireita(vx,vy)==1 && restricima(vx,vy)==1){
- if(teste(vx,vy)==1)
- valorv=3;
- else if(teste(vx,vy)==2)
- valorv=aleatorio13();
- else if(teste(vx,vy)==3)
- valorv=2;
- else if(teste(vx,vy)==4)
- valorv=aleatorio12();
- }
- }
- else if(valorv==2){
- if(restridireita(vx,vy)==1){
- if(teste(vx,vy)==1)
- valorv=0;
- else if(teste(vx,vy)==2)
- valorv=1;
- else if(teste(vx,vy)==3)
- valorv=aleatorio02();
- else if(teste(vx,vy)==4)
- valorv=aleatorio12();
- }
- else{
- if(teste(vx,vy)==1)
- valorv=0;
- else if(teste(vx,vy)==2)
- valorv=aleatorio02();
- else if(teste(vx,vy)==3)
- valorv=aleatorio02();
- else if(teste(vx,vy)==4)
- valorv=2;
- }
- }
- else if(valorv==3){
- if(restridireita(vx,vy)==0 && restricima(vx,vy)==0){
- valorv=0;
- }
- else if(restridireita(vx,vy)==0 && restricima(vx,vy)==1){
- if(teste(vx,vy)==1)
- valorv=aleatorio03();
- else if(teste(vx,vy)==2)
- valorv=3;
- else if(teste(vx,vy)==3)
- valorv=0;
- else if(teste(vx,vy)==4)
- valorv=aleatorio03();
- }
- else if(restridireita(vx,vy)==1 && restricima(vx,vy)==0){
- if(teste(vx,vy)==1)
- valorv=0;
- else if(teste(vx,vy)==2)
- valorv=1;
- else if(teste(vx,vy)==3)
- valorv=0;
- else if(teste(vx,vy)==4)
- valorv=1;
- }
- else if(restridireita(vx,vy)==1 && restricima(vx,vy)==1){
- if(teste(vx,vy)==1)
- valorv=aleatorio03();
- else if(teste(vx,vy)==2)
- valorv=aleatorio13();
- else if(teste(vx,vy)==3)
- valorv=0;
- else if(teste(vx,vy)==4)
- valorv=1;
- }
- }
- else if(valorv==0){
- if(restricima(vx,vy)==1){
- if(teste(vx,vy)==1)
- valorv=aleatorio03();
- else if(teste(vx,vy)==2)
- valorv=3;
- else if(teste(vx,vy)==3)
- valorv=aleatorio02();
- else if(teste(vx,vy)==4)
- valorv=2;
- }
- else if(restricima(vx,vy)==0){
- if(teste(vx,vy)==1)
- valorv=0;
- else if(teste(vx,vy)==2)
- valorv=aleatorio02();
- else if(teste(vx,vy)==3)
- valorv=aleatorio02();
- else if(teste(vx,vy)==4)
- valorv=2;
- }
- }
- }
- else if(restricima(vx,vy)==1 && restriesquerda(vx,vy)==1){
- if(valorv==1){
- if(restridireita(vx,vy)==0 && restribaixo(vx,vy)==0){
- valorv=3;
- }
- else if(restridireita(vx,vy)==0 && restribaixo(vx,vy)==1){
- if(teste(vx,vy)==1)
- valorv=3;
- else if(teste(vx,vy)==2)
- valorv=3;
- else if(teste(vx,vy)==3)
- valorv=2;
- else if(teste(vx,vy)==4)
- valorv=2;
- }
- else if(restridireita(vx,vy)==1 && restribaixo(vx,vy)==0){
- if(teste(vx,vy)==1)
- valorv=3;
- else if(teste(vx,vy)==2)
- valorv=aleatorio13();
- else if(teste(vx,vy)==3)
- valorv=aleatorio13();
- else if(teste(vx,vy)==4)
- valorv=1;
- }
- else if(restridireita(vx,vy)==1 && restribaixo(vx,vy)==1){
- if(teste(vx,vy)==1)
- valorv=3;
- else if(teste(vx,vy)==2)
- valorv=aleatorio13();
- else if(teste(vx,vy)==3)
- valorv=2;
- else if(teste(vx,vy)==4)
- valorv=aleatorio12();
- }}
- else if(valorv==2){
- if(restridireita(vx,vy)==0 && restribaixo(vx,vy)==0){
- valorv=0;
- }
- else if(restridireita(vx,vy)==0 && restribaixo(vx,vy)==1){
- if(teste(vx,vy)==1)
- valorv=0;
- else if(teste(vx,vy)==2)
- valorv=aleatorio02();
- else if(teste(vx,vy)==3)
- valorv=aleatorio02();
- else if(teste(vx,vy)==4)
- valorv=2;
- }
- else if(restridireita(vx,vy)==1 && restribaixo(vx,vy)==0){
- if(teste(vx,vy)==1)
- valorv=0;
- else if(teste(vx,vy)==2)
- valorv=1;
- else if(teste(vx,vy)==3)
- valorv=0;
- else if(teste(vx,vy)==4)
- valorv=1;
- }
- else if(restridireita(vx,vy)==1 && restribaixo(vx,vy)==1){
- if(teste(vx,vy)==1)
- valorv=0;
- else if(teste(vx,vy)==2)
- valorv=1;
- else if(teste(vx,vy)==3)
- valorv=aleatorio02();
- else if(teste(vx,vy)==4)
- valorv=aleatorio12();
- }
- }
- else if(valorv==3){
- if(restridireita(vx,vy)==1){
- if(teste(vx,vy)==1)
- valorv=aleatorio03();
- else if(teste(vx,vy)==2)
- valorv=aleatorio13();
- else if(teste(vx,vy)==3)
- valorv=0;
- else if(teste(vx,vy)==4)
- valorv=1;
- }
- else {
- if(teste(vx,vy)==1)
- valorv=aleatorio03();
- else if(teste(vx,vy)==2)
- valorv=3;
- else if(teste(vx,vy)==3)
- valorv=0;
- else if(teste(vx,vy)==4)
- valorv=aleatorio03();
- }
- }
- else if(valorv==0){
- if(restribaixo(vx,vy)==1){
- if(teste(vx,vy)==1)
- valorv=aleatorio03();
- else if(teste(vx,vy)==2)
- valorv=3;
- else if(teste(vx,vy)==3)
- valorv=aleatorio02();
- else if(teste(vx,vy)==4)
- valorv=2;
- }
- else {
- if(teste(vx,vy)==1)
- valorv=aleatorio03();
- else if(teste(vx,vy)==2)
- valorv=3;
- else if(teste(vx,vy)==3)
- valorv=0;
- else if(teste(vx,vy)==4)
- valorv=aleatorio03();
- }
- }
- }
- else if(restricima(vx,vy)==1 && restridireita(vx,vy)==1){
- if(valorv==1){
- if(restribaixo(vx,vy)==1){
- if(teste(vx,vy)==1)
- valorv=3;
- else if(teste(vx,vy)==2)
- valorv=aleatorio13();
- else if(teste(vx,vy)==3)
- valorv=2;
- else if(teste(vx,vy)==4)
- valorv=aleatorio12();
- }
- else {
- if(teste(vx,vy)==1)
- valorv=3;
- else if(teste(vx,vy)==2)
- valorv=aleatorio13();
- else if(teste(vx,vy)==3)
- valorv=aleatorio13();
- else if(teste(vx,vy)==4)
- valorv=1;
- }
- }
- else if(valorv==2){
- if(restriesquerda(vx,vy)==0 && restribaixo(vx,vy)==0){
- valorv=1;
- }
- else if(restriesquerda(vx,vy)==0 && restribaixo(vx,vy)==1){
- if(teste(vx,vy)==1)
- valorv=aleatorio12();
- else if(teste(vx,vy)==2)
- valorv=1;
- else if(teste(vx,vy)==3)
- valorv=2;
- else if(teste(vx,vy)==4)
- valorv=aleatorio12();
- }
- else if(restriesquerda(vx,vy)==1 && restribaixo(vx,vy)==0){
- if(teste(vx,vy)==1)
- valorv=0;
- else if(teste(vx,vy)==2)
- valorv=1;
- else if(teste(vx,vy)==3)
- valorv=0;
- else if(teste(vx,vy)==4)
- valorv=1;
- }
- else if(restriesquerda(vx,vy)==1 && restribaixo(vx,vy)==1){
- if(teste(vx,vy)==1)
- valorv=0;
- else if(teste(vx,vy)==2)
- valorv=1;
- else if(teste(vx,vy)==3)
- valorv=aleatorio02();
- else if(teste(vx,vy)==4)
- valorv=aleatorio12();
- }
- }
- else if(valorv==3){
- if(restriesquerda(vx,vy)==1){
- if(teste(vx,vy)==1)
- valorv=aleatorio03();
- else if(teste(vx,vy)==2)
- valorv=aleatorio13();
- else if(teste(vx,vy)==3)
- valorv=0;
- else if(teste(vx,vy)==4)
- valorv=1;
- }
- else{
- if(teste(vx,vy)==1)
- valorv=3;
- else if(teste(vx,vy)==2)
- valorv=aleatorio13();
- else if(teste(vx,vy)==3)
- valorv=aleatorio13();
- else if(teste(vx,vy)==4)
- valorv=1;
- }
- }
- else if(valorv==0){
- if(restriesquerda(vx,vy)==0 && restribaixo(vx,vy)==0){
- valorv=3;
- }
- else if(restriesquerda(vx,vy)==0 && restribaixo(vx,vy)==1){
- if(teste(vx,vy)==1)
- valorv=3;
- else if(teste(vx,vy)==2)
- valorv=3;
- else if(teste(vx,vy)==3)
- valorv=2;
- else if(teste(vx,vy)==4)
- valorv=2;
- }
- else if(restriesquerda(vx,vy)==1 && restribaixo(vx,vy)==0){
- if(teste(vx,vy)==1)
- valorv=aleatorio03();
- else if(teste(vx,vy)==2)
- valorv=3;
- else if(teste(vx,vy)==3)
- valorv=0;
- else if(teste(vx,vy)==4)
- valorv=aleatorio03();
- }
- else if(restriesquerda(vx,vy)==1 && restribaixo(vx,vy)==1){
- if(teste(vx,vy)==1)
- valorv=aleatorio03();
- else if(teste(vx,vy)==2)
- valorv=3;
- else if(teste(vx,vy)==3)
- valorv=aleatorio02();
- else if(teste(vx,vy)==4)
- valorv=2;
- }
- }
- }
- }
- else if(cv==0){
- valorv=1;
- valorv2=1;
- cv=1;
- }
- switch(valorv){
- case 0:
- if(tunelesquerda(vx,vy)==1){apagafantasma(vx,vy);vy=42;vx=16;} // CONDIÇÃO PARA QUE O "TUNEL" DO MAPA FUNCIONE
- if(restriesquerda(vx,vy)==1){
- apagafantasma(vx,vy);
- vy--;
- }
- break;
- case 1:
- if (tuneldireita(vx,vy)==1){apagafantasma(vx,vy);vy=0;vx=16;}// CONDIÇÃO PARA QUE O "TUNEL" DO MAPA FUNCIONE
- if(restridireita(vx,vy)==1){
- apagafantasma(vx,vy);
- vy++;
- }
- break;
- case 2:
- if(restribaixo(vx,vy)==1){
- apagafantasma(vx,vy);
- vx++;
- }
- break;
- case 3:
- if(restricima(vx,vy)==1){
- apagafantasma(vx,vy);
- vx--;
- }
- break;}
- gotoxy(vy+1,vx);
- textcolor(corv);
- printf("%c", tipv);
- }
- void fantasmaazul (int a){ // movimentar o fantasma azul, gera um valor aleatorio a cada intersecçao, este indica uma direçao (esquerda 0, direita 1, baixo 2, cima 3)
- int xii,in;
- if(ca==2){
- cenario[15][21]=205;
- if(restridireita(ax,ay)==1 && restribaixo(ax,ay)==1){
- if(valora==1){
- if(restricima(ax,ay)==1){
- valora=(rand()%3)+1;
- }
- else{
- valora=(rand()%2)+1;
- }
- }
- else if(valora==2){
- if(restriesquerda(ax,ay)==1){
- valora=rand()%3;
- }
- else
- valora=(rand()%2)+1;
- }
- else if(valora==3){
- if(restriesquerda(ax,ay)==0 && restricima(ax,ay)==0){
- valora=1;
- }
- else if(restriesquerda(ax,ay)==0 && restricima(ax,ay)==1){
- xii=rand()%2;
- if(xii%2==0)
- valora=1;
- else
- valora=3;
- }
- else if(restriesquerda(ax,ay)==1 && restricima(ax,ay)==0){
- valora=rand()%2;
- }
- else if(restriesquerda(ax,ay)==1 && restricima(ax,ay)==1){
- xii=rand()%3;
- if(xii==0)
- valora=0;
- else if(xii==1)
- valora=1;
- else
- valora=3;
- }
- }
- else if(valora==0){
- if(restriesquerda(ax,ay)==0 && restricima(ax,ay)==0){
- valora=2;
- }
- else if(restriesquerda(ax,ay)==0 && restricima(ax,ay)==1){
- valora=(rand()%2)+2;
- }
- else if(restriesquerda(ax,ay)==1 && restricima(ax,ay)==0){
- xii=rand()%2;
- if(xii%2==0)
- valora=0;
- else
- valora=2;
- }
- else if(restriesquerda(ax,ay)==1 && restricima(ax,ay)==1){
- xii=rand()%3;
- if(xii==0)
- valora=0;
- else if(xii==1)
- valora=2;
- else
- valora=3;
- }
- }
- }
- else if(restriesquerda(ax,ay)==1 && restribaixo(ax,ay)==1){
- if(valora==1){
- if(restridireita(ax,ay)==0 && restricima(ax,ay)==0){
- valora=2;
- }
- else if(restridireita(ax,ay)==0 && restricima(ax,ay)==1){
- valora=(rand()%2)+2;
- }
- else if(restridireita(ax,ay)==1 && restricima(ax,ay)==0){
- valora=(rand()%2)+1;
- }
- else if(restridireita(ax,ay)==1 && restricima(ax,ay)==1){
- valora=(rand()%3)+1;
- }
- }
- else if(valora==2){
- if(restridireita(ax,ay)==1){
- valora=rand()%3;
- }
- else{
- xii=rand()%2;
- if(xii%2==0){
- valora=0;
- }
- else
- valora=2;
- }
- }
- else if(valora==3){
- if(restridireita(ax,ay)==0 && restricima(ax,ay)==0){
- valora=0;
- }
- else if(restridireita(ax,ay)==0 && restricima(ax,ay)==1){
- xii=rand()%2;
- if(xii%2==0){
- valora=0;
- }
- else
- valora=3;
- }
- else if(restridireita(ax,ay)==1 && restricima(ax,ay)==0){
- valora=rand()%2;
- }
- else if(restridireita(ax,ay)==1 && restricima(ax,ay)==1){
- xii=rand()%3;
- if(xii==0){
- valora=0;
- }
- else if(xii==1){
- valora=1;
- }
- else
- valora=3;
- }
- }
- else if(valora==0){
- if(restricima(ax,ay)==1){
- xii=rand()%3;
- if(xii==0){
- valora=0;
- }
- else if(xii==1){
- valora=2;
- }
- else
- valora=3;
- }
- else if(restricima(ax,ay)==0){
- xii=rand()%2;
- if(xii%2==0){
- valora=0;
- }
- else
- valora=2;
- }
- }
- }
- else if(restricima(ax,ay)==1 && restriesquerda(ax,ay)==1){
- if(valora==1){
- if(restridireita(ax,ay)==0 && restribaixo(ax,ay)==0){
- valora=3;
- }
- else if(restridireita(ax,ay)==0 && restribaixo(ax,ay)==1){
- valora=(rand()%2)+2;
- }
- else if(restridireita(ax,ay)==1 && restribaixo(ax,ay)==0){
- xii=rand()%2;
- if(xii%2==0){
- valora=1;
- }
- else
- valora=3;
- }
- else if(restridireita(ax,ay)==1 && restribaixo(ax,ay)==1){
- valora=(rand()%3)+1;
- }}
- else if(valora==2){
- if(restridireita(ax,ay)==0 && restribaixo(ax,ay)==0){
- valora=0;
- }
- else if(restridireita(ax,ay)==0 && restribaixo(ax,ay)==1){
- xii=rand()%2;
- if(xii%2==0){
- valora=0;
- }
- else
- valora=2;
- }
- else if(restridireita(ax,ay)==1 && restribaixo(ax,ay)==0){
- valora=rand()%2;
- }
- else if(restridireita(ax,ay)==1 && restribaixo(ax,ay)==1){
- valora=rand()%3;
- }
- }
- else if(valora==3){
- if(restridireita(ax,ay)==1){
- xii=rand()%3;
- if(xii==0)
- valora=0;
- else if(xii==1)
- valora=1;
- else
- valora=3;
- }
- else {
- xii=rand()%2;
- if(xii%2==0){
- valora=0;
- }
- else
- valora=3;
- }
- }
- else if(valora==0){
- if(restribaixo(ax,ay)==1){
- xii=rand()%3;
- if(xii==0)
- valora=0;
- else if(xii==1)
- valora=2;
- else
- valora=3;
- }
- else {
- xii=rand()%2;
- if(xii%2==0){
- valora=0;
- }
- else
- valora=3;
- }
- }
- }
- else if(restricima(ax,ay)==1 && restridireita(ax,ay)==1){
- if(valora==1){
- if(restribaixo(ax,ay)==1){
- valora=(rand()%3)+1;
- }
- else {
- xii=rand()%2;
- if(xii==0)
- valora=1;
- else
- valora=3;
- }
- }
- else if(valora==2){
- if(restriesquerda(ax,ay)==0 && restribaixo(ax,ay)==0){
- valora=1;
- }
- else if(restriesquerda(ax,ay)==0 && restribaixo(ax,ay)==1){
- valora=(rand()%2)+1;
- }
- else if(restriesquerda(ax,ay)==1 && restribaixo(ax,ay)==0){
- valora=rand()%2;
- }
- else if(restriesquerda(ax,ay)==1 && restribaixo(ax,ay)==1){
- valora=rand()%3;
- }
- }
- else if(valora==3){
- if(restriesquerda(ax,ay)==1){
- xii=rand()%3;
- if(xii==0)
- valora=0;
- else if(xii==1)
- valora=1;
- else
- valora=3;
- }
- else{
- xii=rand()%2;
- if(xii==0)
- valora=1;
- else
- valora=3;
- }
- }
- else if(valora==0){
- if(restriesquerda(ax,ay)==0 && restribaixo(ax,ay)==0){
- valora=3;
- }
- else if(restriesquerda(ax,ay)==0 && restribaixo(ax,ay)==1){
- valora=(rand()%2)+2;
- }
- else if(restriesquerda(ax,ay)==1 && restribaixo(ax,ay)==0){
- xii=rand()%2;
- if(xii==0)
- valora=0;
- else
- valora=3;
- }
- else if(restriesquerda(ax,ay)==1 && restribaixo(ax,ay)==1){
- xii=rand()%3;
- if(xii==0)
- valora=0;
- else if(xii==1)
- valora=2;
- else
- valora=3;
- }
- }
- }
- }
- if(ca==0 && pts2==20){
- cenario[15][21]=0;
- valora=3;
- ca=1;
- }
- else if(ca==1 && pts2>30)
- {
- valora=0;
- ca=2;
- }
- switch(valora){
- case 0:
- if(tunelesquerda(ax,ay)==1){apagafantasma(ax,ay);ay=42;ax=16;} // CONDIÇÃO PARA QUE O "TUNEL" DO MAPA FUNCIONE
- if(restriesquerda(ax,ay)==1){
- apagafantasma(ax,ay);
- ay--;
- }
- break;
- case 1:
- if (tuneldireita(ax,ay)==1){apagafantasma(ax,ay);ay=0;ax=16;}// CONDIÇÃO PARA QUE O "TUNEL" DO MAPA FUNCIONE
- if(restridireita(ax,ay)==1){
- apagafantasma(ax,ay);
- ay++;
- }
- break;
- case 2:
- if(restribaixo(ax,ay)==1){
- apagafantasma(ax,ay);
- ax++;
- }
- break;
- case 3:
- if(restricima(ax,ay)==1){
- apagafantasma(ax,ay);
- ax--;
- }
- break;}
- gotoxy(ay+1,ax);
- textcolor(cora);
- printf("%c", tipa);
- }
- void fantasmaverde (int a){ // movimentar o fantasma verde, gera um valor aleatorio a cada intersecçao, este indica uma direçao (esquerda 0, direita 1, baixo 2, cima 3), leva em conta a posiçao anterior para que o fantasma nao volte pelo mesmo caminho
- int xii,in;
- if(cl==3){
- cenario[15][21]=205;
- if(restridireita(lx,ly)==1 && restribaixo(lx,ly)==1){
- if(valorl==1){
- if(restricima(lx,ly)==1){
- valorl=(rand()%3)+1;
- }
- else{
- valorl=(rand()%2)+1;
- }
- }
- else if(valorl==2){
- if(restriesquerda(lx,ly)==1){
- valorl=rand()%3;
- }
- else
- valorl=(rand()%2)+1;
- }
- else if(valorl==3){
- if(restriesquerda(lx,ly)==0 && restricima(lx,ly)==0){
- valorl=1;
- }
- else if(restriesquerda(lx,ly)==0 && restricima(lx,ly)==1){
- xii=rand()%2;
- if(xii%2==0)
- valorl=1;
- else
- valorl=3;
- }
- else if(restriesquerda(lx,ly)==1 && restricima(lx,ly)==0){
- valorl=rand()%2;
- }
- else if(restriesquerda(lx,ly)==1 && restricima(lx,ly)==1){
- xii=rand()%3;
- if(xii==0)
- valorl=0;
- else if(xii==1)
- valorl=1;
- else
- valorl=3;
- }
- }
- else if(valorl==0){
- if(restriesquerda(lx,ly)==0 && restricima(lx,ly)==0){
- valorl=2;
- }
- else if(restriesquerda(lx,ly)==0 && restricima(lx,ly)==1){
- valorl=(rand()%2)+2;
- }
- else if(restriesquerda(lx,ly)==1 && restricima(lx,ly)==0){
- xii=rand()%2;
- if(xii%2==0)
- valorl=0;
- else
- valorl=2;
- }
- else if(restriesquerda(lx,ly)==1 && restricima(lx,ly)==1){
- xii=rand()%3;
- if(xii==0)
- valorl=0;
- else if(xii==1)
- valorl=2;
- else
- valorl=3;
- }
- }
- }
- else if(restriesquerda(lx,ly)==1 && restribaixo(lx,ly)==1){
- if(valorl==1){
- if(restridireita(lx,ly)==0 && restricima(lx,ly)==0){
- valorl=2;
- }
- else if(restridireita(lx,ly)==0 && restricima(lx,ly)==1){
- valorl=(rand()%2)+2;
- }
- else if(restridireita(lx,ly)==1 && restricima(lx,ly)==0){
- valorl=(rand()%2)+1;
- }
- else if(restridireita(lx,ly)==1 && restricima(lx,ly)==1){
- valorl=(rand()%3)+1;
- }
- }
- else if(valorl==2){
- if(restridireita(lx,ly)==1){
- valorl=rand()%3;
- }
- else{
- xii=rand()%2;
- if(xii%2==0){
- valorl=0;
- }
- else
- valorl=2;
- }
- }
- else if(valorl==3){
- if(restridireita(lx,ly)==0 && restricima(lx,ly)==0){
- valorl=0;
- }
- else if(restridireita(lx,ly)==0 && restricima(lx,ly)==1){
- xii=rand()%2;
- if(xii%2==0){
- valorl=0;
- }
- else
- valorl=3;
- }
- else if(restridireita(lx,ly)==1 && restricima(lx,ly)==0){
- valorl=rand()%2;
- }
- else if(restridireita(lx,ly)==1 && restricima(lx,ly)==1){
- xii=rand()%3;
- if(xii==0){
- valorl=0;
- }
- else if(xii==1){
- valorl=1;
- }
- else
- valorl=3;
- }
- }
- else if(valorl==0){
- if(restricima(lx,ly)==1){
- xii=rand()%3;
- if(xii==0){
- valorl=0;
- }
- else if(xii==1){
- valorl=2;
- }
- else
- valorl=3;
- }
- else if(restricima(lx,ly)==0){
- xii=rand()%2;
- if(xii%2==0){
- valorl=0;
- }
- else
- valorl=2;
- }
- }
- }
- else if(restricima(lx,ly)==1 && restriesquerda(lx,ly)==1){
- if(valorl==1){
- if(restridireita(lx,ly)==0 && restribaixo(lx,ly)==0){
- valorl=3;
- }
- else if(restridireita(lx,ly)==0 && restribaixo(lx,ly)==1){
- valorl=(rand()%2)+2;
- }
- else if(restridireita(lx,ly)==1 && restribaixo(lx,ly)==0){
- xii=rand()%2;
- if(xii%2==0){
- valorl=1;
- }
- else
- valorl=3;
- }
- else if(restridireita(lx,ly)==1 && restribaixo(lx,ly)==1){
- valorl=(rand()%3)+1;
- }}
- else if(valorl==2){
- if(restridireita(lx,ly)==0 && restribaixo(lx,ly)==0){
- valorl=0;
- }
- else if(restridireita(lx,ly)==0 && restribaixo(lx,ly)==1){
- xii=rand()%2;
- if(xii%2==0){
- valorl=0;
- }
- else
- valorl=2;
- }
- else if(restridireita(lx,ly)==1 && restribaixo(lx,ly)==0){
- valorl=rand()%2;
- }
- else if(restridireita(lx,ly)==1 && restribaixo(lx,ly)==1){
- valorl=rand()%3;
- }
- }
- else if(valorl==3){
- if(restridireita(lx,ly)==1){
- xii=rand()%3;
- if(xii==0)
- valorl=0;
- else if(xii==1)
- valorl=1;
- else
- valorl=3;
- }
- else {
- xii=rand()%2;
- if(xii%2==0){
- valorl=0;
- }
- else
- valorl=3;
- }
- }
- else if(valorl==0){
- if(restribaixo(lx,ly)==1){
- xii=rand()%3;
- if(xii==0)
- valorl=0;
- else if(xii==1)
- valorl=2;
- else
- valorl=3;
- }
- else {
- xii=rand()%2;
- if(xii%2==0){
- valorl=0;
- }
- else
- valorl=3;
- }
- }
- }
- else if(restricima(lx,ly)==1 && restridireita(lx,ly)==1){
- if(valorl==1){
- if(restribaixo(lx,ly)==1){
- valorl=(rand()%3)+1;
- }
- else {
- xii=rand()%2;
- if(xii==0)
- valorl=1;
- else
- valorl=3;
- }
- }
- else if(valorl==2){
- if(restriesquerda(lx,ly)==0 && restribaixo(lx,ly)==0){
- valorl=1;
- }
- else if(restriesquerda(lx,ly)==0 && restribaixo(lx,ly)==1){
- valorl=(rand()%2)+1;
- }
- else if(restriesquerda(lx,ly)==1 && restribaixo(lx,ly)==0){
- valorl=rand()%2;
- }
- else if(restriesquerda(lx,ly)==1 && restribaixo(lx,ly)==1){
- valorl=rand()%3;
- }
- }
- else if(valorl==3){
- if(restriesquerda(lx,ly)==1){
- xii=rand()%3;
- if(xii==0)
- valorl=0;
- else if(xii==1)
- valorl=1;
- else
- valorl=3;
- }
- else{
- xii=rand()%2;
- if(xii==0)
- valorl=1;
- else
- valorl=3;
- }
- }
- else if(valorl==0){
- if(restriesquerda(lx,ly)==0 && restribaixo(lx,ly)==0){
- valorl=3;
- }
- else if(restriesquerda(lx,ly)==0 && restribaixo(lx,ly)==1){
- valorl=(rand()%2)+2;
- }
- else if(restriesquerda(lx,ly)==1 && restribaixo(lx,ly)==0){
- xii=rand()%2;
- if(xii==0)
- valorl=0;
- else
- valorl=3;
- }
- else if(restriesquerda(lx,ly)==1 && restribaixo(lx,ly)==1){
- xii=rand()%3;
- if(xii==0)
- valorl=0;
- else if(xii==1)
- valorl=2;
- else
- valorl=3;
- }
- }
- }
- }
- if(cl==0 && pts2==150){
- valorl=1;
- cl=1;
- }
- else if(cl==1 && pts2>160)
- {
- cenario[15][21]=0;
- valorl=3;
- cl=2;
- }
- else if(cl==2 && pts2>180)
- {
- valorl=1;
- cl=3;
- }
- switch(valorl){
- case 0:
- if(tunelesquerda(lx,ly)==1){apagafantasma(lx,ly);ly=42;lx=16;} // CONDIÇÃO PARA QUE O "TUNEL" DO MAPA FUNCIONE
- if(restriesquerda(lx,ly)==1){
- apagafantasma(lx,ly);
- ly--;
- }
- break;
- case 1:
- if (tuneldireita(lx,ly)==1){apagafantasma(lx,ly);ly=0;lx=16;}// CONDIÇÃO PARA QUE O "TUNEL" DO MAPA FUNCIONE
- if(restridireita(lx,ly)==1){
- apagafantasma(lx,ly);
- ly++;
- }
- break;
- case 2:
- if(restribaixo(lx,ly)==1){
- apagafantasma(lx,ly);
- lx++;
- }
- break;
- case 3:
- if(restricima(lx,ly)==1){
- apagafantasma(lx,ly);
- lx--;
- }
- break;}
- gotoxy(ly+1,lx);
- textcolor(corl);
- printf("%c", tipl);
- }
- void fantasmalaranja() // funçao utilizada para movimentar o fantasma laranja, leva em conta a funçao teste2 e a posiçao anterior do fantasma
- {
- int xi;
- if(cvv==3){
- destinovermelhox=x;
- destinovermelhoy=y;
- if(restridireita(vvx,vvy)==1 && restribaixo(vvx,vvy)==1){
- if(valorvv==1){
- if(restricima(vvx,vvy)==1){
- if(teste2(vvx,vvy,destinovermelhox,destinovermelhoy)==1)
- valorvv=3;
- else if(teste2(vvx,vvy,destinovermelhox,destinovermelhoy)==2){
- valorvv=aleatorio13();
- }
- else if(teste2(vvx,vvy,destinovermelhox,destinovermelhoy)==3){
- valorvv=2;
- }
- else if(teste2(vvx,vvy,destinovermelhox,destinovermelhoy)==4){
- valorvv=aleatorio12();
- }
- }
- else{
- if(teste2(vvx,vvy,destinovermelhox,destinovermelhoy)==1)
- valorvv=aleatorio12();
- else if(teste2(vvx,vvy,destinovermelhox,destinovermelhoy)==2)
- valorvv=1;
- else if(teste2(vvx,vvy,destinovermelhox,destinovermelhoy)==3)
- valorvv=2;
- else if(teste2(vvx,vvy,destinovermelhox,destinovermelhoy)==4)
- valorvv=aleatorio12();
- }
- }
- else if(valorvv==2){
- if(restriesquerda(vvx,vvy)==1){
- if(teste2(vvx,vvy,destinovermelhox,destinovermelhoy)==1)
- valorvv=0;
- else if(teste2(vvx,vvy,destinovermelhox,destinovermelhoy)==2)
- valorvv=1;
- else if(teste2(vvx,vvy,destinovermelhox,destinovermelhoy)==3)
- valorvv=aleatorio02();
- else if(teste2(vvx,vvy,destinovermelhox,destinovermelhoy)==4)
- valorvv=aleatorio12();
- }
- else{
- if(teste2(vvx,vvy,destinovermelhox,destinovermelhoy)==1)
- valorvv=aleatorio12();
- else if(teste2(vvx,vvy,destinovermelhox,destinovermelhoy)==2)
- valorvv=1;
- else if(teste2(vvx,vvy,destinovermelhox,destinovermelhoy)==3)
- valorvv=2;
- else if(teste2(vvx,vvy,destinovermelhox,destinovermelhoy)==4)
- valorvv=aleatorio12();
- }
- }
- else if(valorvv==3){
- if(restriesquerda(vvx,vvy)==0 && restricima(vvx,vvy)==0){
- valorvv=1;
- }
- else if(restriesquerda(vvx,vvy)==0 && restricima(vvx,vvy)==1){
- if(teste2(vvx,vvy,destinovermelhox,destinovermelhoy)==1)
- valorvv=3;
- else if(teste2(vvx,vvy,destinovermelhox,destinovermelhoy)==2)
- valorvv=aleatorio13();
- else if(teste2(vvx,vvy,destinovermelhox,destinovermelhoy)==3)
- valorvv=aleatorio13();
- else if(teste2(vvx,vvy,destinovermelhox,destinovermelhoy)==4)
- valorvv=1;
- }
- else if(restriesquerda(vvx,vvy)==1 && restricima(vvx,vvy)==0){
- if(teste2(vvx,vvy,destinovermelhox,destinovermelhoy)==1)
- valorvv=0;
- else if(teste2(vvx,vvy,destinovermelhox,destinovermelhoy)==2)
- valorvv=1;
- else if(teste2(vx,vy,destinovermelhox,destinovermelhoy)==3)
- valorvv=0;
- else if(teste2(vvx,vvy,destinovermelhox,destinovermelhoy)==4)
- valorvv=1;
- }
- else if(restriesquerda(vvx,vvy)==1 && restricima(vvx,vvy)==1){
- if(teste2(vvx,vvy,destinovermelhox,destinovermelhoy)==1)
- valorvv=aleatorio03();
- else if(teste2(vvx,vvy,destinovermelhox,destinovermelhoy)==2)
- valorvv=aleatorio13();
- else if(teste2(vvx,vvy,destinovermelhox,destinovermelhoy)==3)
- valorvv=0;
- else if(teste2(vvx,vvy,destinovermelhox,destinovermelhoy)==4)
- valorvv=1;
- }
- }
- else if(valorvv==0){
- if(restriesquerda(vvx,vvy)==0 && restricima(vvx,vvy)==0){
- valorvv=2;
- }
- else if(restriesquerda(vvx,vvy)==0 && restricima(vvx,vvy)==1){
- if(teste2(vvx,vvy,destinovermelhox,destinovermelhoy)==1)
- valorvv=3;
- else if(teste2(vvx,vvy,destinovermelhox,destinovermelhoy)==2)
- valorvv=3;
- else if(teste2(vvx,vvy,destinovermelhox,destinovermelhoy)==3)
- valorvv=2;
- else if(teste2(vvx,vvy,destinovermelhox,destinovermelhoy)==4)
- valorvv=2;
- }
- else if(restriesquerda(vvx,vvy)==1 && restricima(vvx,vvy)==0){
- if(teste2(vvx,vvy,destinovermelhox,destinovermelhoy)==1)
- valorvv=0;
- else if(teste2(vvx,vvy,destinovermelhox,destinovermelhoy)==2)
- valorvv=aleatorio02();
- else if(teste2(vvx,vvy,destinovermelhox,destinovermelhoy)==3)
- valorvv=aleatorio02();
- else if(teste2(vvx,vvy,destinovermelhox,destinovermelhoy)==4)
- valorvv=2;
- }
- else if(restriesquerda(vvx,vvy)==1 && restricima(vvx,vvy)==1){
- if(teste2(vvx,vvy,destinovermelhox,destinovermelhoy)==1)
- valorvv=aleatorio03();
- else if(teste2(vvx,vvy,destinovermelhox,destinovermelhoy)==2)
- valorvv=3;
- else if(teste2(vvx,vvy,destinovermelhox,destinovermelhoy)==3)
- valorvv=aleatorio02();
- else if(teste2(vvx,vvy,destinovermelhox,destinovermelhoy)==4)
- valorvv=2;
- }
- }
- }
- else if(restriesquerda(vvx,vvy)==1 && restribaixo(vvx,vvy)==1){
- if(valorvv==1){
- if(restridireita(vvx,vvy)==0 && restricima(vvx,vvy)==0){
- valorvv=2;
- }
- else if(restridireita(vvx,vvy)==0 && restricima(vvx,vvy)==1){
- if(teste2(vvx,vvy,destinovermelhox,destinovermelhoy)==1)
- valorvv=3;
- else if(teste2(vvx,vvy,destinovermelhox,destinovermelhoy)==2)
- valorvv=3;
- else if(teste2(vvx,vvy,destinovermelhox,destinovermelhoy)==3)
- valorvv=2;
- else if(teste2(vvx,vvy,destinovermelhox,destinovermelhoy)==4)
- valorvv=2;
- }
- else if(restridireita(vvx,vvy)==1 && restricima(vvx,vvy)==0){
- if(teste2(vvx,vvy,destinovermelhox,destinovermelhoy)==1)
- valorvv=aleatorio12();
- else if(teste2(vvx,vvy,destinovermelhox,destinovermelhoy)==2)
- valorvv=1;
- else if(teste2(vvx,vvy,destinovermelhox,destinovermelhoy)==3)
- valorvv=2;
- else if(teste2(vvx,vvy,destinovermelhox,destinovermelhoy)==4)
- valorvv=aleatorio12();
- }
- else if(restridireita(vvx,vvy)==1 && restricima(vvx,vvy)==1){
- if(teste2(vvx,vvy,destinovermelhox,destinovermelhoy)==1)
- valorvv=3;
- else if(teste2(vvx,vvy,destinovermelhox,destinovermelhoy)==2)
- valorvv=aleatorio13();
- else if(teste2(vvx,vvy,destinovermelhox,destinovermelhoy)==3)
- valorvv=2;
- else if(teste2(vvx,vvy,destinovermelhox,destinovermelhoy)==4)
- valorvv=aleatorio12();
- }
- }
- else if(valorvv==2){
- if(restridireita(vvx,vvy)==1){
- if(teste2(vvx,vvy,destinovermelhox,destinovermelhoy)==1)
- valorvv=0;
- else if(teste2(vvx,vvy,destinovermelhox,destinovermelhoy)==2)
- valorvv=1;
- else if(teste2(vvx,vvy,destinovermelhox,destinovermelhoy)==3)
- valorvv=aleatorio02();
- else if(teste2(vvx,vvy,destinovermelhox,destinovermelhoy)==4)
- valorvv=aleatorio12();
- }
- else{
- if(teste2(vvx,vvy,destinovermelhox,destinovermelhoy)==1)
- valorvv=0;
- else if(teste2(vvx,vvy,destinovermelhox,destinovermelhoy)==2)
- valorvv=aleatorio02();
- else if(teste2(vvx,vvy,destinovermelhox,destinovermelhoy)==3)
- valorvv=aleatorio02();
- else if(teste2(vvx,vvy,destinovermelhox,destinovermelhoy)==4)
- valorvv=2;
- }
- }
- else if(valorvv==3){
- if(restridireita(vvx,vvy)==0 && restricima(vvx,vvy)==0){
- valorvv=0;
- }
- else if(restridireita(vvx,vvy)==0 && restricima(vvx,vvy)==1){
- if(teste2(vvx,vvy,destinovermelhox,destinovermelhoy)==1)
- valorvv=aleatorio03();
- else if(teste2(vvx,vvy,destinovermelhox,destinovermelhoy)==2)
- valorvv=3;
- else if(teste2(vvx,vvy,destinovermelhox,destinovermelhoy)==3)
- valorvv=0;
- else if(teste2(vvx,vvy,destinovermelhox,destinovermelhoy)==4)
- valorvv=aleatorio03();
- }
- else if(restridireita(vvx,vvy)==1 && restricima(vvx,vvy)==0){
- if(teste2(vvx,vvy,destinovermelhox,destinovermelhoy)==1)
- valorvv=0;
- else if(teste2(vvx,vvy,destinovermelhox,destinovermelhoy)==2)
- valorvv=1;
- else if(teste2(vvx,vvy,destinovermelhox,destinovermelhoy)==3)
- valorvv=0;
- else if(teste2(vvx,vvy,destinovermelhox,destinovermelhoy)==4)
- valorvv=1;
- }
- else if(restridireita(vvx,vvy)==1 && restricima(vvx,vvy)==1){
- if(teste2(vvx,vvy,destinovermelhox,destinovermelhoy)==1)
- valorvv=aleatorio03();
- else if(teste2(vvx,vvy,destinovermelhox,destinovermelhoy)==2)
- valorvv=aleatorio13();
- else if(teste2(vvx,vvy,destinovermelhox,destinovermelhoy)==3)
- valorvv=0;
- else if(teste2(vvx,vvy,destinovermelhox,destinovermelhoy)==4)
- valorvv=1;
- }
- }
- else if(valorvv==0){
- if(restricima(vvx,vvy)==1){
- if(teste2(vvx,vvy,destinovermelhox,destinovermelhoy)==1)
- valorvv=aleatorio03();
- else if(teste2(vvx,vvy,destinovermelhox,destinovermelhoy)==2)
- valorvv=3;
- else if(teste2(vvx,vvy,destinovermelhox,destinovermelhoy)==3)
- valorvv=aleatorio02();
- else if(teste2(vvx,vvy,destinovermelhox,destinovermelhoy)==4)
- valorvv=2;
- }
- else if(restricima(vvx,vvy)==0){
- if(teste2(vvx,vvy,destinovermelhox,destinovermelhoy)==1)
- valorvv=0;
- else if(teste2(vvx,vvy,destinovermelhox,destinovermelhoy)==2)
- valorvv=aleatorio02();
- else if(teste2(vvx,vvy,destinovermelhox,destinovermelhoy)==3)
- valorvv=aleatorio02();
- else if(teste2(vvx,vvy,destinovermelhox,destinovermelhoy)==4)
- valorvv=2;
- }
- }
- }
- else if(restricima(vvx,vvy)==1 && restriesquerda(vvx,vvy)==1){
- if(valorvv==1){
- if(restridireita(vvx,vvy)==0 && restribaixo(vvx,vvy)==0){
- valorvv=3;
- }
- else if(restridireita(vvx,vvy)==0 && restribaixo(vvx,vvy)==1){
- if(teste2(vvx,vvy,destinovermelhox,destinovermelhoy)==1)
- valorvv=3;
- else if(teste2(vvx,vvy,destinovermelhox,destinovermelhoy)==2)
- valorvv=3;
- else if(teste2(vvx,vvy,destinovermelhox,destinovermelhoy)==3)
- valorvv=2;
- else if(teste2(vvx,vvy,destinovermelhox,destinovermelhoy)==4)
- valorvv=2;
- }
- else if(restridireita(vvx,vvy)==1 && restribaixo(vvx,vvy)==0){
- if(teste2(vvx,vvy,destinovermelhox,destinovermelhoy)==1)
- valorvv=3;
- else if(teste2(vvx,vvy,destinovermelhox,destinovermelhoy)==2)
- valorvv=aleatorio13();
- else if(teste2(vvx,vvy,destinovermelhox,destinovermelhoy)==3)
- valorvv=aleatorio13();
- else if(teste2(vvx,vvy,destinovermelhox,destinovermelhoy)==4)
- valorvv=1;
- }
- else if(restridireita(vvx,vvy)==1 && restribaixo(vvx,vvy)==1){
- if(teste2(vvx,vvy,destinovermelhox,destinovermelhoy)==1)
- valorvv=3;
- else if(teste2(vvx,vvy,destinovermelhox,destinovermelhoy)==2)
- valorvv=aleatorio13();
- else if(teste2(vvx,vvy,destinovermelhox,destinovermelhoy)==3)
- valorvv=2;
- else if(teste2(vvx,vvy,destinovermelhox,destinovermelhoy)==4)
- valorvv=aleatorio12();
- }}
- else if(valorvv==2){
- if(restridireita(vvx,vvy)==0 && restribaixo(vvx,vvy)==0){
- valorvv=0;
- }
- else if(restridireita(vvx,vvy)==0 && restribaixo(vvx,vvy)==1){
- if(teste2(vvx,vvy,destinovermelhox,destinovermelhoy)==1)
- valorvv=0;
- else if(teste2(vvx,vvy,destinovermelhox,destinovermelhoy)==2)
- valorvv=aleatorio02();
- else if(teste2(vvx,vvy,destinovermelhox,destinovermelhoy)==3)
- valorvv=aleatorio02();
- else if(teste2(vvx,vvy,destinovermelhox,destinovermelhoy)==4)
- valorvv=2;
- }
- else if(restridireita(vvx,vvy)==1 && restribaixo(vvx,vvy)==0){
- if(teste2(vvx,vvy,destinovermelhox,destinovermelhoy)==1)
- valorvv=0;
- else if(teste2(vvx,vvy,destinovermelhox,destinovermelhoy)==2)
- valorvv=1;
- else if(teste2(vvx,vvy,destinovermelhox,destinovermelhoy)==3)
- valorvv=0;
- else if(teste2(vvx,vvy,destinovermelhox,destinovermelhoy)==4)
- valorvv=1;
- }
- else if(restridireita(vvx,vvy)==1 && restribaixo(vvx,vvy)==1){
- if(teste2(vvx,vvy,destinovermelhox,destinovermelhoy)==1)
- valorvv=0;
- else if(teste2(vvx,vvy,destinovermelhox,destinovermelhoy)==2)
- valorvv=1;
- else if(teste2(vvx,vvy,destinovermelhox,destinovermelhoy)==3)
- valorvv=aleatorio02();
- else if(teste2(vvx,vvy,destinovermelhox,destinovermelhoy)==4)
- valorvv=aleatorio12();
- }
- }
- else if(valorvv==3){
- if(restridireita(vvx,vvy)==1){
- if(teste2(vvx,vvy,destinovermelhox,destinovermelhoy)==1)
- valorvv=aleatorio03();
- else if(teste2(vvx,vvy,destinovermelhox,destinovermelhoy)==2)
- valorvv=aleatorio13();
- else if(teste2(vvx,vvy,destinovermelhox,destinovermelhoy)==3)
- valorvv=0;
- else if(teste2(vvx,vvy,destinovermelhox,destinovermelhoy)==4)
- valorvv=1;
- }
- else {
- if(teste2(vvx,vvy,destinovermelhox,destinovermelhoy)==1)
- valorvv=aleatorio03();
- else if(teste2(vvx,vvy,destinovermelhox,destinovermelhoy)==2)
- valorvv=3;
- else if(teste2(vvx,vvy,destinovermelhox,destinovermelhoy)==3)
- valorvv=0;
- else if(teste2(vvx,vvy,destinovermelhox,destinovermelhoy)==4)
- valorvv=aleatorio03();
- }
- }
- else if(valorvv==0){
- if(restribaixo(vvx,vvy)==1){
- if(teste2(vvx,vvy,destinovermelhox,destinovermelhoy)==1)
- valorvv=aleatorio03();
- else if(teste2(vvx,vvy,destinovermelhox,destinovermelhoy)==2)
- valorvv=3;
- else if(teste2(vvx,vvy,destinovermelhox,destinovermelhoy)==3)
- valorvv=aleatorio02();
- else if(teste2(vvx,vvy,destinovermelhox,destinovermelhoy)==4)
- valorvv=2;
- }
- else {
- if(teste2(vvx,vvy,destinovermelhox,destinovermelhoy)==1)
- valorvv=aleatorio03();
- else if(teste2(vvx,vvy,destinovermelhox,destinovermelhoy)==2)
- valorvv=3;
- else if(teste2(vvx,vvy,destinovermelhox,destinovermelhoy)==3)
- valorvv=0;
- else if(teste2(vvx,vvy,destinovermelhox,destinovermelhoy)==4)
- valorvv=aleatorio03();
- }
- }
- }
- else if(restricima(vvx,vvy)==1 && restridireita(vvx,vvy)==1){
- if(valorvv==1){
- if(restribaixo(vvx,vvy)==1){
- if(teste2(vvx,vvy,destinovermelhox,destinovermelhoy)==1)
- valorvv=3;
- else if(teste2(vvx,vvy,destinovermelhox,destinovermelhoy)==2)
- valorvv=aleatorio13();
- else if(teste2(vvx,vvy,destinovermelhox,destinovermelhoy)==3)
- valorvv=2;
- else if(teste2(vvx,vvy,destinovermelhox,destinovermelhoy)==4)
- valorvv=aleatorio12();
- }
- else {
- if(teste2(vvx,vvy,destinovermelhox,destinovermelhoy)==1)
- valorvv=3;
- else if(teste2(vvx,vvy,destinovermelhox,destinovermelhoy)==2)
- valorvv=aleatorio13();
- else if(teste2(vvx,vvy,destinovermelhox,destinovermelhoy)==3)
- valorvv=aleatorio13();
- else if(teste2(vvx,vvy,destinovermelhox,destinovermelhoy)==4)
- valorvv=1;
- }
- }
- else if(valorvv==2){
- if(restriesquerda(vvx,vvy)==0 && restribaixo(vvx,vvy)==0){
- valorvv=1;
- }
- else if(restriesquerda(vvx,vvy)==0 && restribaixo(vvx,vvy)==1){
- if(teste2(vvx,vvy,destinovermelhox,destinovermelhoy)==1)
- valorvv=aleatorio12();
- else if(teste2(vvx,vvy,destinovermelhox,destinovermelhoy)==2)
- valorvv=1;
- else if(teste2(vvx,vvy,destinovermelhox,destinovermelhoy)==3)
- valorvv=2;
- else if(teste2(vvx,vvy,destinovermelhox,destinovermelhoy)==4)
- valorvv=aleatorio12();
- }
- else if(restriesquerda(vvx,vvy)==1 && restribaixo(vvx,vvy)==0){
- if(teste2(vvx,vvy,destinovermelhox,destinovermelhoy)==1)
- valorvv=0;
- else if(teste2(vvx,vvy,destinovermelhox,destinovermelhoy)==2)
- valorvv=1;
- else if(teste2(vvx,vvy,destinovermelhox,destinovermelhoy)==3)
- valorvv=0;
- else if(teste2(vvx,vvy,destinovermelhox,destinovermelhoy)==4)
- valorvv=1;
- }
- else if(restriesquerda(vvx,vvy)==1 && restribaixo(vvx,vvy)==1){
- if(teste2(vvx,vvy,destinovermelhox,destinovermelhoy)==1)
- valorvv=0;
- else if(teste2(vvx,vvy,destinovermelhox,destinovermelhoy)==2)
- valorvv=1;
- else if(teste2(vvx,vvy,destinovermelhox,destinovermelhoy)==3)
- valorvv=aleatorio02();
- else if(teste2(vvx,vvy,destinovermelhox,destinovermelhoy)==4)
- valorvv=aleatorio12();
- }
- }
- else if(valorvv==3){
- if(restriesquerda(vvx,vvy)==1){
- if(teste2(vvx,vvy,destinovermelhox,destinovermelhoy)==1)
- valorvv=aleatorio03();
- else if(teste2(vvx,vvy,destinovermelhox,destinovermelhoy)==2)
- valorvv=aleatorio13();
- else if(teste2(vvx,vvy,destinovermelhox,destinovermelhoy)==3)
- valorvv=0;
- else if(teste2(vvx,vvy,destinovermelhox,destinovermelhoy)==4)
- valorvv=1;
- }
- else{
- if(teste2(vvx,vvy,destinovermelhox,destinovermelhoy)==1)
- valorvv=3;
- else if(teste2(vvx,vvy,destinovermelhox,destinovermelhoy)==2)
- valorvv=aleatorio13();
- else if(teste2(vvx,vvy,destinovermelhox,destinovermelhoy)==3)
- valorvv=aleatorio13();
- else if(teste2(vvx,vvy,destinovermelhox,destinovermelhoy)==4)
- valorvv=1;
- }
- }
- else if(valorvv==0){
- if(restriesquerda(vvx,vvy)==0 && restribaixo(vvx,vvy)==0){
- valorvv=3;
- }
- else if(restriesquerda(vvx,vvy)==0 && restribaixo(vvx,vvy)==1){
- if(teste2(vvx,vvy,destinovermelhox,destinovermelhoy)==1)
- valorvv=3;
- else if(teste2(vvx,vvy,destinovermelhox,destinovermelhoy)==2)
- valorvv=3;
- else if(teste2(vvx,vvy,destinovermelhox,destinovermelhoy)==3)
- valorvv=2;
- else if(teste2(vvx,vvy,destinovermelhox,destinovermelhoy)==4)
- valorvv=2;
- }
- else if(restriesquerda(vvx,vvy)==1 && restribaixo(vvx,vvy)==0){
- if(teste2(vvx,vvy,destinovermelhox,destinovermelhoy)==1)
- valorvv=aleatorio03();
- else if(teste2(vvx,vvy,destinovermelhox,destinovermelhoy)==2)
- valorvv=3;
- else if(teste2(vvx,vvy,destinovermelhox,destinovermelhoy)==3)
- valorvv=0;
- else if(teste2(vvx,vvy,destinovermelhox,destinovermelhoy)==4)
- valorvv=aleatorio03();
- }
- else if(restriesquerda(vvx,vvy)==1 && restribaixo(vvx,vvy)==1){
- if(teste2(vvx,vvy,destinovermelhox,destinovermelhoy)==1)
- valorvv=aleatorio03();
- else if(teste2(vvx,vvy,destinovermelhox,destinovermelhoy)==2)
- valorvv=3;
- else if(teste2(vvx,vvy,destinovermelhox,destinovermelhoy)==3)
- valorvv=aleatorio02();
- else if(teste2(vvx,vvy,destinovermelhox,destinovermelhoy)==4)
- valorvv=2;
- }
- }
- }
- }
- if(cvv==0 && pts2==300){
- valorvv=0;
- cvv=1;
- }
- else if(cvv==1 && pts2>310)
- {
- cenario[15][21]=0;
- valorvv=3;
- cvv=2;
- }
- else if(cvv==2 && pts2>330)
- {
- valorvv=0;
- cvv=3;
- }
- switch(valorvv){
- case 0:
- if(tunelesquerda(vvx,vvy)==1){apagafantasma(vvx,vvy);vvx,vvy=42;vvx=16;} // CONDIÇÃO PARA QUE O "TUNEL" DO MAPA FUNCIONE
- if(restriesquerda(vvx,vvy)==1){
- apagafantasma(vvx,vvy);
- vvy--;
- }
- break;
- case 1:
- if (tuneldireita(vvx,vvy)==1){apagafantasma(vvx,vvy);vvy=0;vvx=16;}// CONDIÇÃO PARA QUE O "TUNEL" DO MAPA FUNCIONE
- if(restridireita(vvx,vvy)==1){
- apagafantasma(vvx,vvy);
- vvy++;
- }
- break;
- case 2:
- if(restribaixo(vvx,vvy)==1){
- apagafantasma(vvx,vvy);
- vvx++;
- }
- break;
- case 3:
- if(restricima(vvx,vvy)==1){
- apagafantasma(vvx,vvy);
- vvx--;
- }
- break;}
- gotoxy(vvy+1,vvx);
- textcolor(corvv);
- printf("%c", tipvv);
- }
- void som(){ // Som de finalização
- int w=5000;
- Beep(500,200);
- Sleep(400);
- while(w > 2500){
- Beep(w,35);
- w=w-80;
- }
- }
- int morte(void){ // funçao para morte dos fantasma ou do pacman, se os fantasma nao estao azuis entao no caso de conflito a funçao retorna 1 indicando a morte do pacman. se os fantasmas estao azuis, a funçao retorna valores que indicam qual dos fantasma que morreu. se nao houve conflito entao a funçao retorna 0
- int t;
- if(x==vx && y==vy && cm2==0)
- t=1;
- else if(x==ax && y==ay && cm3==0)
- t=1;
- else if(x==lx && y==ly && cm4==0)
- t=1;
- else if(x==vvx && y==vvy && cm5==0)
- t=1;
- else if(x==vx && y==vy && cm2==1)
- t=2;
- else if(x==ax && y==ay && cm3==1)
- t=3;
- else if(x==lx && y==ly && cm4==1)
- t=4;
- else if(x==vvx && y==vvy && cm5==1)
- t=5;
- else
- t=0;
- return(t);
- }
- void fruta(){ // gera uma fruta numa posiçao especifia de acordo com o tempo
- if(x==18 && y==21){
- cf=1;
- }
- if(cf==0){
- cenario[18][21]=14;
- gotoxy(21+1,18);
- printf("%c",cenario[18][21]);//x18,y21;
- }
- }
- void apagafruta(){ // funçao para apagar a fruta
- cenario[18][21]=0;
- gotoxy(21+1,18);
- printf("%c",cenario[18][21]);
- }
- void vetor (){ // Teste dos valores do vetor
- int i, j;
- for(i=0;i<32;i++){
- for(j=0;j<43;j++){
- printf("%c", cenario[i][j]);
- }
- printf("\n");
- }
- }
- void piscar() // funçao para fazer os fantasmas piscarem.
- {
- if(pts3>900 && pts3<925)
- {
- if(cm2==1){corv=12;}
- if(cm3==1){cora=5;}
- if(cm4==1){corl=2;}
- if(cm5==1){corvv=6;}
- }
- else if(pts3>925 && pts3<950)
- {
- if(cm2==1){corv=9;}
- if(cm3==1){cora=9;}
- if(cm4==1){corl=9;}
- if(cm5==1){corvv=9;}
- }
- else if(pts3>950 && pts3<975)
- {
- if(cm2==1){corv=12;}
- if(cm3==1){cora=5;}
- if(cm4==1){corl=2;}
- if(cm5==1){corvv=6;}
- }
- else if(pts3>975 && pts3<1000)
- {
- if(cm2==1){corv=9;}
- if(cm3==1){cora=9;}
- if(cm4==1){corl=9;}
- if(cm5==1){corvv=9;}
- }
- }
- void zerar() // funçao para zerar as variaveis do programa
- {
- x=24; y=21; xx=0; yy=0;
- vx=14;vy=22;valorv=4;valorv2=4;cv=0;
- ax=16;ay=21;valora=4;ca=0,pts2=0;
- cf=0;
- lx=16,ly=19,valorl=4,cl=0;
- vvx=16,vvy=23,valorvv=4,cvv=0;
- corv=12;tipv=5;// cores originais
- cora=5;tipa=5; // cor original tipo original
- corl=2;tipl=5;
- corvv=6;tipvv=5;mvv=0;
- cm=0;cm2=0;cm3=0;cm4=0;cm5=0;
- }
- void begin() // funçao para refazer o mapa como no inicio
- {
- int i,j;
- for(i=0;i<32;i++){
- for(j=0;j<43;j++){
- cenario[i][j]=cenario2[i][j];
- }
- }
- }
- int menu() // funçao para imprimir o menu
- {
- int t;
- system("cls");
- textcolor(12);
- printf("\n\t\t1.INICIAR\n\t\t2.HOW TO PLAY\n\t\t3.SAIR\n\n");
- printf("\tinforme a opcao: ");
- scanf("%d",&t);
- system("cls");
- return(t);
- }
- void how() // funçao que ensina os comandos do jogo
- {
- system("cls");
- printf("\n\nUtilize as teclas: W, S, D, A ou \nAs setas do teclado! para movimentar o pacman\nUse a tecla ESC para sair do jogo\n\n\nPressione ESC para voltar\n");
- do{
- }while(!GetAsyncKeyState(VK_ESCAPE));
- }
- int main (){
- int valor,valor2;
- int inicio,fim,tms;
- int mort=0,c,vida=3,z=0;
- int t;//controla o menu
- int ti=1;
- inicio=GetTickCount();
- do{
- t=menu();
- if(t==2)
- {
- how();
- }
- else if(t==1){
- do{
- mapa();
- srand( (unsigned)time(NULL) );
- while(!GetAsyncKeyState(VK_ESCAPE) && mort!=1){
- pts2=pts2+10;
- if(GetAsyncKeyState(VK_LEFT) || GetAsyncKeyState(65) && x<= 32)
- {
- {valor=1;}
- }
- if(GetAsyncKeyState(VK_RIGHT) || GetAsyncKeyState(68) && x>= 0)
- {
- {valor=2;}
- }
- if(GetAsyncKeyState(VK_DOWN) || GetAsyncKeyState(83) && y> 0)
- {
- {valor=3;}
- }
- if(GetAsyncKeyState(VK_UP) || GetAsyncKeyState(87) && y<= 43)
- {
- {valor=4;}
- }
- if(GetAsyncKeyState(80)){Sleep(9000);} // PAUSE CONTEM ERRO
- switch(valor){
- case 1:
- if(tunelesquerda(x,y)==1){y=43;x=16;} // CONDIÇÃO PARA QUE O "TUNEL" DO MAPA FUNCIONE
- if(restriesquerda(x,y)==1){
- y--;
- valor2=valor;}
- break;
- case 2:
- if (tuneldireita(x,y)==1){y=-1;x=16;}// CONDIÇÃO PARA QUE O "TUNEL" DO MAPA FUNCIONE
- if(restridireita(x,y)==1){
- y++;
- valor2=valor;}
- break;
- case 3:
- if(restribaixo(x,y)==1){
- x++;
- valor2=valor;}
- break;
- case 4:
- if(restricima(x,y)==1){
- x--;
- valor2=valor;}
- break;}
- if(valor2!=valor){
- valor=valor2;
- switch(valor2){
- case 1:
- if (tunelesquerda(x,y)==1){y=43;x=16;} // CONDIÇÃO PARA QUE O "TUNEL" DO MAPA FUNCIONE
- if(restriesquerda(x,y)==1){
- y--;
- }
- break;
- case 2:
- if (tuneldireita(x,y)==1){y=-1;x=16;}// CONDIÇÃO PARA QUE O "TUNEL" DO MAPA FUNCIONE
- if(restridireita(x,y)==1){
- y++;
- }
- break;
- case 3:
- if(restribaixo(x,y)==1){
- x++;
- }
- break;
- case 4:
- if(restricima(x,y)==1){
- x--;
- }
- break;}
- }
- fim=GetTickCount();
- tms=fim-inicio;
- if(tms>7000 && tms<20000){
- fruta();
- }
- else{
- apagafruta();
- }
- pontuacao();
- bip(); // Chama função de som da pirula
- mort=morte();
- if(mort!=0)
- c=1;
- fantasma ();
- if(c==0){
- mort=morte();
- if(mort!=0)
- c=1;
- }
- fantasmaazul(tms);
- fantasmaverde(tms);
- fantasmalaranja();
- if(c==0){
- mort=morte();}
- if(cm==1)
- {
- pts3=pts3+10;
- if(k==0)
- {
- corv=9;
- cora=9;
- corl=9;
- corvv=9;
- k=1;
- }
- if(mort==2)
- {
- apagafantasma(vx,vy);
- gotoxy(45,25);
- printf("%d",200*ti);
- Beep(2500,40);
- printf("%c",0);
- ti=ti*2;
- pts=pts=200*ti;
- corv=12;
- cm2=0;
- vx=14;vy=22;valorv=4;valorv2=4;cv=0;
- }
- if(mort==3)
- {
- apagafantasma(ax,ay);
- gotoxy(45,25);
- printf("%d",200*ti);
- Beep(2500,40);
- printf("%c",0);
- ti=ti*2;
- pts=pts+200*ti;
- cora=5;
- cm3=0;
- ax=16;ay=21;valora=4;ca=0,pts2=0;
- }
- if(mort==4)
- {
- apagafantasma(lx,ly);
- gotoxy(45,25);
- printf("%d",200*ti);
- Beep(2500,40);
- printf("%c",0);
- ti=ti*2;
- pts=pts+200*ti;
- corl=2;
- cm4=0;
- lx=14,ly=21,valorl=1;
- }
- if(mort==5)
- {
- apagafantasma(vvx,vvy);
- gotoxy(45,25);
- printf("%d",200*ti);
- Beep(2500,40);
- printf("%c",0);
- ti=ti*2;
- pts=pts+200*ti;
- corvv=6;
- cm5=0;
- vvx=14,vvy=21,valorvv=0;
- }
- if(pts3>900 && pts3<1000)
- {
- piscar();
- Beep(500,15);
- }
- if(pts3>1000)
- {
- pts3=0;
- cm=0;
- k=0;
- }
- }
- if(cm==0){
- ti=1;
- corv=12;
- cora=5;
- corl=2;
- corvv=6;
- cm2=0;
- cm3=0;
- cm4=0;
- cm5=0;
- }
- pacman(); // Chama Pacman atual
- cenario[x][y]= 0;// apaga pirula quando comida
- Sleep(fps); // fps Controla a velocidade do Jogo
- ex_pacman (); // apaga posiçao anterior
- c=0;
- }
- som(); // Chama som de Finalização do jogo
- gotoxy(1+1,32); // Posição da finalização do promp de comando
- textcolor(1);
- //system("cls
- zerar(); // zerar as variaveis
- cenario[1][41+z]=0; // perder uma vida, apagar um dos rostos na parte superior do mapa
- z=1;
- vida=vida-1; // decrementar uma vida
- mort=0;
- valor=4;
- valor2=4;
- if(tot>=392)
- {
- vida=0; // encerar o jogo
- }
- }while(vida>0);}
- pts=0; // zerar pontuaçao
- vida=3; // restaurar vidas
- tot=0; // zerar total de pilulas consumidas
- begin();
- }while(t!=3);
- vetor (); // chama teste de vetor
- system("pause");
- system("cls");
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement