Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <conio.h>
- #include <ctime>
- #include <stdlib.h>
- 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
- 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,0,0,2,2,2,2,2,2,0,0,2,2,2,2,0,0,2,2,2,2,0,0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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, _vidas;
- int ybala, xbala;
- bool disparo = false;
- public:
- Nave(int x, int y) {
- _x = x;
- _y = y;
- _vidas = 3;
- }
- 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--;
- ybala = _y;
- break;
- }
- case 'S': if (_y + 4 <= 27) {
- _y++;
- ybala = _y;
- break;
- }
- case 'A': if (_x - 2 >= 2) {
- _x--;
- xbala = _x;
- break;
- }
- case 'D': if (_x + 3 <= 83) {
- _x++;
- xbala = _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);
- }
- void dibujarBala() {
- Console::SetCursorPosition(xbala, ybala - 1);
- Console::ForegroundColor = ConsoleColor::Cyan;
- cout << "*";
- }
- void eliminarBala() {
- Console::SetCursorPosition(xbala, ybala - 1);
- cout << " ";
- }
- void bala(short tecla) {
- if ((int)tecla == DISPARO) {
- xbala = _x;
- ybala = _y;
- disparo = true;
- /*while (ybala - 1 >= 1) {
- dibujarBala(); _sleep(30);
- eliminarBala();
- ybala--;
- }*/
- }
- }
- };
- typedef struct NaveEnemiga {
- short _x, _y, _dx, _dy, _retraso;
- 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;
- }
- 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() {
- Console::SetCursorPosition(_x, _y);
- Console::ForegroundColor = ConsoleColor::Green;
- cout << _img;
- }
- };
- typedef struct Nave2 {
- int _x, _y, _vidas;
- public:
- Nave2(int x, int y) {
- _x = x;
- _y = y;
- _vidas = 3;
- }
- 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);
- }
- };
- void jugar(int players) {
- bool continuar = true;
- NaveEnemiga enemigo1 = NaveEnemiga(5, 2, -1, +1);
- NaveEnemiga enemigo2 = NaveEnemiga(2, 2, -1, +1);
- NaveEnemiga enemigo3 = NaveEnemiga(8, 2, -1, +1);
- NaveEnemiga enemigo4 = NaveEnemiga(11, 2, -1, +1);
- NaveEnemiga enemigo5 = NaveEnemiga(14, 2, -1, +1);
- NaveEnemiga enemigo6 = NaveEnemiga(17, 2, -1, +1);
- NaveEnemiga enemigo7 = NaveEnemiga(20, 2, -1, +1);
- NaveEnemiga enemigo8 = NaveEnemiga(23, 2, -1, +1);
- NaveEnemiga enemigo9 = NaveEnemiga(26, 2, -1, +1);
- NaveEnemiga enemigo10 = NaveEnemiga(29, 2, -1, +1);
- Nave nave1 = Nave(40, 20);
- Nave nave3 = Nave(30, 20);
- Nave2 nave2 = Nave2(55, 20);
- if (players == 1) {
- while (continuar) {
- if (kbhit()) {
- char tecla = getch();
- nave1.animar(tecla);
- nave1.bala(tecla);
- }
- if(nave1.disparo)
- nave1.dibujarBala();
- enemigo1.animar();
- enemigo2.animar();
- enemigo3.animar();
- enemigo4.animar();
- enemigo5.animar();
- enemigo6.animar();
- enemigo7.animar();
- enemigo8.animar();
- enemigo9.animar();
- enemigo10.animar();
- _sleep(20);
- if (nave1.disparo){
- nave1.eliminarBala();
- nave1.ybala--;
- }
- if (nave1.ybala - 1 <= 1) {
- nave1.disparo = false;
- }
- }
- getch();
- }
- if (players == 2) {
- while (continuar) {
- if (kbhit()) {
- nave3.animar(getch());
- }
- if (kbhit()) {
- nave2.animar(getch());
- }
- enemigo1.animar();
- enemigo2.animar();
- enemigo3.animar();
- enemigo4.animar();
- }
- getch();
- }
- }
- int main() {
- int nivel;
- int players;
- int dificultad;
- Console::CursorVisible = false;
- copiasmatriz(nivel = 1);
- imprimirmatriz(nivel = 1);
- Console::SetCursorPosition(27, 27);
- Console::ForegroundColor = ConsoleColor::White;
- cout << "<<PRESIONE ENTER PARA COMENZAR>>";
- if (getch()){
- 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: ";
- cin >> players;
- Console::SetCursorPosition(16, 16);
- cout << "Seleccione el nivel que desee jugar: ";
- cin >> dificultad;
- system("cls");
- copiasmatriz(nivel = 2);
- imprimirmatriz(nivel = 2);
- jugar( players);
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement