Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <conio.h>
- #include <ctime>
- #include <stdlib.h>
- #include <list>
- using namespace System;
- using namespace std;
- #define FILAS 20
- #define COLUMNAS 75
- #define ARRIBA 72
- #define ABAJO 80
- #define IZQUIERDA 75
- #define DERECHA 77
- #define LIMITEX 20
- #define LIMITEY 20
- #define LIMITER 5
- #define DISPARO 32
- #define DISPARO2 13
- int vidas1 = 5;
- int vidas2 = 5;
- int matrizIntro[29][85] = {
- {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},
- {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},
- {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},
- {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},
- {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,2,0,2,2,2,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,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},
- };
- int matrizcopia[29][85];
- void copiasmatriz(int nivel) {
- for (int f = 0; f < 29; f++)
- {
- for (int c = 0; c < 85; c++)
- {
- if (nivel == 1) {
- matrizcopia[f][c] = matrizIntro[f][c];
- }
- if (nivel == 2) {
- matrizcopia[f][c] = matrizEstructura[f][c];
- }
- }
- }
- }
- void imprimirmatriz(int nivel) {
- Console::Clear();
- for (int i = 0; i < 29; i++) {
- for (int j = 0; j < 85; j++) {
- if (nivel == 1) {
- if (matrizcopia[i][j] == 0) {
- cout << " ";
- }
- if (matrizcopia[i][j] == 1) {
- Console::ForegroundColor = ConsoleColor::Yellow;
- cout << "*";
- }
- if (matrizcopia[i][j] == 2) {
- Console::ForegroundColor = ConsoleColor::Blue;
- cout << char(219);
- }
- }
- if (nivel == 2) {
- if (matrizcopia[i][j] == 1) {
- Console::ForegroundColor = ConsoleColor::Red;
- cout << "*";
- }
- if (matrizcopia[i][j] == 0) {
- cout << " ";
- }
- }
- }
- cout << "\n";
- }
- }
- typedef struct Nave {
- int _x, _y;
- public:
- Nave(int x, int y) {
- _x = x;
- _y = y;
- }
- int X() { return _x; }
- int Y() { return _y; }
- void animar(short tecla) {
- borrar();
- mover(tecla);
- dibujar();
- }
- void borrar() {
- Console::SetCursorPosition(_x, _y);
- cout << " ";
- Console::SetCursorPosition(_x - 1, _y + 1);
- cout << " ";
- Console::SetCursorPosition(_x + 1, _y + 1);
- cout << " ";
- Console::SetCursorPosition(_x - 1, _y + 1);
- cout << " ";
- Console::SetCursorPosition(_x, _y + 2);
- cout << " ";
- Console::SetCursorPosition(_x - 1, _y + 2);
- cout << " ";
- Console::SetCursorPosition(_x + 1, _y + 2);
- cout << " ";
- Console::SetCursorPosition(_x + 2, _y + 2);
- cout << " ";
- Console::SetCursorPosition(_x - 2, _y + 2);
- cout << " ";
- Console::SetCursorPosition(_x - 2, _y + 3);
- cout << " ";
- Console::SetCursorPosition(_x + 2, _y + 3);
- cout << " ";
- }
- void mover(short tecla) {
- short direccion;
- direccion = toupper(tecla);
- switch (direccion) {
- case 'W': if (_y - 1 >= 1) {
- _y--;
- break;
- }
- case 'S': if (_y + 4 <= 27) {
- _y++;
- break;
- }
- case 'A': if (_x - 2 >= 2) {
- _x--;
- break;
- }
- case 'D': if (_x + 3 <= 83) {
- _x++;
- break;
- }
- }
- }
- void dibujar() {
- Console::SetCursorPosition(_x, _y);
- Console::ForegroundColor = ConsoleColor::Green;
- cout << char(219);
- Console::SetCursorPosition(_x, _y + 1);
- Console::ForegroundColor = ConsoleColor::Blue;
- cout << char(219);
- Console::SetCursorPosition(_x + 1, _y + 1);
- Console::ForegroundColor = ConsoleColor::Green;
- cout << char(219);
- Console::SetCursorPosition(_x - 1, _y + 1);
- Console::ForegroundColor = ConsoleColor::Green;
- cout << char(219);
- Console::SetCursorPosition(_x, _y + 2);
- Console::ForegroundColor = ConsoleColor::Blue;
- cout << char(223);
- Console::SetCursorPosition(_x - 1, _y + 2);
- Console::ForegroundColor = ConsoleColor::Blue;
- cout << char(219);
- Console::SetCursorPosition(_x + 1, _y + 2);
- Console::ForegroundColor = ConsoleColor::Blue;
- cout << char(219);
- Console::SetCursorPosition(_x + 2, _y + 2);
- Console::ForegroundColor = ConsoleColor::Green;
- cout << char(219);
- Console::SetCursorPosition(_x - 2, _y + 2);
- Console::ForegroundColor = ConsoleColor::Green;
- cout << char(219);
- Console::SetCursorPosition(_x - 2, _y + 3);
- Console::ForegroundColor = ConsoleColor::Green;
- cout << char(223);
- Console::SetCursorPosition(_x + 2, _y + 3);
- Console::ForegroundColor = ConsoleColor::Green;
- cout << char(223);
- }
- };
- typedef struct NaveEnemiga {
- short _x, _y, _dx, _dy, _retraso;
- bool _colisiono = false;
- char _img;
- public:
- NaveEnemiga(short x, short y, short dx, short dy) {
- _x = x;
- _y = y;
- _dx = dx;
- _dy = dy;
- _retraso = 0;
- _img = (char)2;
- }
- int X() { return _x; }
- int Y() { return _y; }
- bool colisiono() { return _colisiono; }
- void marcar_colision() {
- _colisiono = true;
- }
- void animar() {
- if (_retraso == LIMITER) {
- borrar();
- mover();
- dibujar();
- _retraso = 0;
- }
- _retraso++;
- }
- void borrar() {
- Console::SetCursorPosition(_x, _y);
- cout << " ";
- }
- void mover() {
- if (_x + _dx < 1 || _x + _dx > 83) {
- _dx *= -1;
- _y++;
- }
- if (_y == 28) {
- _y = 1;
- }
- _x += _dx;
- }
- void dibujar() {
- if (!(_colisiono)) {
- Console::SetCursorPosition(_x, _y);
- Console::ForegroundColor = ConsoleColor::Green;
- cout << _img;
- }
- }
- };
- typedef struct Boss {
- short _x, _y, _dx, _dy, _retraso;
- bool _colisiono = false;
- char _img;
- public:
- Boss(short x, short y, short dx, short dy) {
- _x = x;
- _y = y;
- _dx = dx;
- _dy = dy;
- _retraso = 0;
- _img = (char)219;
- }
- int X() { return _x; }
- int Y() { return _y; }
- bool colisiono() { return _colisiono; }
- void marcar_colision() {
- _colisiono = true;
- }
- void animar() {
- if (_retraso == LIMITER) {
- borrar();
- mover();
- dibujar();
- _retraso = 0;
- }
- _retraso++;
- }
- void borrar() {
- Console::SetCursorPosition(_x, _y);
- cout << " ";
- Console::SetCursorPosition(_x + 1, _y);
- cout << " ";
- Console::SetCursorPosition(_x + 2, _y);
- cout << " ";
- Console::SetCursorPosition(_x + 3, _y);
- cout << " ";
- Console::SetCursorPosition(_x + 4, _y);
- cout << " ";
- Console::SetCursorPosition(_x + 5, _y);
- cout << " ";
- Console::SetCursorPosition(_x - 1, _y);
- cout << " ";
- Console::SetCursorPosition(_x - 2, _y);
- cout << " ";
- Console::SetCursorPosition(_x - 3, _y);
- cout << " ";
- Console::SetCursorPosition(_x - 4, _y);
- cout << " ";
- Console::SetCursorPosition(_x - 4, _y - 1);
- cout << " ";
- Console::SetCursorPosition(_x - 3, _y - 1);
- cout << " ";
- Console::SetCursorPosition(_x - 2, _y - 1);
- cout << " ";
- Console::SetCursorPosition(_x - 1, _y - 1);
- cout << " ";
- Console::SetCursorPosition(_x, _y - 1);
- cout << " ";
- Console::SetCursorPosition(_x + 1, _y - 1);
- cout << " ";
- Console::SetCursorPosition(_x + 2, _y - 1);
- cout << " ";
- Console::SetCursorPosition(_x + 3, _y - 1);
- cout << " ";
- Console::SetCursorPosition(_x + 4, _y - 1);
- cout << " ";
- Console::SetCursorPosition(_x + 5, _y - 1);
- cout << " ";
- Console::SetCursorPosition(_x + 5, _y - 2);
- cout << " ";
- Console::SetCursorPosition(_x + 4, _y - 2);
- cout << " ";
- Console::SetCursorPosition(_x + 3, _y - 2);
- cout << " ";
- Console::SetCursorPosition(_x + 2, _y - 2);
- cout << " ";
- Console::SetCursorPosition(_x + 1, _y - 2);
- cout << " ";
- Console::SetCursorPosition(_x, _y - 2);
- cout << " ";
- Console::SetCursorPosition(_x - 1, _y - 2);
- cout << " ";
- Console::SetCursorPosition(_x - 2, _y - 2);
- cout << " ";
- Console::SetCursorPosition(_x - 3, _y - 2);
- cout << " ";
- Console::SetCursorPosition(_x - 4, _y - 2);
- cout << " ";
- Console::SetCursorPosition(_x - 4, _y - 3);
- cout << " ";
- Console::SetCursorPosition(_x - 3, _y - 3);
- cout << " ";
- Console::SetCursorPosition(_x - 2, _y - 3);
- cout << " ";
- Console::SetCursorPosition(_x - 1, _y - 3);
- cout << " ";
- Console::SetCursorPosition(_x, _y - 3);
- cout << " ";
- Console::SetCursorPosition(_x + 1, _y - 3);;
- cout << " ";
- Console::SetCursorPosition(_x + 2, _y - 3);
- cout << " ";
- Console::SetCursorPosition(_x + 3, _y - 3);
- cout << " ";
- Console::SetCursorPosition(_x + 4, _y - 3);
- cout << " ";
- Console::SetCursorPosition(_x + 5, _y - 3);
- cout << " ";
- Console::SetCursorPosition(_x + 5, _y - 4);
- cout << " ";
- Console::SetCursorPosition(_x + 4, _y - 4);
- cout << " ";
- Console::SetCursorPosition(_x + 3, _y - 4);
- cout << " ";
- Console::SetCursorPosition(_x + 2, _y - 4);
- cout << " ";
- Console::SetCursorPosition(_x + 1, _y - 4);
- cout << " ";
- Console::SetCursorPosition(_x, _y - 4);
- cout << " ";
- Console::SetCursorPosition(_x - 1, _y - 4);
- cout << " ";
- Console::SetCursorPosition(_x - 2, _y - 4);
- cout << " ";
- Console::SetCursorPosition(_x - 3, _y - 4);;
- cout << " ";
- Console::SetCursorPosition(_x - 4, _y - 4);
- cout << " ";
- Console::SetCursorPosition(_x - 4, _y - 5);
- cout << " ";
- Console::SetCursorPosition(_x - 3, _y - 5);
- cout << " ";
- Console::SetCursorPosition(_x - 2, _y - 5);
- cout << " ";
- Console::SetCursorPosition(_x - 1, _y - 5);
- cout << " ";
- Console::SetCursorPosition(_x, _y - 5);
- cout << " ";
- Console::SetCursorPosition(_x + 1, _y - 5);
- cout << " ";
- Console::SetCursorPosition(_x + 2, _y - 5);
- cout << " ";
- Console::SetCursorPosition(_x + 3, _y - 5);
- cout << " ";
- Console::SetCursorPosition(_x + 4, _y - 5);
- cout << " ";
- Console::SetCursorPosition(_x + 5, _y - 5);
- cout << " ";
- Console::SetCursorPosition(_x + 5, _y - 6);
- cout << " ";
- Console::SetCursorPosition(_x + 4, _y - 6);
- cout << " ";
- Console::SetCursorPosition(_x + 3, _y - 6);
- cout << " ";
- Console::SetCursorPosition(_x + 2, _y - 6);
- cout << " ";
- Console::SetCursorPosition(_x + 1, _y - 6);
- cout << " ";
- Console::SetCursorPosition(_x, _y - 6);
- cout << " ";
- Console::SetCursorPosition(_x - 1, _y - 6);
- cout << " ";
- Console::SetCursorPosition(_x - 2, _y - 6);
- cout << " ";
- Console::SetCursorPosition(_x - 3, _y - 6);
- cout << " ";
- Console::SetCursorPosition(_x - 4, _y - 6);
- cout << " ";
- Console::SetCursorPosition(_x + 5, _y - 7);
- cout << " ";
- Console::SetCursorPosition(_x + 4, _y - 7);
- cout << " ";
- Console::SetCursorPosition(_x + 3, _y - 7);
- cout << " ";
- Console::SetCursorPosition(_x + 2, _y - 7);
- cout << " ";
- Console::SetCursorPosition(_x + 1, _y - 7);
- cout << " ";
- Console::SetCursorPosition(_x, _y - 7);
- cout << " ";
- Console::SetCursorPosition(_x - 1, _y - 7);
- cout << " ";
- Console::SetCursorPosition(_x - 2, _y - 7);
- cout << " ";
- Console::SetCursorPosition(_x - 3, _y - 7);
- cout << " ";
- Console::SetCursorPosition(_x - 4, _y - 7);
- cout << " ";
- Console::SetCursorPosition(_x + 6, _y - 1);
- cout << " ";
- Console::SetCursorPosition(_x + 6, _y - 2);
- cout << " ";
- Console::SetCursorPosition(_x + 7, _y - 1);
- cout << " ";
- Console::SetCursorPosition(_x + 7, _y - 2);
- cout << " ";
- Console::SetCursorPosition(_x + 8, _y - 2);
- cout << " ";
- Console::SetCursorPosition(_x + 9, _y - 2);
- cout << " ";
- Console::SetCursorPosition(_x + 8, _y - 3);
- cout << " ";
- Console::SetCursorPosition(_x + 9, _y - 3);
- cout << " ";
- Console::SetCursorPosition(_x + 10, _y - 3);
- cout << " ";
- Console::SetCursorPosition(_x + 11, _y - 3);
- cout << " ";
- Console::SetCursorPosition(_x + 10, _y - 4);
- cout << " ";
- Console::SetCursorPosition(_x + 11, _y - 4);
- cout << " ";
- Console::SetCursorPosition(_x + 12, _y - 4);
- cout << " ";
- Console::SetCursorPosition(_x + 13, _y - 4);
- cout << " ";
- Console::SetCursorPosition(_x + 12, _y - 5);
- cout << " ";
- Console::SetCursorPosition(_x + 13, _y - 5);
- cout << " ";
- Console::SetCursorPosition(_x + 14, _y - 5);
- cout << " ";
- Console::SetCursorPosition(_x + 15, _y - 5);
- cout << " ";
- Console::SetCursorPosition(_x + 14, _y - 6);
- cout << " ";
- Console::SetCursorPosition(_x + 15, _y - 6);
- cout << " ";
- Console::SetCursorPosition(_x - 5, _y - 1);
- cout << " ";
- Console::SetCursorPosition(_x - 6, _y - 1);
- cout << " ";
- Console::SetCursorPosition(_x - 5, _y - 2);
- cout << " ";
- Console::SetCursorPosition(_x - 6, _y - 2);
- cout << " ";
- Console::SetCursorPosition(_x - 7, _y - 2);
- cout << " ";
- Console::SetCursorPosition(_x - 8, _y - 2);
- cout << " ";
- Console::SetCursorPosition(_x - 7, _y - 3);
- cout << " ";
- Console::SetCursorPosition(_x - 8, _y - 3);
- cout << " ";
- Console::SetCursorPosition(_x - 9, _y - 3);
- cout << " ";
- Console::SetCursorPosition(_x - 10, _y - 3);
- cout << " ";
- Console::SetCursorPosition(_x - 9, _y - 4);
- cout << " ";
- Console::SetCursorPosition(_x - 10, _y - 4);
- cout << " ";
- Console::SetCursorPosition(_x - 11, _y - 4);
- cout << " ";
- Console::SetCursorPosition(_x - 12, _y - 4);
- cout << " ";
- Console::SetCursorPosition(_x - 11, _y - 5);
- cout << " ";
- Console::SetCursorPosition(_x - 12, _y - 5);
- cout << " ";
- Console::SetCursorPosition(_x - 13, _y - 5);
- cout << " ";
- Console::SetCursorPosition(_x - 14, _y - 5);
- cout << " ";
- Console::SetCursorPosition(_x - 13, _y - 6);
- cout << " ";
- Console::SetCursorPosition(_x - 14, _y - 6);
- cout << " ";
- }
- void mover() {
- if ((_x - 14) + _dx < 1 || (_x + 15) + _dx > 83) {
- _dx *= -1;
- }
- _x += _dx;
- }
- void dibujar() {
- if (!(_colisiono)) {
- Console::SetCursorPosition(_x, _y);
- Console::ForegroundColor = ConsoleColor::Yellow;
- cout << _img;
- Console::SetCursorPosition(_x + 1, _y);
- Console::ForegroundColor = ConsoleColor::Yellow;
- cout << _img;
- Console::SetCursorPosition(_x + 2, _y);
- Console::ForegroundColor = ConsoleColor::Yellow;
- cout << _img;
- Console::SetCursorPosition(_x + 3, _y);
- Console::ForegroundColor = ConsoleColor::Yellow;
- cout << _img;
- Console::SetCursorPosition(_x + 4, _y);
- Console::ForegroundColor = ConsoleColor::Yellow;
- cout << _img;
- Console::SetCursorPosition(_x + 5, _y);
- Console::ForegroundColor = ConsoleColor::Yellow;
- cout << _img;
- Console::SetCursorPosition(_x - 1, _y);
- Console::ForegroundColor = ConsoleColor::Yellow;
- cout << _img;
- Console::SetCursorPosition(_x - 2, _y);
- Console::ForegroundColor = ConsoleColor::Yellow;
- cout << _img;
- Console::SetCursorPosition(_x - 3, _y);
- Console::ForegroundColor = ConsoleColor::Yellow;
- cout << _img;
- Console::SetCursorPosition(_x - 4, _y);
- Console::ForegroundColor = ConsoleColor::Yellow;
- cout << _img;
- Console::SetCursorPosition(_x - 4, _y - 1);
- Console::ForegroundColor = ConsoleColor::Yellow;
- cout << _img;
- Console::SetCursorPosition(_x - 3, _y - 1);
- Console::ForegroundColor = ConsoleColor::Yellow;
- cout << _img;
- Console::SetCursorPosition(_x - 2, _y - 1);
- Console::ForegroundColor = ConsoleColor::Red;
- cout << _img;
- Console::SetCursorPosition(_x - 1, _y - 1);
- Console::ForegroundColor = ConsoleColor::Red;
- cout << _img;
- Console::SetCursorPosition(_x, _y - 1);
- Console::ForegroundColor = ConsoleColor::Yellow;
- cout << _img;
- Console::SetCursorPosition(_x + 1, _y - 1);
- Console::ForegroundColor = ConsoleColor::Yellow;
- cout << _img;
- Console::SetCursorPosition(_x + 2, _y - 1);
- Console::ForegroundColor = ConsoleColor::Red;
- cout << _img;
- Console::SetCursorPosition(_x + 3, _y - 1);
- Console::ForegroundColor = ConsoleColor::Red;
- cout << _img;
- Console::SetCursorPosition(_x + 4, _y - 1);
- Console::ForegroundColor = ConsoleColor::Yellow;
- cout << _img;
- Console::SetCursorPosition(_x + 5, _y - 1);
- Console::ForegroundColor = ConsoleColor::Yellow;
- cout << _img;
- Console::SetCursorPosition(_x + 5, _y - 2);
- Console::ForegroundColor = ConsoleColor::Yellow;
- cout << _img;
- Console::SetCursorPosition(_x + 4, _y - 2);
- Console::ForegroundColor = ConsoleColor::Yellow;
- cout << _img;
- Console::SetCursorPosition(_x + 3, _y - 2);
- Console::ForegroundColor = ConsoleColor::Red;
- cout << _img;
- Console::SetCursorPosition(_x + 2, _y - 2);
- Console::ForegroundColor = ConsoleColor::Red;
- cout << _img;
- Console::SetCursorPosition(_x + 1, _y - 2);
- Console::ForegroundColor = ConsoleColor::Yellow;
- cout << _img;
- Console::SetCursorPosition(_x, _y - 2);
- Console::ForegroundColor = ConsoleColor::Yellow;
- cout << _img;
- Console::SetCursorPosition(_x - 1, _y - 2);
- Console::ForegroundColor = ConsoleColor::Red;
- cout << _img;
- Console::SetCursorPosition(_x - 2, _y - 2);
- Console::ForegroundColor = ConsoleColor::Red;
- cout << _img;
- Console::SetCursorPosition(_x - 3, _y - 2);
- Console::ForegroundColor = ConsoleColor::Yellow;
- cout << _img;
- Console::SetCursorPosition(_x - 4, _y - 2);
- Console::ForegroundColor = ConsoleColor::Yellow;
- cout << _img;
- Console::SetCursorPosition(_x - 4, _y - 3);
- Console::ForegroundColor = ConsoleColor::Yellow;
- cout << _img;
- Console::SetCursorPosition(_x - 3, _y - 3);
- Console::ForegroundColor = ConsoleColor::Yellow;
- cout << _img;
- Console::SetCursorPosition(_x - 2, _y - 3);
- Console::ForegroundColor = ConsoleColor::Yellow;
- cout << _img;
- Console::SetCursorPosition(_x - 1, _y - 3);
- Console::ForegroundColor = ConsoleColor::Yellow;
- cout << _img;
- Console::SetCursorPosition(_x, _y - 3);
- Console::ForegroundColor = ConsoleColor::Yellow;
- cout << _img;
- Console::SetCursorPosition(_x + 1, _y - 3);
- Console::ForegroundColor = ConsoleColor::Yellow;
- cout << _img;
- Console::SetCursorPosition(_x + 2, _y - 3);
- Console::ForegroundColor = ConsoleColor::Yellow;
- cout << _img;
- Console::SetCursorPosition(_x + 3, _y - 3);
- Console::ForegroundColor = ConsoleColor::Yellow;
- cout << _img;
- Console::SetCursorPosition(_x + 4, _y - 3);
- Console::ForegroundColor = ConsoleColor::Yellow;
- cout << _img;
- Console::SetCursorPosition(_x + 5, _y - 3);
- Console::ForegroundColor = ConsoleColor::Yellow;
- cout << _img;
- Console::SetCursorPosition(_x + 5, _y - 4);
- Console::ForegroundColor = ConsoleColor::Yellow;
- cout << _img;
- Console::SetCursorPosition(_x + 4, _y - 4);
- Console::ForegroundColor = ConsoleColor::Yellow;
- cout << _img;
- Console::SetCursorPosition(_x + 3, _y - 4);
- Console::ForegroundColor = ConsoleColor::Yellow;
- cout << _img;
- Console::SetCursorPosition(_x + 2, _y - 4);
- Console::ForegroundColor = ConsoleColor::Yellow;
- cout << _img;
- Console::SetCursorPosition(_x + 1, _y - 4);
- Console::ForegroundColor = ConsoleColor::Yellow;
- cout << _img;
- Console::SetCursorPosition(_x, _y - 4);
- Console::ForegroundColor = ConsoleColor::Yellow;
- cout << _img;
- Console::SetCursorPosition(_x - 1, _y - 4);
- Console::ForegroundColor = ConsoleColor::Yellow;
- cout << _img;
- Console::SetCursorPosition(_x - 2, _y - 4);
- Console::ForegroundColor = ConsoleColor::Yellow;
- cout << _img;
- Console::SetCursorPosition(_x - 3, _y - 4);
- Console::ForegroundColor = ConsoleColor::Yellow;
- cout << _img;
- Console::SetCursorPosition(_x - 4, _y - 4);
- Console::ForegroundColor = ConsoleColor::Yellow;
- cout << _img;
- Console::SetCursorPosition(_x - 4, _y - 5);
- Console::ForegroundColor = ConsoleColor::Yellow;
- cout << _img;
- Console::SetCursorPosition(_x - 3, _y - 5);
- Console::ForegroundColor = ConsoleColor::Yellow;
- cout << _img;
- Console::SetCursorPosition(_x - 2, _y - 5);
- Console::ForegroundColor = ConsoleColor::Red;
- cout << _img;
- Console::SetCursorPosition(_x - 1, _y - 5);
- Console::ForegroundColor = ConsoleColor::Red;
- cout << _img;
- Console::SetCursorPosition(_x, _y - 5);
- Console::ForegroundColor = ConsoleColor::Red;
- cout << _img;
- Console::SetCursorPosition(_x + 1, _y - 5);
- Console::ForegroundColor = ConsoleColor::Red;
- cout << _img;
- Console::SetCursorPosition(_x + 2, _y - 5);
- Console::ForegroundColor = ConsoleColor::Red;
- cout << _img;
- Console::SetCursorPosition(_x + 3, _y - 5);
- Console::ForegroundColor = ConsoleColor::Red;
- cout << _img;
- Console::SetCursorPosition(_x + 4, _y - 5);
- Console::ForegroundColor = ConsoleColor::Yellow;
- cout << _img;
- Console::SetCursorPosition(_x + 5, _y - 5);
- Console::ForegroundColor = ConsoleColor::Yellow;
- cout << _img;
- Console::SetCursorPosition(_x + 5, _y - 6);
- Console::ForegroundColor = ConsoleColor::Yellow;
- cout << _img;
- Console::SetCursorPosition(_x + 4, _y - 6);
- Console::ForegroundColor = ConsoleColor::Yellow;
- cout << _img;
- Console::SetCursorPosition(_x + 3, _y - 6);
- Console::ForegroundColor = ConsoleColor::Red;
- cout << _img;
- Console::SetCursorPosition(_x + 2, _y - 6);
- Console::ForegroundColor = ConsoleColor::Red;
- cout << _img;
- Console::SetCursorPosition(_x + 1, _y - 6);
- Console::ForegroundColor = ConsoleColor::Red;
- cout << _img;
- Console::SetCursorPosition(_x, _y - 6);
- Console::ForegroundColor = ConsoleColor::Red;
- cout << _img;
- Console::SetCursorPosition(_x - 1, _y - 6);
- Console::ForegroundColor = ConsoleColor::Red;
- cout << _img;
- Console::SetCursorPosition(_x - 2, _y - 6);
- Console::ForegroundColor = ConsoleColor::Red;
- cout << _img;
- Console::SetCursorPosition(_x - 3, _y - 6);
- Console::ForegroundColor = ConsoleColor::Yellow;
- cout << _img;
- Console::SetCursorPosition(_x - 4, _y - 6);
- Console::ForegroundColor = ConsoleColor::Yellow;
- cout << _img;
- Console::SetCursorPosition(_x + 5, _y - 7);
- Console::ForegroundColor = ConsoleColor::Yellow;
- cout << _img;
- Console::SetCursorPosition(_x + 4, _y - 7);
- Console::ForegroundColor = ConsoleColor::Yellow;
- cout << _img;
- Console::SetCursorPosition(_x + 3, _y - 7);
- Console::ForegroundColor = ConsoleColor::Yellow;
- cout << _img;
- Console::SetCursorPosition(_x + 2, _y - 7);
- Console::ForegroundColor = ConsoleColor::Yellow;
- cout << _img;
- Console::SetCursorPosition(_x + 1, _y - 7);
- Console::ForegroundColor = ConsoleColor::Yellow;
- cout << _img;
- Console::SetCursorPosition(_x, _y - 7);
- Console::ForegroundColor = ConsoleColor::Yellow;
- cout << _img;
- Console::SetCursorPosition(_x - 1, _y - 7);
- Console::ForegroundColor = ConsoleColor::Yellow;
- cout << _img;
- Console::SetCursorPosition(_x - 2, _y - 7);
- Console::ForegroundColor = ConsoleColor::Yellow;
- cout << _img;
- Console::SetCursorPosition(_x - 3, _y - 7);
- Console::ForegroundColor = ConsoleColor::Yellow;
- cout << _img;
- Console::SetCursorPosition(_x - 4, _y - 7);
- Console::ForegroundColor = ConsoleColor::Yellow;
- cout << _img;
- Console::SetCursorPosition(_x + 6, _y - 1);
- Console::ForegroundColor = ConsoleColor::Yellow;
- cout << _img;
- Console::SetCursorPosition(_x + 6, _y - 2);
- Console::ForegroundColor = ConsoleColor::Yellow;
- cout << _img;
- Console::SetCursorPosition(_x + 7, _y - 1);
- Console::ForegroundColor = ConsoleColor::Yellow;
- cout << _img;
- Console::SetCursorPosition(_x + 7, _y - 2);
- Console::ForegroundColor = ConsoleColor::Yellow;
- cout << _img;
- Console::SetCursorPosition(_x + 8, _y - 2);
- Console::ForegroundColor = ConsoleColor::Yellow;
- cout << _img;
- Console::SetCursorPosition(_x + 9, _y - 2);
- Console::ForegroundColor = ConsoleColor::Yellow;
- cout << _img;
- Console::SetCursorPosition(_x + 8, _y - 3);
- Console::ForegroundColor = ConsoleColor::Yellow;
- cout << _img;
- Console::SetCursorPosition(_x + 9, _y - 3);
- Console::ForegroundColor = ConsoleColor::Yellow;
- cout << _img;
- Console::SetCursorPosition(_x + 10, _y - 3);
- Console::ForegroundColor = ConsoleColor::Yellow;
- cout << _img;
- Console::SetCursorPosition(_x + 11, _y - 3);
- Console::ForegroundColor = ConsoleColor::Yellow;
- cout << _img;
- Console::SetCursorPosition(_x + 10, _y - 4);
- Console::ForegroundColor = ConsoleColor::Yellow;
- cout << _img;
- Console::SetCursorPosition(_x + 11, _y - 4);
- Console::ForegroundColor = ConsoleColor::Yellow;
- cout << _img;
- Console::SetCursorPosition(_x + 12, _y - 4);
- Console::ForegroundColor = ConsoleColor::Yellow;
- cout << _img;
- Console::SetCursorPosition(_x + 13, _y - 4);
- Console::ForegroundColor = ConsoleColor::Yellow;
- cout << _img;
- Console::SetCursorPosition(_x + 12, _y - 5);
- Console::ForegroundColor = ConsoleColor::Yellow;
- cout << _img;
- Console::SetCursorPosition(_x + 13, _y - 5);
- Console::ForegroundColor = ConsoleColor::Yellow;
- cout << _img;
- Console::SetCursorPosition(_x + 14, _y - 5);
- Console::ForegroundColor = ConsoleColor::Yellow;
- cout << _img;
- Console::SetCursorPosition(_x + 15, _y - 5);
- Console::ForegroundColor = ConsoleColor::Yellow;
- cout << _img;
- Console::SetCursorPosition(_x + 14, _y - 6);
- Console::ForegroundColor = ConsoleColor::Yellow;
- cout << _img;
- Console::SetCursorPosition(_x + 15, _y - 6);
- Console::ForegroundColor = ConsoleColor::Yellow;
- cout << _img;
- Console::SetCursorPosition(_x - 5, _y - 1);
- Console::ForegroundColor = ConsoleColor::Yellow;
- cout << _img;
- Console::SetCursorPosition(_x - 6, _y - 1);
- Console::ForegroundColor = ConsoleColor::Yellow;
- cout << _img;
- Console::SetCursorPosition(_x - 5, _y - 2);
- Console::ForegroundColor = ConsoleColor::Yellow;
- cout << _img;
- Console::SetCursorPosition(_x - 6, _y - 2);
- Console::ForegroundColor = ConsoleColor::Yellow;
- cout << _img;
- Console::SetCursorPosition(_x - 7, _y - 2);
- Console::ForegroundColor = ConsoleColor::Yellow;
- cout << _img;
- Console::SetCursorPosition(_x - 8, _y - 2);
- Console::ForegroundColor = ConsoleColor::Yellow;
- cout << _img;
- Console::SetCursorPosition(_x - 7, _y - 3);
- Console::ForegroundColor = ConsoleColor::Yellow;
- cout << _img;
- Console::SetCursorPosition(_x - 8, _y - 3);
- Console::ForegroundColor = ConsoleColor::Yellow;
- cout << _img;
- Console::SetCursorPosition(_x - 9, _y - 3);
- Console::ForegroundColor = ConsoleColor::Yellow;
- cout << _img;
- Console::SetCursorPosition(_x - 10, _y - 3);
- Console::ForegroundColor = ConsoleColor::Yellow;
- cout << _img;
- Console::SetCursorPosition(_x - 9, _y - 4);
- Console::ForegroundColor = ConsoleColor::Yellow;
- cout << _img;
- Console::SetCursorPosition(_x - 10, _y -4);
- Console::ForegroundColor = ConsoleColor::Yellow;
- cout << _img;
- Console::SetCursorPosition(_x - 11, _y - 4);
- Console::ForegroundColor = ConsoleColor::Yellow;
- cout << _img;
- Console::SetCursorPosition(_x - 12, _y - 4);
- Console::ForegroundColor = ConsoleColor::Yellow;
- cout << _img;
- Console::SetCursorPosition(_x - 11, _y - 5);
- Console::ForegroundColor = ConsoleColor::Yellow;
- cout << _img;
- Console::SetCursorPosition(_x - 12, _y - 5);
- Console::ForegroundColor = ConsoleColor::Yellow;
- cout << _img;
- Console::SetCursorPosition(_x - 13, _y - 5);
- Console::ForegroundColor = ConsoleColor::Yellow;
- cout << _img;
- Console::SetCursorPosition(_x - 14, _y - 5);
- Console::ForegroundColor = ConsoleColor::Yellow;
- cout << _img;
- Console::SetCursorPosition(_x - 13, _y - 6);
- Console::ForegroundColor = ConsoleColor::Yellow;
- cout << _img;
- Console::SetCursorPosition(_x - 14, _y - 6);
- Console::ForegroundColor = ConsoleColor::Yellow;
- cout << _img;
- }
- }
- };
- typedef struct Nave2 {
- int _x, _y;
- public:
- Nave2(int x, int y) {
- _x = x;
- _y = y;
- }
- int X() { return _x; }
- int Y() { return _y; }
- void animar(short tecla) {
- borrar();
- mover(tecla);
- dibujar();
- }
- void borrar() {
- Console::SetCursorPosition(_x, _y);
- cout << " ";
- Console::SetCursorPosition(_x - 1, _y + 1);
- cout << " ";
- Console::SetCursorPosition(_x + 1, _y + 1);
- cout << " ";
- Console::SetCursorPosition(_x - 1, _y + 1);
- cout << " ";
- Console::SetCursorPosition(_x, _y + 2);
- cout << " ";
- Console::SetCursorPosition(_x - 1, _y + 2);
- cout << " ";
- Console::SetCursorPosition(_x + 1, _y + 2);
- cout << " ";
- Console::SetCursorPosition(_x + 2, _y + 2);
- cout << " ";
- Console::SetCursorPosition(_x - 2, _y + 2);
- cout << " ";
- Console::SetCursorPosition(_x - 2, _y + 3);
- cout << " ";
- Console::SetCursorPosition(_x + 2, _y + 3);
- cout << " ";
- }
- void mover(short tecla) {
- switch (tecla) {
- case ARRIBA: if (_y - 1 >= 1) _y--; break;
- case ABAJO: if (_y + 4 <= 27) _y++; break;
- case IZQUIERDA: if (_x - 2 >= 2) _x--; break;
- case DERECHA: if (_x + 3 <= 83) _x++; break;
- }
- }
- void dibujar() {
- Console::SetCursorPosition(_x, _y);
- Console::ForegroundColor = ConsoleColor::White;
- cout << char(219);
- Console::SetCursorPosition(_x, _y + 1);
- Console::ForegroundColor = ConsoleColor::Red;
- cout << char(219);
- Console::SetCursorPosition(_x + 1, _y + 1);
- Console::ForegroundColor = ConsoleColor::White;
- cout << char(219);
- Console::SetCursorPosition(_x - 1, _y + 1);
- Console::ForegroundColor = ConsoleColor::White;
- cout << char(219);
- Console::SetCursorPosition(_x, _y + 2);
- Console::ForegroundColor = ConsoleColor::Red;
- cout << char(223);
- Console::SetCursorPosition(_x - 1, _y + 2);
- Console::ForegroundColor = ConsoleColor::Red;
- cout << char(219);
- Console::SetCursorPosition(_x + 1, _y + 2);
- Console::ForegroundColor = ConsoleColor::Red;
- cout << char(219);
- Console::SetCursorPosition(_x + 2, _y + 2);
- Console::ForegroundColor = ConsoleColor::White;
- cout << char(219);
- Console::SetCursorPosition(_x - 2, _y + 2);
- Console::ForegroundColor = ConsoleColor::White;
- cout << char(219);
- Console::SetCursorPosition(_x - 2, _y + 3);
- Console::ForegroundColor = ConsoleColor::White;
- cout << char(223);
- Console::SetCursorPosition(_x + 2, _y + 3);
- Console::ForegroundColor = ConsoleColor::White;
- cout << char(223);
- }
- };
- typedef struct BALA {
- int _x, _y;
- public:
- BALA(int x, int y) {
- _x = x;
- _y = y;
- }
- int X() { return _x; }
- int Y() { return _y; }
- void mover() {
- Console::SetCursorPosition(_x, _y);
- cout << " ";
- _y--;
- Console::SetCursorPosition(_x, _y);
- Console::ForegroundColor = ConsoleColor::Blue;
- cout << "*";
- }
- bool fuera() {
- if (_y == 1) return true;
- return false;
- }
- };
- void MatrizNivel1() {
- int nivel;
- system("cls");
- copiasmatriz(nivel = 2);
- imprimirmatriz(nivel = 2);
- Console::SetCursorPosition(9, 8);
- Console::ForegroundColor = ConsoleColor::Yellow;
- cout << "** ** ** ** ** ********** *** ******" << endl;
- Console::SetCursorPosition(9, 9);
- Console::ForegroundColor = ConsoleColor::Yellow;
- cout << "**** ** ** ** ** ********** *** *******" << endl;
- Console::SetCursorPosition(9, 10);
- Console::ForegroundColor = ConsoleColor::Yellow;
- cout << "**** ** ** ** ** ** *** *** ****" << endl;
- Console::SetCursorPosition(9, 11);
- Console::ForegroundColor = ConsoleColor::Yellow;
- cout << "** ** ** ** ** ** ** *** *** ****" << endl;
- Console::SetCursorPosition(9, 12);
- Console::ForegroundColor = ConsoleColor::Yellow;
- cout << "** ** ** ** ** ** ********** *** ****" << endl;
- Console::SetCursorPosition(9, 13);
- Console::ForegroundColor = ConsoleColor::Yellow;
- cout << "** ** ** ** ** ** ********** *** ****" << endl;
- Console::SetCursorPosition(9, 14);
- Console::ForegroundColor = ConsoleColor::Yellow;
- cout << "** ** ** ** ** ** ** *** ****" << endl;
- Console::SetCursorPosition(9, 15);
- Console::ForegroundColor = ConsoleColor::Yellow;
- cout << "** **** ** ** ** ** *** ****" << endl;
- Console::SetCursorPosition(9, 16);
- Console::ForegroundColor = ConsoleColor::Yellow;
- cout << "** **** ** **** ********** *********** ****" << endl;
- Console::SetCursorPosition(9, 17);
- Console::ForegroundColor = ConsoleColor::Yellow;
- cout << "** ** ** **** ********** *********** ****" << endl;
- }
- void MatrizNivel2() {
- int nivel;
- system("cls");
- copiasmatriz(nivel = 2);
- imprimirmatriz(nivel = 2);
- Console::SetCursorPosition(9, 8);
- Console::ForegroundColor = ConsoleColor::Yellow;
- cout << "** ** ** ** ** ********** *** **********" << endl;
- Console::SetCursorPosition(9, 9);
- Console::ForegroundColor = ConsoleColor::Yellow;
- cout << "**** ** ** ** ** ********** *** ***********" << endl;
- Console::SetCursorPosition(9, 10);
- Console::ForegroundColor = ConsoleColor::Yellow;
- cout << "**** ** ** ** ** ** *** *** ****" << endl;
- Console::SetCursorPosition(9, 11);
- Console::ForegroundColor = ConsoleColor::Yellow;
- cout << "** ** ** ** ** ** ** *** *** **** " << endl;
- Console::SetCursorPosition(9, 12);
- Console::ForegroundColor = ConsoleColor::Yellow;
- cout << "** ** ** ** ** ** ********** *** **** " << endl;
- Console::SetCursorPosition(9, 13);
- Console::ForegroundColor = ConsoleColor::Yellow;
- cout << "** ** ** ** ** ** ********** *** **** " << endl;
- Console::SetCursorPosition(9, 14);
- Console::ForegroundColor = ConsoleColor::Yellow;
- cout << "** ** ** ** ** ** ** *** **** " << endl;
- Console::SetCursorPosition(9, 15);
- Console::ForegroundColor = ConsoleColor::Yellow;
- cout << "** **** ** ** ** ** *** **** " << endl;
- Console::SetCursorPosition(9, 16);
- Console::ForegroundColor = ConsoleColor::Yellow;
- cout << "** **** ** **** ********** *********** ************" << endl;
- Console::SetCursorPosition(9, 17);
- Console::ForegroundColor = ConsoleColor::Yellow;
- cout << "** ** ** **** ********** *********** ************" << endl;
- }
- void MatrizNivel3() {
- int nivel;
- system("cls");
- copiasmatriz(nivel = 2);
- imprimirmatriz(nivel = 2);
- Console::SetCursorPosition(9, 8);
- Console::ForegroundColor = ConsoleColor::Yellow;
- cout << "** ** ** ** ** ********** *** ************" << endl;
- Console::SetCursorPosition(9, 9);
- Console::ForegroundColor = ConsoleColor::Yellow;
- cout << "**** ** ** ** ** ********** *** ************" << endl;
- Console::SetCursorPosition(9, 10);
- Console::ForegroundColor = ConsoleColor::Yellow;
- cout << "**** ** ** ** ** ** *** ***" << endl;
- Console::SetCursorPosition(9, 11);
- Console::ForegroundColor = ConsoleColor::Yellow;
- cout << "** ** ** ** ** ** ** *** ***" << endl;
- Console::SetCursorPosition(9, 12);
- Console::ForegroundColor = ConsoleColor::Yellow;
- cout << "** ** ** ** ** ** ********** *** ************" << endl;
- Console::SetCursorPosition(9, 13);
- Console::ForegroundColor = ConsoleColor::Yellow;
- cout << "** ** ** ** ** ** ********** *** ************" << endl;
- Console::SetCursorPosition(9, 14);
- Console::ForegroundColor = ConsoleColor::Yellow;
- cout << "** ** ** ** ** ** ** *** ***" << endl;
- Console::SetCursorPosition(9, 15);
- Console::ForegroundColor = ConsoleColor::Yellow;
- cout << "** **** ** ** ** ** *** ***" << endl;
- Console::SetCursorPosition(9, 16);
- Console::ForegroundColor = ConsoleColor::Yellow;
- cout << "** **** ** **** ********** *********** ************" << endl;
- Console::SetCursorPosition(9, 17);
- Console::ForegroundColor = ConsoleColor::Yellow;
- cout << "** ** ** **** ********** *********** ************" << endl;
- }
- int jugar(int players) {
- int puntos = 0;
- int contadornivel1 = 0;
- bool gameover = false;
- int cantidadEnemigos = 28;
- //BALAS de nave1
- list<BALA*> B;
- list<BALA*> ::iterator it2;
- //BALAS de nave 2
- list<BALA*>B2;
- list<BALA*> ::iterator it3;
- //ENEMIGOS
- list<NaveEnemiga*> E;
- list<NaveEnemiga*>::iterator it;
- //CREA ENEMIGOS
- for (int i = 0; i < cantidadEnemigos; i++)
- {
- E.push_back(new NaveEnemiga(2+rand()%79, 2+rand()%9, -1, +1));
- }
- //CREA HEROES
- Nave nave1 = Nave(40, 20);
- Nave nave3 = Nave(30, 20);
- Nave2 nave2 = Nave2(55, 20);
- //JUEGO
- while (!(gameover)) {
- //puntos
- Console::SetCursorPosition(89, 3);
- Console::ForegroundColor = ConsoleColor::Yellow;
- cout << "Puntos: " << puntos;
- //Lee la tecla presionada y genera valores en las listas
- if (kbhit()) {
- if (players == 1) {
- char tecla = getch();
- nave1.animar(tecla);
- if (tecla == DISPARO)
- B.push_back(new BALA(nave1.X(), nave1.Y() - 1));
- }
- else if (players == 2) {
- char tecla = getch();
- nave3.animar(tecla);
- if (tecla == DISPARO)
- B.push_back(new BALA(nave3.X(), nave3.Y() - 1));
- nave2.animar(tecla);
- if (tecla == DISPARO2)
- B2.push_back(new BALA(nave2.X(), nave2.Y() - 1));
- }
- }
- //Imprime , mueve y borra las balas nave1 y nave 3(mueve con awsd)
- for (it2 = B.begin(); it2 != B.end();) {
- (*it2)->mover();
- if ((*it2)->fuera()) {
- Console::SetCursorPosition((*it2)->X(), (*it2)->Y());
- cout << " ";
- delete(*it2);
- //da un valor de la lista al eliminado
- it2 = B.erase(it2);
- }
- else {
- it2++;
- }
- }
- //Imprime , mueve y borra las balas de nave2(mueve con flechitas)
- for (it3 = B2.begin(); it3 != B2.end();) {
- (*it3)->mover();
- if ((*it3)->fuera()) {
- Console::SetCursorPosition((*it3)->X(), (*it3)->Y());
- cout << " ";
- delete(*it3);
- //da un valor de la lista al eliminado
- it3 = B2.erase(it3);
- }
- else {
- it3++;
- }
- }
- //Imprime a los enemigos
- for (it = E.begin(); it != E.end(); it++) {
- (*it)->animar();
- }
- //Balas de nave 1 y nave 3 que eliminan enemigos
- for (it = E.begin(); it != E.end(); it++) {
- for (it2 = B.begin(); it2 != B.end();)
- {
- if ((*it)->X() == (*it2)->X() && ((*it)->Y() == (*it2)->Y() || (*it)->Y() + 1 == (*it2)->Y()) && !((*it)->colisiono())) {
- Console::SetCursorPosition((*it2)->X(), (*it2)->Y());
- cout << " ";
- delete(*it2);
- it2 = B.erase(it2);
- Console::SetCursorPosition((*it)->X(), (*it)->Y());
- cout << " ";
- (*it)->marcar_colision();
- puntos += 5;
- contadornivel1 += 1;
- }
- else { it2++; }
- }
- }
- //Balas de nave 2 que eliminan enemigos
- for (it = E.begin(); it != E.end(); it++) {
- for (it3 = B2.begin(); it3 != B2.end();)
- {
- if ((*it)->X() == (*it3)->X() && ((*it)->Y() == (*it3)->Y() || (*it)->Y() + 1 == (*it3)->Y()) && !((*it)->colisiono())) {
- Console::SetCursorPosition((*it3)->X(), (*it3)->Y());
- cout << " ";
- delete(*it3);
- it3 = B2.erase(it3);
- Console::SetCursorPosition((*it)->X(), (*it)->Y());
- cout << " ";
- (*it)->marcar_colision();
- puntos += 5;
- contadornivel1 += 1;
- }
- else { it3++; }
- }
- }
- _sleep(10);
- if (contadornivel1 == cantidadEnemigos) {
- gameover = true;
- }
- }
- //devuelve puntos
- return puntos;
- }
- int jugar2(int players, int puntosacumulados) {
- int contadornivel2 = 0;
- bool gameover2 = false;
- int cantidadEnemigos = 28;
- //BALAS de nave1
- list<BALA*> B;
- list<BALA*> ::iterator it2;
- //BALAS de nave 2
- list<BALA*>B2;
- list<BALA*> ::iterator it3;
- //ENEMIGOS2
- list<NaveEnemiga*> E2;
- list<NaveEnemiga*>::iterator itE2;
- //CREA ENEMIGOS
- for (int i = 0; i < cantidadEnemigos; i++)
- {
- E2.push_back(new NaveEnemiga(2 + rand() % 79, 2 + rand() % 9, -1, +1));
- }
- //CREA HEROES
- Nave nave1 = Nave(40, 20);
- Nave nave3 = Nave(30, 20);
- Nave2 nave2 = Nave2(55, 20);
- //JUEGO
- while (!(gameover2)) {
- //puntos
- Console::SetCursorPosition(89, 3);
- Console::ForegroundColor = ConsoleColor::Yellow;
- cout << "Puntos: " << puntosacumulados;
- //Lee la tecla presionada y genera valores en las listas
- if (kbhit()) {
- if (players == 1) {
- char tecla = getch();
- nave1.animar(tecla);
- if (tecla == DISPARO)
- B.push_back(new BALA(nave1.X(), nave1.Y() - 1));
- }
- else if (players == 2) {
- char tecla = getch();
- nave3.animar(tecla);
- if (tecla == DISPARO)
- B.push_back(new BALA(nave3.X(), nave3.Y() - 1));
- nave2.animar(tecla);
- if (tecla == DISPARO2)
- B2.push_back(new BALA(nave2.X(), nave2.Y() - 1));
- }
- }
- //Imprime , mueve y borra las balas nave1 y nave 3(mueve con awsd)
- for (it2 = B.begin(); it2 != B.end();) {
- (*it2)->mover();
- if ((*it2)->fuera()) {
- Console::SetCursorPosition((*it2)->X(), (*it2)->Y());
- cout << " ";
- delete(*it2);
- //da un valor de la lista al eliminado
- it2 = B.erase(it2);
- }
- else {
- it2++;
- }
- }
- //Imprime , mueve y borra las balas de nave2(mueve con flechitas)
- for (it3 = B2.begin(); it3 != B2.end();) {
- (*it3)->mover();
- if ((*it3)->fuera()) {
- Console::SetCursorPosition((*it3)->X(), (*it3)->Y());
- cout << " ";
- delete(*it3);
- //da un valor de la lista al eliminado
- it3 = B2.erase(it3);
- }
- else {
- it3++;
- }
- }
- //Imprime a los enemigos
- for (itE2 = E2.begin(); itE2 != E2.end(); itE2++) {
- (*itE2)->animar();
- }
- //Balas de nave 1 y nave 3 que eliminan enemigos
- for (itE2 = E2.begin(); itE2 != E2.end(); itE2++) {
- for (it2 = B.begin(); it2 != B.end();)
- {
- if ((*itE2)->X() == (*it2)->X() && ((*itE2)->Y() == (*it2)->Y() || (*itE2)->Y() + 1 == (*it2)->Y()) && !((*itE2)->colisiono())) {
- Console::SetCursorPosition((*it2)->X(), (*it2)->Y());
- cout << " ";
- delete(*it2);
- it2 = B.erase(it2);
- Console::SetCursorPosition((*itE2)->X(), (*itE2)->Y());
- cout << " ";
- (*itE2)->marcar_colision();
- puntosacumulados += 5;
- contadornivel2 += 1;
- }
- else { it2++; }
- }
- }
- //Balas de nave 2 que eliminan enemigos
- for (itE2 = E2.begin(); itE2 != E2.end(); itE2++) {
- for (it3 = B2.begin(); it3 != B2.end();)
- {
- if ((*itE2)->X() == (*it3)->X() && ((*itE2)->Y() == (*it3)->Y() || (*itE2)->Y() + 1 == (*it3)->Y()) && !((*itE2)->colisiono())) {
- Console::SetCursorPosition((*it3)->X(), (*it3)->Y());
- cout << " ";
- delete(*it3);
- it3 = B2.erase(it3);
- Console::SetCursorPosition((*itE2)->X(), (*itE2)->Y());
- cout << " ";
- (*itE2)->marcar_colision();
- puntosacumulados += 5;
- contadornivel2 += 1;
- }
- else { it3++; }
- }
- }
- _sleep(0);
- if (contadornivel2 == cantidadEnemigos) {
- gameover2 = true;
- }
- }
- return puntosacumulados;
- }
- int jugar3(int players, int puntosacumulados) {
- int contadornivel3 = 0;
- bool gameover3 = false;
- //BALAS de nave1
- list<BALA*> B;
- list<BALA*> ::iterator it2;
- //BALAS de nave 2
- list<BALA*>B2;
- list<BALA*> ::iterator it3;
- //CREA BOSS
- Boss jefe = Boss(40, 10, -1, +1);
- //CREA HEROES
- Nave nave1 = Nave(40, 20);
- Nave nave3 = Nave(30, 20);
- Nave2 nave2 = Nave2(55, 20);
- //JUEGO
- while (!(gameover3)) {
- //puntos
- Console::SetCursorPosition(89, 3);
- Console::ForegroundColor = ConsoleColor::Yellow;
- cout << "Puntos: " << puntosacumulados;
- //Lee la tecla presionada y genera valores en las listas
- if (kbhit()) {
- if (players == 1) {
- char tecla = getch();
- nave1.animar(tecla);
- if (tecla == DISPARO)
- B.push_back(new BALA(nave1.X(), nave1.Y() - 1));
- }
- else if (players == 2) {
- char tecla = getch();
- nave3.animar(tecla);
- if (tecla == DISPARO)
- B.push_back(new BALA(nave3.X(), nave3.Y() - 1));
- nave2.animar(tecla);
- if (tecla == DISPARO2)
- B2.push_back(new BALA(nave2.X(), nave2.Y() - 1));
- }
- }
- //Enemigo
- jefe.animar();
- //Imprime , mueve y borra las balas nave1 y nave 3(mueve con awsd)
- for (it2 = B.begin(); it2 != B.end();) {
- (*it2)->mover();
- if ((*it2)->fuera()) {
- Console::SetCursorPosition((*it2)->X(), (*it2)->Y());
- cout << " ";
- delete(*it2);
- //da un valor de la lista al eliminado
- it2 = B.erase(it2);
- }
- else {
- it2++;
- }
- }
- //Imprime , mueve y borra las balas de nave2(mueve con flechitas)
- for (it3 = B2.begin(); it3 != B2.end();) {
- (*it3)->mover();
- if ((*it3)->fuera()) {
- Console::SetCursorPosition((*it3)->X(), (*it3)->Y());
- cout << " ";
- delete(*it3);
- //da un valor de la lista al eliminado
- it3 = B2.erase(it3);
- }
- else {
- it3++;
- }
- }
- //Balas de nave 1 y nave 3 que eliminan enemigos
- for (it2 = B.begin(); it2 != B.end();) {
- //ala izquierda
- if ((jefe._x-14==(*it2)->X()&&jefe._y-4==(*it2)->Y())||(jefe._x - 13 == (*it2)->X() && jefe._y -4 == (*it2)->Y())|| jefe._x - 12 == (*it2)->X() && jefe._y -3 == (*it2)->Y()|| jefe._x - 11 == (*it2)->X() && jefe._y - 3 == (*it2)->Y()|| jefe._x - 10 == (*it2)->X() && jefe._y -2 == (*it2)->Y()|| jefe._x - 9 == (*it2)->X() && jefe._y -2 == (*it2)->Y()|| jefe._x - 8 == (*it2)->X() && jefe._y -1 == (*it2)->Y()|| jefe._x - 7 == (*it2)->X() && jefe._y -1 == (*it2)->Y()|| jefe._x - 6 == (*it2)->X() && jefe._y== (*it2)->Y()|| jefe._x - 5 == (*it2)->X() && jefe._y== (*it2)->Y()) {
- Console::SetCursorPosition((*it2)->X(), (*it2)->Y());
- cout << " ";
- delete(*it2);
- it2 = B.erase(it2);
- puntosacumulados += 5;
- contadornivel3 += 1;
- }
- //centro
- else if ((jefe._x - 4 == (*it2)->X() && jefe._y+1== (*it2)->Y()) || (jefe._x - 3 == (*it2)->X() && jefe._y+1== (*it2)->Y()) || (jefe._x - 2 == (*it2)->X() && jefe._y+1== (*it2)->Y()) || (jefe._x - 1 == (*it2)->X() && jefe._y+1== (*it2)->Y()) || (jefe._x == (*it2)->X() && jefe._y+1== (*it2)->Y()) || (jefe._x + 1 == (*it2)->X() && jefe._y+1== (*it2)->Y()) || (jefe._x + 2 == (*it2)->X() && jefe._y+1== (*it2)->Y()) || (jefe._x + 3 == (*it2)->X() && jefe._y+1== (*it2)->Y()) || (jefe._x + 4 == (*it2)->X() && jefe._y+1== (*it2)->Y()) || (jefe._x + 5 == (*it2)->X() && jefe._y+1== (*it2)->Y())) {
- Console::SetCursorPosition((*it2)->X(), (*it2)->Y());
- cout << " ";
- delete(*it2);
- it2 = B.erase(it2);
- puntosacumulados += 5;
- contadornivel3 += 1;
- }
- //ala derecha
- else if ((jefe._x + 15 == (*it2)->X() && jefe._y -4 == (*it2)->Y()) || (jefe._x + 14 == (*it2)->X() && jefe._y-4 == (*it2)->Y()) || (jefe._x + 13 == (*it2)->X() && jefe._y-3 == (*it2)->Y()) || (jefe._x + 12 == (*it2)->X() && jefe._y-3== (*it2)->Y()) || (jefe._x + 11 == (*it2)->X() && jefe._y-2== (*it2)->Y()) || (jefe._x + 10 == (*it2)->X() && jefe._y-2== (*it2)->Y()) || (jefe._x + 9 == (*it2)->X() && jefe._y-1== (*it2)->Y()) || (jefe._x + 8 == (*it2)->X() && jefe._y-1== (*it2)->Y()) || (jefe._x + 7 == (*it2)->X() && jefe._y== (*it2)->Y()) || (jefe._x + 6 == (*it2)->X() && jefe._y== (*it2)->Y())) {
- Console::SetCursorPosition((*it2)->X(), (*it2)->Y());
- cout << " ";
- delete(*it2);
- it2 = B.erase(it2);
- puntosacumulados += 5;
- contadornivel3 += 1;
- }
- else { it2++; }
- }
- //Balas de nave 2 que eliminan enemigos
- for (it3 = B2.begin(); it3 != B2.end();){
- //ala izquierda
- if ((jefe._x - 14 == (*it3)->X() && jefe._y - 4 == (*it3)->Y()) || (jefe._x - 13 == (*it3)->X() && jefe._y - 4 == (*it3)->Y()) || jefe._x - 12 == (*it3)->X() && jefe._y - 3 == (*it3)->Y() || jefe._x - 11 == (*it3)->X() && jefe._y - 3 == (*it3)->Y() || jefe._x - 10 == (*it3)->X() && jefe._y - 2 == (*it3)->Y() || jefe._x - 9 == (*it3)->X() && jefe._y - 2 == (*it3)->Y() || jefe._x - 8 == (*it3)->X() && jefe._y - 1 == (*it3)->Y() || jefe._x - 7 == (*it3)->X() && jefe._y - 1 == (*it3)->Y() || jefe._x - 6 == (*it3)->X() && jefe._y == (*it3)->Y() || jefe._x - 5 == (*it3)->X() && jefe._y == (*it3)->Y()) {
- Console::SetCursorPosition((*it3)->X(), (*it3)->Y());
- cout << " ";
- delete(*it3);
- it3 = B2.erase(it3);
- puntosacumulados += 5;
- contadornivel3 += 1;
- }
- //centro
- else if ((jefe._x - 4 == (*it3)->X() && jefe._y + 1 == (*it3)->Y()) || (jefe._x - 3 == (*it3)->X() && jefe._y + 1 == (*it3)->Y()) || (jefe._x - 2 == (*it3)->X() && jefe._y + 1 == (*it3)->Y()) || (jefe._x - 1 == (*it3)->X() && jefe._y + 1 == (*it3)->Y()) || (jefe._x == (*it3)->X() && jefe._y + 1 == (*it3)->Y()) || (jefe._x + 1 == (*it3)->X() && jefe._y + 1 == (*it3)->Y()) || (jefe._x + 2 == (*it3)->X() && jefe._y + 1 == (*it3)->Y()) || (jefe._x + 3 == (*it3)->X() && jefe._y + 1 == (*it3)->Y()) || (jefe._x + 4 == (*it3)->X() && jefe._y + 1 == (*it3)->Y()) || (jefe._x + 5 == (*it3)->X() && jefe._y + 1 == (*it3)->Y())) {
- Console::SetCursorPosition((*it3)->X(), (*it3)->Y());
- cout << " ";
- delete(*it3);
- it3 = B2.erase(it3);
- puntosacumulados += 5;
- contadornivel3 += 1;
- }
- //ala derecha
- else if ((jefe._x + 15 == (*it3)->X() && jefe._y - 4 == (*it3)->Y()) || (jefe._x + 14 == (*it3)->X() && jefe._y - 4 == (*it3)->Y()) || (jefe._x + 13 == (*it3)->X() && jefe._y - 3 == (*it3)->Y()) || (jefe._x + 12 == (*it3)->X() && jefe._y - 3 == (*it3)->Y()) || (jefe._x + 11 == (*it3)->X() && jefe._y - 2 == (*it3)->Y()) || (jefe._x + 10 == (*it3)->X() && jefe._y - 2 == (*it3)->Y()) || (jefe._x + 9 == (*it3)->X() && jefe._y - 1 == (*it3)->Y()) || (jefe._x + 8 == (*it3)->X() && jefe._y - 1 == (*it3)->Y()) || (jefe._x + 7 == (*it3)->X() && jefe._y == (*it3)->Y()) || (jefe._x + 6 == (*it3)->X() && jefe._y == (*it3)->Y())) {
- Console::SetCursorPosition((*it3)->X(), (*it3)->Y());
- cout << " ";
- delete(*it3);
- it3 = B2 .erase(it3);
- puntosacumulados += 5;
- contadornivel3 += 1;
- }
- else { it3++; }
- }
- //Velocidad de los enemigos
- _sleep(10);
- if (contadornivel3 == 500) {
- gameover3 = true;
- }
- }
- return puntosacumulados;
- }
- int main() {
- srand(time(NULL));
- int nivel;
- int players;
- int puntosacumulados = 0;
- Console::CursorVisible = false;
- copiasmatriz(nivel = 1);
- imprimirmatriz(nivel = 1);
- Console::SetCursorPosition(22, 27);
- Console::ForegroundColor = ConsoleColor::White;
- cout << "<<PRESIONE CUALQUIER TECLA PARA COMENZAR>>";
- //Pedir jugador
- if (getch()) {
- do {
- system("cls");
- copiasmatriz(nivel = 2);
- imprimirmatriz(nivel = 2);
- Console::SetCursorPosition(16, 14);
- Console::ForegroundColor = ConsoleColor::Green;
- cout << "Seleccione una cantidad de jugadores entre 1 y 2: ";
- Console::SetCursorPosition(66, 14);
- cin >> players;
- } while (!(players == 1 || players == 2));
- //MOSTRAR NIVEL1
- MatrizNivel1();
- }
- //JUEGO DEL NIVEL1
- if (getch()) {
- system("cls");
- copiasmatriz(nivel = 2);
- imprimirmatriz(nivel = 2);
- puntosacumulados = jugar(players);
- }
- //Nivel2
- MatrizNivel2();
- //Juego del Nivel2
- if (getch()) {
- system("cls");
- copiasmatriz(nivel = 2);
- imprimirmatriz(nivel = 2);
- puntosacumulados = jugar2(players, puntosacumulados);
- }
- //Nivel 3
- MatrizNivel3();
- //Juego del Nivel3
- if (getch()) {
- system("cls");
- copiasmatriz(nivel = 2);
- imprimirmatriz(nivel = 2);
- jugar3(players, puntosacumulados);
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement