SHARE
TWEET

Juego_Version7

GonzaloGuerreroP Nov 18th, 2019 91 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include <iostream>
  2. #include <conio.h>
  3. #include <ctime>
  4. #include <stdlib.h>
  5. #include <list>
  6. using namespace System;
  7. using namespace std;
  8. #define FILAS 20
  9. #define COLUMNAS 75
  10. #define ARRIBA       72
  11. #define ABAJO        80
  12. #define IZQUIERDA    75
  13. #define DERECHA      77
  14. #define LIMITEX      20
  15. #define LIMITEY      20
  16. #define LIMITER      5
  17. #define DISPARO      32
  18. #define DISPARO2     13
  19.  
  20. int matrizIntro[29][85] = {
  21. {1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1},
  22. {1,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,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1},
  23. {1,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,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1},
  24. {1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,2,0,0,0,2,2,0,0,2,2,2,2,2,2,0,0,2,2,2,2,0,0,2,2,2,2,0,0,0,0,2,2,2,2,2,0,2,2,2,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1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,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,1},
  81. {1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1},
  82. };
  83.  
  84. int matrizcopia[29][85];
  85.  
  86. void copiasmatriz(int nivel) {
  87.     for (int f = 0; f < 29; f++)
  88.     {
  89.         for (int c = 0; c < 85; c++)
  90.         {
  91.             if (nivel == 1) {
  92.                 matrizcopia[f][c] = matrizIntro[f][c];
  93.             }
  94.             if (nivel == 2) {
  95.                 matrizcopia[f][c] = matrizEstructura[f][c];
  96.             }
  97.         }
  98.     }
  99. }
  100.  
  101. void imprimirmatriz(int nivel) {
  102.     Console::Clear();
  103.     for (int i = 0; i < 29; i++) {
  104.         for (int j = 0; j < 85; j++) {
  105.             if (nivel == 1) {
  106.                 if (matrizcopia[i][j] == 0) {
  107.                     cout << " ";
  108.                 }
  109.                 if (matrizcopia[i][j] == 1) {
  110.                     Console::ForegroundColor = ConsoleColor::Yellow;
  111.                     cout << "*";
  112.                 }
  113.                 if (matrizcopia[i][j] == 2) {
  114.                     Console::ForegroundColor = ConsoleColor::Blue;
  115.                     cout << char(219);
  116.                 }
  117.             }
  118.             if (nivel == 2) {
  119.                 if (matrizcopia[i][j] == 1) {
  120.                     Console::ForegroundColor = ConsoleColor::Red;
  121.                     cout << "*";
  122.                 }
  123.                 if (matrizcopia[i][j] == 0) {
  124.                     cout << " ";
  125.                 }
  126.             }
  127.  
  128.         }
  129.         cout << "\n";
  130.     }
  131. }
  132.  
  133. typedef struct Nave {
  134.     int _x, _y, _vidas;
  135. public:
  136.     Nave(int x, int y) {
  137.         _x = x;
  138.         _y = y;
  139.         _vidas = 3;
  140.     }
  141.     int X() { return _x; }
  142.     int Y() { return _y; }
  143.     void animar(short tecla) {
  144.         borrar();
  145.         mover(tecla);
  146.         dibujar();
  147.     }
  148.     void borrar() {
  149.         Console::SetCursorPosition(_x, _y);
  150.         cout << " ";
  151.         Console::SetCursorPosition(_x - 1, _y + 1);
  152.         cout << " ";
  153.         Console::SetCursorPosition(_x + 1, _y + 1);
  154.         cout << " ";
  155.         Console::SetCursorPosition(_x - 1, _y + 1);
  156.         cout << " ";
  157.         Console::SetCursorPosition(_x, _y + 2);
  158.         cout << " ";
  159.         Console::SetCursorPosition(_x - 1, _y + 2);
  160.         cout << " ";
  161.         Console::SetCursorPosition(_x + 1, _y + 2);
  162.         cout << " ";
  163.         Console::SetCursorPosition(_x + 2, _y + 2);
  164.         cout << " ";
  165.         Console::SetCursorPosition(_x - 2, _y + 2);
  166.         cout << " ";
  167.         Console::SetCursorPosition(_x - 2, _y + 3);
  168.         cout << " ";
  169.         Console::SetCursorPosition(_x + 2, _y + 3);
  170.         cout << " ";
  171.     }
  172.     void mover(short tecla) {
  173.         short direccion;
  174.         direccion = toupper(tecla);
  175.         switch (direccion) {
  176.         case 'W': if (_y - 1 >= 1) {
  177.             _y--;
  178.             break;
  179.         }
  180.         case 'S': if (_y + 4 <= 27) {
  181.             _y++;
  182.             break;
  183.         }
  184.         case 'A': if (_x - 2 >= 2) {
  185.             _x--;
  186.             break;
  187.         }
  188.         case 'D': if (_x + 3 <= 83) {
  189.             _x++;
  190.             break;
  191.         }
  192.         }
  193.     }
  194.     void dibujar() {
  195.         Console::SetCursorPosition(_x, _y);
  196.         Console::ForegroundColor = ConsoleColor::Green;
  197.         cout << char(219);
  198.         Console::SetCursorPosition(_x, _y + 1);
  199.         Console::ForegroundColor = ConsoleColor::Blue;
  200.         cout << char(219);
  201.         Console::SetCursorPosition(_x + 1, _y + 1);
  202.         Console::ForegroundColor = ConsoleColor::Green;
  203.         cout << char(219);
  204.         Console::SetCursorPosition(_x - 1, _y + 1);
  205.         Console::ForegroundColor = ConsoleColor::Green;
  206.         cout << char(219);
  207.         Console::SetCursorPosition(_x, _y + 2);
  208.         Console::ForegroundColor = ConsoleColor::Blue;
  209.         cout << char(223);
  210.         Console::SetCursorPosition(_x - 1, _y + 2);
  211.         Console::ForegroundColor = ConsoleColor::Blue;
  212.         cout << char(219);
  213.         Console::SetCursorPosition(_x + 1, _y + 2);
  214.         Console::ForegroundColor = ConsoleColor::Blue;
  215.         cout << char(219);
  216.         Console::SetCursorPosition(_x + 2, _y + 2);
  217.         Console::ForegroundColor = ConsoleColor::Green;
  218.         cout << char(219);
  219.         Console::SetCursorPosition(_x - 2, _y + 2);
  220.         Console::ForegroundColor = ConsoleColor::Green;
  221.         cout << char(219);
  222.         Console::SetCursorPosition(_x - 2, _y + 3);
  223.         Console::ForegroundColor = ConsoleColor::Green;
  224.         cout << char(223);
  225.         Console::SetCursorPosition(_x + 2, _y + 3);
  226.         Console::ForegroundColor = ConsoleColor::Green;
  227.         cout << char(223);
  228.     }
  229. };
  230.  
  231. typedef struct NaveEnemiga {
  232.     short _x, _y, _dx, _dy, _retraso;
  233.     bool _colisiono = false;
  234.     char _img;
  235. public:
  236.     NaveEnemiga(short x, short y, short dx, short dy) {
  237.         _x = x;
  238.         _y = y;
  239.         _dx = dx;
  240.         _dy = dy;
  241.         _retraso = 0;
  242.         _img = (char)2;
  243.     }
  244.     int X() { return _x; }
  245.     int Y() { return _y; }
  246.     bool colisiono() { return _colisiono; }
  247.     void marcar_colision() {
  248.         _colisiono = true;
  249.     }
  250.     void animar() {
  251.         if (_retraso == LIMITER) {
  252.  
  253.             borrar();
  254.             mover();
  255.             dibujar();
  256.             _retraso = 0;
  257.         }
  258.         _retraso++;
  259.     }
  260.     void borrar() {
  261.         Console::SetCursorPosition(_x, _y);
  262.         cout << " ";
  263.     }
  264.     void mover() {
  265.         if (_x + _dx < 1 || _x + _dx > 83) {
  266.             _dx *= -1;
  267.             _y++;
  268.         }
  269.         if (_y == 28) {
  270.             _y = 1;
  271.         }
  272.         _x += _dx;
  273.     }
  274.     void dibujar() {
  275.         if (!(_colisiono)) {
  276.             Console::SetCursorPosition(_x, _y);
  277.             Console::ForegroundColor = ConsoleColor::Green;
  278.             cout << _img;
  279.         }
  280.     }
  281.  
  282.  
  283. };
  284.  
  285. typedef struct Nave2 {
  286.     int _x, _y, _vidas;
  287. public:
  288.     Nave2(int x, int y) {
  289.         _x = x;
  290.         _y = y;
  291.         _vidas = 3;
  292.     }
  293.     int X() { return _x; }
  294.     int Y() { return _y; }
  295.     void animar(short tecla) {
  296.         borrar();
  297.         mover(tecla);
  298.         dibujar();
  299.     }
  300.     void borrar() {
  301.         Console::SetCursorPosition(_x, _y);
  302.         cout << " ";
  303.         Console::SetCursorPosition(_x - 1, _y + 1);
  304.         cout << " ";
  305.         Console::SetCursorPosition(_x + 1, _y + 1);
  306.         cout << " ";
  307.         Console::SetCursorPosition(_x - 1, _y + 1);
  308.         cout << " ";
  309.         Console::SetCursorPosition(_x, _y + 2);
  310.         cout << " ";
  311.         Console::SetCursorPosition(_x - 1, _y + 2);
  312.         cout << " ";
  313.         Console::SetCursorPosition(_x + 1, _y + 2);
  314.         cout << " ";
  315.         Console::SetCursorPosition(_x + 2, _y + 2);
  316.         cout << " ";
  317.         Console::SetCursorPosition(_x - 2, _y + 2);
  318.         cout << " ";
  319.         Console::SetCursorPosition(_x - 2, _y + 3);
  320.         cout << " ";
  321.         Console::SetCursorPosition(_x + 2, _y + 3);
  322.         cout << " ";
  323.     }
  324.     void mover(short tecla) {
  325.         switch (tecla) {
  326.         case ARRIBA: if (_y - 1 >= 1) _y--; break;
  327.         case ABAJO: if (_y + 4 <= 27) _y++; break;
  328.         case IZQUIERDA: if (_x - 2 >= 2) _x--; break;
  329.         case DERECHA: if (_x + 3 <= 83) _x++; break;
  330.         }
  331.     }
  332.     void dibujar() {
  333.         Console::SetCursorPosition(_x, _y);
  334.         Console::ForegroundColor = ConsoleColor::White;
  335.         cout << char(219);
  336.         Console::SetCursorPosition(_x, _y + 1);
  337.         Console::ForegroundColor = ConsoleColor::Red;
  338.         cout << char(219);
  339.         Console::SetCursorPosition(_x + 1, _y + 1);
  340.         Console::ForegroundColor = ConsoleColor::White;
  341.         cout << char(219);
  342.         Console::SetCursorPosition(_x - 1, _y + 1);
  343.         Console::ForegroundColor = ConsoleColor::White;
  344.         cout << char(219);
  345.         Console::SetCursorPosition(_x, _y + 2);
  346.         Console::ForegroundColor = ConsoleColor::Red;
  347.         cout << char(223);
  348.         Console::SetCursorPosition(_x - 1, _y + 2);
  349.         Console::ForegroundColor = ConsoleColor::Red;
  350.         cout << char(219);
  351.         Console::SetCursorPosition(_x + 1, _y + 2);
  352.         Console::ForegroundColor = ConsoleColor::Red;
  353.         cout << char(219);
  354.         Console::SetCursorPosition(_x + 2, _y + 2);
  355.         Console::ForegroundColor = ConsoleColor::White;
  356.         cout << char(219);
  357.         Console::SetCursorPosition(_x - 2, _y + 2);
  358.         Console::ForegroundColor = ConsoleColor::White;
  359.         cout << char(219);
  360.         Console::SetCursorPosition(_x - 2, _y + 3);
  361.         Console::ForegroundColor = ConsoleColor::White;
  362.         cout << char(223);
  363.         Console::SetCursorPosition(_x + 2, _y + 3);
  364.         Console::ForegroundColor = ConsoleColor::White;
  365.         cout << char(223);
  366.     }
  367. };
  368.  
  369. typedef struct BALA {
  370.     int _x, _y;
  371. public:
  372.     BALA(int x, int y) {
  373.         _x = x;
  374.         _y = y;
  375.     }
  376.     int X() { return _x; }
  377.     int Y() { return _y; }
  378.     void mover() {
  379.         Console::SetCursorPosition(_x, _y);
  380.         cout << " ";
  381.         _y--;
  382.         Console::SetCursorPosition(_x, _y);
  383.         Console::ForegroundColor = ConsoleColor::Blue;
  384.         cout << "*";
  385.     }
  386.  
  387.     bool fuera() {
  388.         if (_y == 1) return true;
  389.         return false;
  390.     }
  391. };
  392.  
  393. void jugar(int players) {
  394.     int puntos = 0;
  395.     int contadornivel1 = 0;
  396.     int contadornivel2 = 0;
  397.     bool gameover = false;
  398.     bool gameover2 = false;
  399.     int cantidadEnemigos = 28;
  400.     //BALAS de nave1
  401.     list<BALA*> B;
  402.     list<BALA*> ::iterator it2;
  403.     //BALAS de nave 2
  404.     list<BALA*>B2;
  405.     list<BALA*> ::iterator it3;
  406.     //ENEMIGOS
  407.     list<NaveEnemiga*> E;
  408.     list<NaveEnemiga*>::iterator it;
  409.     //CREA ENEMIGOS
  410.     for (int i = 0; i < cantidadEnemigos; i++)
  411.     {
  412.         E.push_back(new NaveEnemiga(2 + (i * 3), 2, -1, +1));
  413.     }
  414.     //ENEMIGOS2
  415.     list<NaveEnemiga*> E2;
  416.     list<NaveEnemiga*>::iterator itE2;
  417.     //CREA ENEMIGOS
  418.     for (int i = 0; i < cantidadEnemigos; i++)
  419.     {
  420.         E2.push_back(new NaveEnemiga(2 + (i * 3), 2, -1, +1));
  421.     }
  422.     //CREA HEROES
  423.     Nave nave1 = Nave(40, 20);
  424.     Nave nave3 = Nave(30, 20);
  425.     Nave2 nave2 = Nave2(55, 20);
  426.     //JUEGO
  427.     while (!(gameover)) {
  428.         //puntos
  429.         Console::SetCursorPosition(89, 3);
  430.         Console::ForegroundColor = ConsoleColor::Yellow;
  431.         cout << "Puntos: " << puntos;
  432.         //Lee la tecla presionada y genera valores en las listas
  433.         if (kbhit()) {
  434.             if (players == 1) {
  435.                 char tecla = getch();
  436.                 nave1.animar(tecla);
  437.                 if (tecla == DISPARO)
  438.                     B.push_back(new BALA(nave1.X(), nave1.Y() - 1));
  439.             }
  440.             else if (players == 2) {
  441.                 char tecla = getch();
  442.                 nave3.animar(tecla);
  443.                 if (tecla == DISPARO)
  444.                     B.push_back(new BALA(nave3.X(), nave3.Y() - 1));
  445.                 nave2.animar(tecla);
  446.                 if (tecla == DISPARO2)
  447.                     B2.push_back(new BALA(nave2.X(), nave2.Y() - 1));
  448.             }
  449.         }
  450.         //Imprime , mueve y borra las balas nave1 y nave 3(mueve con awsd)
  451.         for (it2 = B.begin(); it2 != B.end();) {
  452.             (*it2)->mover();
  453.             if ((*it2)->fuera()) {
  454.                 Console::SetCursorPosition((*it2)->X(), (*it2)->Y());
  455.                 cout << " ";
  456.                 delete(*it2);
  457.                 //da un valor de la lista al eliminado
  458.                 it2 = B.erase(it2);
  459.             }
  460.             else {
  461.                 it2++;
  462.             }
  463.         }
  464.         //Imprime , mueve y borra las balas de nave2(mueve con flechitas)
  465.         for (it3 = B2.begin(); it3 != B2.end();) {
  466.             (*it3)->mover();
  467.             if ((*it3)->fuera()) {
  468.                 Console::SetCursorPosition((*it3)->X(), (*it3)->Y());
  469.                 cout << " ";
  470.                 delete(*it3);
  471.                 //da un valor de la lista al eliminado
  472.                 it3 = B2.erase(it3);
  473.             }
  474.             else {
  475.                 it3++;
  476.             }
  477.         }
  478.         //Imprime a los enemigos
  479.         for (it = E.begin(); it != E.end(); it++) {
  480.             (*it)->animar();
  481.         }
  482.         //Balas de nave 1 y nave 3 que eliminan enemigos
  483.         for (it = E.begin(); it != E.end(); it++) {
  484.             for (it2 = B.begin(); it2 != B.end();)
  485.             {
  486.                 if ((*it)->X() == (*it2)->X() && ((*it)->Y() == (*it2)->Y() || (*it)->Y() + 1 == (*it2)->Y()) && !((*it)->colisiono())) {
  487.                     Console::SetCursorPosition((*it2)->X(), (*it2)->Y());
  488.                     cout << " ";
  489.                     delete(*it2);
  490.                     it2 = B.erase(it2);
  491.                     Console::SetCursorPosition((*it)->X(), (*it)->Y());
  492.                     cout << " ";
  493.                     (*it)->marcar_colision();
  494.                     puntos += 5;
  495.                     contadornivel1 += 1;
  496.                 }
  497.                 else { it2++; }
  498.  
  499.             }
  500.         }
  501.         //Balas de nave 2 que eliminan enemigos
  502.         for (it = E.begin(); it != E.end(); it++) {
  503.             for (it3 = B2.begin(); it3 != B2.end();)
  504.             {
  505.                 if ((*it)->X() == (*it3)->X() && ((*it)->Y() == (*it3)->Y() || (*it)->Y() + 1 == (*it3)->Y()) && !((*it)->colisiono())) {
  506.                     Console::SetCursorPosition((*it3)->X(), (*it3)->Y());
  507.                     cout << " ";
  508.                     delete(*it3);
  509.                     it3 = B2.erase(it3);
  510.                     Console::SetCursorPosition((*it)->X(), (*it)->Y());
  511.                     cout << " ";
  512.                     (*it)->marcar_colision();
  513.                     puntos += 5;
  514.                     contadornivel1 += 1;
  515.                 }
  516.                 else { it3++; }
  517.  
  518.             }
  519.         }
  520.         _sleep(10);
  521.         if (contadornivel1 == cantidadEnemigos) {
  522.             gameover = true;
  523.         }
  524.     }
  525.     while (!(gameover2)) {
  526.         //puntos
  527.         Console::SetCursorPosition(89, 3);
  528.         Console::ForegroundColor = ConsoleColor::Yellow;
  529.         cout << "Puntos: " << puntos;
  530.         //Lee la tecla presionada y genera valores en las listas
  531.         if (kbhit()) {
  532.             if (players == 1) {
  533.                 char tecla = getch();
  534.                 nave1.animar(tecla);
  535.                 if (tecla == DISPARO)
  536.                     B.push_back(new BALA(nave1.X(), nave1.Y() - 1));
  537.             }
  538.             else if (players == 2) {
  539.                 char tecla = getch();
  540.                 nave3.animar(tecla);
  541.                 if (tecla == DISPARO)
  542.                     B.push_back(new BALA(nave3.X(), nave3.Y() - 1));
  543.                 nave2.animar(tecla);
  544.                 if (tecla == DISPARO2)
  545.                     B2.push_back(new BALA(nave2.X(), nave2.Y() - 1));
  546.             }
  547.         }
  548.         //Imprime , mueve y borra las balas nave1 y nave 3(mueve con awsd)
  549.         for (it2 = B.begin(); it2 != B.end();) {
  550.             (*it2)->mover();
  551.             if ((*it2)->fuera()) {
  552.                 Console::SetCursorPosition((*it2)->X(), (*it2)->Y());
  553.                 cout << " ";
  554.                 delete(*it2);
  555.                 //da un valor de la lista al eliminado
  556.                 it2 = B.erase(it2);
  557.             }
  558.             else {
  559.                 it2++;
  560.             }
  561.         }
  562.         //Imprime , mueve y borra las balas de nave2(mueve con flechitas)
  563.         for (it3 = B2.begin(); it3 != B2.end();) {
  564.             (*it3)->mover();
  565.             if ((*it3)->fuera()) {
  566.                 Console::SetCursorPosition((*it3)->X(), (*it3)->Y());
  567.                 cout << " ";
  568.                 delete(*it3);
  569.                 //da un valor de la lista al eliminado
  570.                 it3 = B2.erase(it3);
  571.             }
  572.             else {
  573.                 it3++;
  574.             }
  575.         }
  576.         //Imprime a los enemigos
  577.         for (itE2 = E2.begin(); itE2 != E2.end(); itE2++) {
  578.             (*itE2)->animar();
  579.         }
  580.         //Balas de nave 1 y nave 3 que eliminan enemigos
  581.         for (itE2 = E2.begin(); itE2 != E2.end(); itE2++) {
  582.             for (it2 = B.begin(); it2 != B.end();)
  583.             {
  584.                 if ((*itE2)->X() == (*it2)->X() && ((*itE2)->Y() == (*it2)->Y() || (*itE2)->Y() + 1 == (*it2)->Y()) && !((*itE2)->colisiono())) {
  585.                     Console::SetCursorPosition((*it2)->X(), (*it2)->Y());
  586.                     cout << " ";
  587.                     delete(*it2);
  588.                     it2 = B.erase(it2);
  589.                     Console::SetCursorPosition((*itE2)->X(), (*itE2)->Y());
  590.                     cout << " ";
  591.                     (*itE2)->marcar_colision();
  592.                     puntos += 5;
  593.                     contadornivel2 += 1;
  594.                 }
  595.                 else { it2++; }
  596.  
  597.             }
  598.         }
  599.         //Balas de nave 2 que eliminan enemigos
  600.         for (itE2 = E2.begin(); itE2 != E2.end(); itE2++) {
  601.             for (it3 = B2.begin(); it3 != B2.end();)
  602.             {
  603.                 if ((*itE2)->X() == (*it3)->X() && ((*itE2)->Y() == (*it3)->Y() || (*itE2)->Y() + 1 == (*it3)->Y()) && !((*itE2)->colisiono())) {
  604.                     Console::SetCursorPosition((*it3)->X(), (*it3)->Y());
  605.                     cout << " ";
  606.                     delete(*it3);
  607.                     it3 = B2.erase(it3);
  608.                     Console::SetCursorPosition((*itE2)->X(), (*itE2)->Y());
  609.                     cout << " ";
  610.                     (*itE2)->marcar_colision();
  611.                     puntos += 5;
  612.                     contadornivel2 += 1;
  613.                 }
  614.                 else { it3++; }
  615.  
  616.             }
  617.         }
  618.         _sleep(0);
  619.         if (contadornivel2 == cantidadEnemigos) {
  620.             gameover2 = true;
  621.         }
  622.     }
  623. }
  624.  
  625. int main() {
  626.     int nivel;
  627.     int players;
  628.     Console::CursorVisible = false;
  629.     copiasmatriz(nivel = 1);
  630.     imprimirmatriz(nivel = 1);
  631.     Console::SetCursorPosition(27, 27);
  632.     Console::ForegroundColor = ConsoleColor::White;
  633.     cout << "<<PRESIONE CUALQUIER TECLA PARA COMENZAR>>";
  634.     if (getch()) {
  635.         do {
  636.             system("cls");
  637.             copiasmatriz(nivel = 2);
  638.             imprimirmatriz(nivel = 2);
  639.             Console::SetCursorPosition(16, 14);
  640.             Console::ForegroundColor = ConsoleColor::Green;
  641.             cout << "Seleccione una cantidad de jugadores entre 1 y 2: ";
  642.             cin >> players;
  643.         } while (!(players == 1 || players == 2));
  644.         system("cls");
  645.         copiasmatriz(nivel = 2);
  646.         imprimirmatriz(nivel = 2);
  647.         jugar(players);
  648.     }
  649.     return 0;
  650. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top