#include #include #include class cMenu { private: int selectx,selecty; int qtd,score,var,rando; char opt [100][100]; char point; int enemyx, enemyy,enemyn; public: void moverBaixo(); void moverCima (); void startMapa(); void moverDireita(); void moverEsquerda(); cMenu(); void mostrarMatriz(); void executarMatriz(); void iniciaMatriz (); void inimigos(); void gameOver(); void Verify(); void insertInimigos(); }; void cMenu::Verify() { int z,v,cont=0; if ((enemyx == selectx) && (enemyy == selecty)) gameOver(); for (z=0;z=0 && rando <=4 ) // --- RAND 0->4 { if (opt[enemyx][enemyy+1] != '*') { if (opt[enemyx][enemyy+1] == '|') enemyy=0; opt[enemyx][enemyy]= ' '; enemyy++; } } else { if ( rando >=5 && rando <=9 ) // --- RAND { if (opt[enemyx][enemyy-1] != '*') { if (opt[enemyx][enemyy-1] == '|') enemyy=qtd; opt[enemyx][enemyy]= ' '; enemyy--; } } else { if ( rando >=10 && rando <=13 ) // --- RAND { if (opt[enemyx-1][enemyy] != '*') { opt[enemyx][enemyy]= ' '; enemyx--; } } else { if (opt[enemyx+1][enemyy] != '*') { opt[enemyx][enemyy]= ' '; enemyx++; } } } } } void cMenu::moverDireita() { if ( opt[selectx][selecty+1] != '*') { if (opt[selectx][selecty+1] == '.') score+=var; opt[selectx][selecty]=' '; selecty++; } if (opt[selectx][selecty+1] == '|') selecty=0; } void cMenu::moverCima() { if ( opt[selectx-1][selecty] != '*') { if (opt[selectx-1][selecty] == '.') score+=var; opt[selectx][selecty]=' '; selectx--; } } void cMenu::moverBaixo() { if ( opt[selectx+1][selecty] != '*') { if (opt[selectx+1][selecty] == '.') score+=var; opt[selectx][selecty]=' '; selectx++; } } void cMenu::moverEsquerda() { if ( opt[selectx][selecty-1] != '*') { if (opt[selectx][selecty-1] =='.') score+=var; opt[selectx][selecty]=' '; selecty--; } if (opt[selectx][selecty-1] == '|') selecty=qtd; } void cMenu::executarMatriz() { bool fim=true; while (fim) { Verify(); startMapa(); system ("cls"); mostrarMatriz(); switch (getch()) { case 'P'://P -> Mover Para Baixo moverBaixo(); break; case 'M'://M -> Mover Para Direita moverDireita(); break; case 'H'://H -> Mover Para Cima moverCima(); break; case 'K'://K Mover Para Esquerda moverEsquerda(); break; case 27: fim=false; } //inimigos(); insertInimigos(); } } void cMenu::iniciaMatriz() { int x,y; for (x=0;x