Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <conio.h>
- #include <ctype.h>
- #include <conio.h>
- #include <vector>
- #define IZQUIERDA 'A'
- #define DERECHA 'D'
- using namespace std;
- using namespace System;
- enum Colores { NEGRO, ROJO, AZUL, BLANCO, VERDE, AMARILLO }; enum color2 { MORADO };
- void CambiarColorFondo(Colores color) {
- switch (color)
- {
- case BLANCO: Console::BackgroundColor = ConsoleColor::White; break;
- case NEGRO: Console::BackgroundColor = ConsoleColor::Black; break;
- case ROJO: Console::BackgroundColor = ConsoleColor::Red; break;
- case AZUL: Console::BackgroundColor = ConsoleColor::Blue; break;
- case AMARILLO: Console::BackgroundColor = ConsoleColor::Yellow; break;
- case VERDE: Console::BackgroundColor = ConsoleColor::Green; break;
- }
- }
- void CambiarColorLetra(Colores color) {
- switch (color) {
- case BLANCO: Console::ForegroundColor = ConsoleColor::White; break;
- case NEGRO: Console::ForegroundColor = ConsoleColor::Black; break;
- case ROJO: Console::ForegroundColor = ConsoleColor::Red; break;
- case AZUL: Console::ForegroundColor = ConsoleColor::Blue; break;
- case AMARILLO: Console::ForegroundColor = ConsoleColor::Yellow; break;
- case VERDE: Console::ForegroundColor = ConsoleColor::Green; break;
- }
- }
- void galaga() {
- CambiarColorLetra(VERDE);
- cout << "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX" << endl;
- cout << "XxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxX" << endl;
- cout << "Xx::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::xX" << endl;
- cout << "Xx::..................................................................................................::xX" << endl;
- cout << "Xx::. .::xX" << endl;
- cout << "Xx::. .::xX" << endl;
- cout << "Xx::. .::xX" << endl;
- cout << "Xx::. .::xX" << endl;
- cout << "Xx::. .::xX" << endl;
- cout << "Xx::. .::xX" << endl;
- cout << "Xx::. .....xxxxxxxxx.... .::xX" << endl;
- cout << "Xx::. ..XXXXXXXXXXXXXXXXXXXXXXXXXXXX... ..xXXXX. .::xX" << endl;
- cout << "Xx::. ..XXXXXXXXX. ...XXXXXXXXX .xX. xXx. .::xX" << endl;
- cout << "Xx::. .XXXX. xX. .XXXXXXXXXXXXxx. xxx. .::xX" << endl;
- cout << "Xx::. .xxxxxxxx. .XXXX .xXXX. .xXXx. .xx. .::xX" << endl;
- cout << "Xx::. .XXXX. xxxXXXX XXX. xxXXxx.x .::xX" << endl;
- cout << "Xx::. .XX. XXXX XXX. .x. .::xX" << endl;
- cout << "Xx::. XX X. XXX. .xx. .::xX" << endl;
- cout << "Xx::. XX . . XXX. . .x. ..x .::xX" << endl;
- cout << "Xx::. .XX X .xXXXX. XXX. .xXXXX. xxxxXXXX. .xXXXX. .::xX" << endl;
- cout << "Xx::. XXX Xxxxx .xXXxXXXXX XXX.xXXxXXXXX XXXX. xXX. xXXxXXXXX .::xX" << endl;
- cout << "Xx::. XXXX .XXXXXX .XX XX XXX. .XX XX xXx. .Xx .XX XX .::xX" << endl;
- cout << "Xx::. XXXXX XXXx XX XX . XXX. XX XX . XXXXXXXXX XX XX . .::xX" << endl;
- cout << "Xx::. XXXXXXX XXXXXXXXxxX XXXXxXXXx XXX. XXXXxXXXx . .xx XXXXxXXXx .::xX" << endl;
- cout << "Xx::. XXXXXXXXXXXXXXXXXXxXXXxxXX xx x XX. xx x .XXXXXXXxx. .xx x .::xX" << endl;
- cout << "Xx::. XXXXXXXXXXXxxxXXxxxxxXXX . .xXXxxx .::xX" << endl;
- cout << "Xx::. XXXXXXXXX xxXXX. .xX XXX .::xX" << endl;
- cout << "Xx::. x XXXX ..xXX. .::xX" << endl;
- cout << "Xx::. .XXXXXXXXXXXx .::xX" << endl;
- cout << "Xx::. .XXXXXXxxx. .::xX" << endl;
- cout << "Xx::. .x. .::xX" << endl;
- cout << "Xx::. .::xX" << endl;
- cout << "Xx::. .::xX" << endl;
- cout << "Xx::. .::xX" << endl;
- cout << "Xx::. .::xX" << endl;
- cout << "Xx::. .::xX" << endl;
- cout << "Xx::..................................................................................................::xX" << endl;
- cout << "Xx::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::xX" << endl;
- cout << "XxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxX" << endl;
- cout << "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX" << endl;
- system("pause>0");
- system("cls");
- }
- void marco() {
- CambiarColorLetra(AMARILLO);
- cout << "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX" << endl;
- cout << "X X" << endl;
- cout << "X X" << endl;
- cout << "X X" << endl;
- cout << "X X" << endl;
- cout << "X X" << endl;
- cout << "X X" << endl;
- cout << "X X" << endl;
- cout << "X X" << endl;
- cout << "X X" << endl;
- cout << "X X" << endl;
- cout << "X X" << endl;
- cout << "X X" << endl;
- cout << "X X" << endl;
- cout << "X X" << endl;
- cout << "X X" << endl;
- cout << "X X" << endl;
- cout << "X X" << endl;
- cout << "X X" << endl;
- cout << "X X" << endl;
- cout << "X X" << endl;
- cout << "X X" << endl;
- cout << "X X" << endl;
- cout << "X X" << endl;
- cout << "X X" << endl;
- cout << "X X" << endl;
- cout << "X X" << endl;
- cout << "X X" << endl;
- cout << "X X" << endl;
- cout << "X X" << endl;
- cout << "X X" << endl;
- cout << "X X" << endl;
- cout << "X X" << endl;
- cout << "X X" << endl;
- cout << "X X" << endl;
- cout << "X X" << endl;
- cout << "X X" << endl;
- cout << "X X" << endl;
- cout << "X X" << endl;
- cout << "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX" << endl;//121-82
- system("pause>0");
- }
- void level1() {
- CambiarColorLetra(AZUL);
- cout << "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX" << endl;
- cout << "X X" << endl;
- cout << "X X" << endl;
- cout << "X X" << endl;
- cout << "X X" << endl;
- cout << "X X" << endl;
- cout << "X X" << endl;
- cout << "X X" << endl;
- cout << "X X" << endl;
- cout << "X X" << endl;
- cout << "X X" << endl;
- cout << "X X" << endl;
- cout << "X X" << endl;
- cout << "X ____ ____ ____ ___ ___ ____________ ____ ________ X" << endl;
- cout << "X | * | | | | | | | | | | | | / | X" << endl;
- cout << "X | * | | | | | | | | | _______| | | / | X" << endl;
- cout << "X | * | | | | | | | | | | | | / _ | X" << endl;
- cout << "X | * | | | | | * * | | |_____ | | /____/ | | X" << endl;
- cout << "X | *| | | | * * * * | | | | | | X" << endl;
- cout << "X | | | | * * * * | _____| | | | | X" << endl;
- cout << "X | * | | | * * * * | | | | | | X" << endl;
- cout << "X | |* | | | * * * | | | | | | X" << endl;
- cout << "X | | * | | | * * | |_______ | |_______ | | X" << endl;
- cout << "X | | * | | | * * | | | | | | X" << endl;
- cout << "X |____| *_____| |____| *___* |____________| |____________| |_____| X" << endl;
- cout << "X X" << endl;
- cout << "X X" << endl;
- cout << "X X" << endl;
- cout << "X X" << endl;
- cout << "X X" << endl;
- cout << "X X" << endl;
- cout << "X X" << endl;
- cout << "X X" << endl;
- cout << "X X" << endl;
- cout << "X X" << endl;
- cout << "X X" << endl;
- cout << "X X" << endl;
- cout << "X X" << endl;
- cout << "X X" << endl;
- cout << "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX" << endl;//121-82
- system("pause>0");
- }
- void level2() {
- CambiarColorLetra(AZUL);
- cout << "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX" << endl;
- cout << "X X" << endl;
- cout << "X X" << endl;
- cout << "X X" << endl;
- cout << "X X" << endl;
- cout << "X X" << endl;
- cout << "X X" << endl;
- cout << "X X" << endl;
- cout << "X X" << endl;
- cout << "X X" << endl;
- cout << "X X" << endl;
- cout << "X X" << endl;
- cout << "X X" << endl;
- cout << "X ____ ____ ____ ___ ___ ____________ ____ _____ X" << endl;
- cout << "X | * | | | | | | | | | | | | _* * _ X" << endl;
- cout << "X | * | | | | | | | | | _______| | | * _____ *_ X" << endl;
- cout << "X | * | | | | | | | | | | | | | | * | X" << endl;
- cout << "X | * | | | | | * * | | |_____ | | |___| | | X" << endl;
- cout << "X | *| | | | * * * * | | | | _* _* X" << endl;
- cout << "X | | | | * * * * | _____| | | _* _* X" << endl;
- cout << "X | * | | | * * * * | | | | _* _* X" << endl;
- cout << "X | |* | | | * * * | | | | _* _* X" << endl;
- cout << "X | | * | | | * * | |_______ | |_______ __* _*_______ X" << endl;
- cout << "X | | * | | | * * | | | | | | X" << endl;
- cout << "X |____| *_____| |____| *___* |____________| |____________| |_________________| X" << endl;
- cout << "X X" << endl;
- cout << "X X" << endl;
- cout << "X X" << endl;
- cout << "X X" << endl;
- cout << "X X" << endl;
- cout << "X X" << endl;
- cout << "X X" << endl;
- cout << "X X" << endl;
- cout << "X X" << endl;
- cout << "X X" << endl;
- cout << "X X" << endl;
- cout << "X X" << endl;
- cout << "X X" << endl;
- cout << "X X" << endl;
- cout << "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX" << endl;//121-82
- system("pause>0");
- }
- void level3() {
- CambiarColorLetra(AZUL);
- cout << "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX" << endl;
- cout << "X X" << endl;
- cout << "X X" << endl;
- cout << "X X" << endl;
- cout << "X X" << endl;
- cout << "X X" << endl;
- cout << "X X" << endl;
- cout << "X X" << endl;
- cout << "X X" << endl;
- cout << "X X" << endl;
- cout << "X X" << endl;
- cout << "X X" << endl;
- cout << "X X" << endl;
- cout << "X ____ ____ ____ ___ ___ ____________ ____ _____ X" << endl;
- cout << "X | * | | | | | | | | | | | | _* * _ X" << endl;
- cout << "X | * | | | | | | | | | _______| | | * _____ *_ X" << endl;
- cout << "X | * | | | | | | | | | | | | |___| * | X" << endl;
- cout << "X | * | | | | | * * | | |_____ | | ____* _* X" << endl;
- cout << "X | *| | | | * * * * | | | | | _* X" << endl;
- cout << "X | | | | * * * * | _____| | | |____ *. X" << endl;
- cout << "X | * | | | * * * * | | | | ___ *- *- X" << endl;
- cout << "X | |* | | | * * * | | | | | | | * X" << endl;
- cout << "X | | * | | | * * | |_______ | |_______ *- *-____ * - X" << endl;
- cout << "X | | * | | | * * | | | | *_ _* X" << endl;
- cout << "X |____| *_____| |____| *___* |____________| |____________| *-______--* X" << endl;
- cout << "X X" << endl;
- cout << "X X" << endl;
- cout << "X X" << endl;
- cout << "X X" << endl;
- cout << "X X" << endl;
- cout << "X X" << endl;
- cout << "X X" << endl;
- cout << "X X" << endl;
- cout << "X X" << endl;
- cout << "X X" << endl;
- cout << "X X" << endl;
- cout << "X X" << endl;
- cout << "X X" << endl;
- cout << "X X" << endl;
- cout << "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX" << endl;//121-82
- system("pause>0");
- }
- void level4() {
- CambiarColorLetra(AZUL);
- cout << "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX" << endl;
- cout << "X X" << endl;
- cout << "X X" << endl;
- cout << "X X" << endl;
- cout << "X X" << endl;
- cout << "X X" << endl;
- cout << "X X" << endl;
- cout << "X X" << endl;
- cout << "X X" << endl;
- cout << "X X" << endl;
- cout << "X X" << endl;
- cout << "X X" << endl;
- cout << "X X" << endl;
- cout << "X ____ ____ ____ ___ ___ ____________ ____ ______ X" << endl;
- cout << "X | * | | | | | | | | | | | | * | X" << endl;
- cout << "X | * | | | | | | | | | _______| | | * *| | X" << endl;
- cout << "X | * | | | | | | | | | | | | * * | | X" << endl;
- cout << "X | * | | | | | * * | | |_____ | | * * | | X" << endl;
- cout << "X | *| | | | * * * * | | | | * *____ |__ X" << endl;
- cout << "X | | | | * * * * | _____| | | | | X" << endl;
- cout << "X | * | | | * * * * | | | | |_________ __| X" << endl;
- cout << "X | |* | | | * * * | | | | | | X" << endl;
- cout << "X | | * | | | * * | |_______ | |_______ | | X" << endl;
- cout << "X | | * | | | * * | | | | | | X" << endl;
- cout << "X |____| *_____| |____| *___* |____________| |____________| |____| X" << endl;
- cout << "X X" << endl;
- cout << "X X" << endl;
- cout << "X X" << endl;
- cout << "X X" << endl;
- cout << "X X" << endl;
- cout << "X X" << endl;
- cout << "X X" << endl;
- cout << "X X" << endl;
- cout << "X X" << endl;
- cout << "X X" << endl;
- cout << "X X" << endl;
- cout << "X X" << endl;
- cout << "X X" << endl;
- cout << "X X" << endl;
- cout << "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX" << endl;//121-82
- system("pause>0");
- }
- void ganaste() {
- CambiarColorLetra(AMARILLO);
- cout << "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX" << endl;
- cout << "X X" << endl;
- cout << "X X" << endl;
- cout << "X X" << endl;
- cout << "X X" << endl;
- cout << "X X" << endl;
- cout << "X X" << endl;
- cout << "X X" << endl;
- cout << "X X" << endl;
- cout << "X X" << endl;
- cout << "X X" << endl;
- cout << "X X" << endl;
- cout << "X X" << endl;
- cout << "X X" << endl;
- cout << "X .xXXXXXx. X Xx X X xXXXXx. XXXXXXXXXXX XXXXXXXXX X" << endl;
- cout << "X /* X X X X X X X X X X X" << endl;
- cout << "X X .X X. X X X .X X. X X X X" << endl;
- cout << "X X X X X X X X X Xx_ X X X" << endl;
- cout << "X X .X X. X X X .X X. *XXXx. X XXXXXX X" << endl;
- cout << "X X xXXx .XXXXXXXXX. X X X .XXXXXXXXX. x X X X" << endl;
- cout << "X X X X X X X X X X X X X X" << endl;
- cout << "X .X .X .X X. X X X .X X. x x X X X" << endl;
- cout << "X *XXXXX* X X X Xx X X XXXXXXX* X XXXXXXXXX X" << endl;
- cout << "X X" << endl;
- cout << "X X" << endl;
- cout << "X X" << endl;
- cout << "X X" << endl;
- cout << "X X" << endl;
- cout << "X X" << endl;
- cout << "X X" << endl;
- cout << "X X" << endl;
- cout << "X X" << endl;
- cout << "X X" << endl;
- cout << "X X" << endl;
- cout << "X X" << endl;
- cout << "X X" << endl;
- cout << "X ELIZABETH NINA GUTIERREZ X" << endl;
- cout << "X X" << endl;
- cout << "X X" << endl;
- cout << "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX" << endl;//121-82
- system("pause>0");
- }
- void perdiste() {
- CambiarColorLetra(ROJO);
- cout << "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX" << endl;
- cout << "X X" << endl;
- cout << "X X" << endl;
- cout << "X X" << endl;
- cout << "X X" << endl;
- cout << "X X" << endl;
- cout << "X X" << endl;
- cout << "X X" << endl;
- cout << "X X" << endl;
- cout << "X X" << endl;
- cout << "X X" << endl;
- cout << "X X" << endl;
- cout << "X X" << endl;
- cout << "X X" << endl;
- cout << "X XXXXXXx. XXXXXXXXX XXXXXXx. XXXXXXx. X xXXXXx. XXXXXXXXXXX XXXXXXXXX X" << endl;
- cout << "X X *X. X X *X. X *X. X X X X X" << endl;
- cout << "X X X X X X X X X X X X X" << endl;
- cout << "X X .x* X X .x* X X X Xx_ X X X" << endl;
- cout << "X XXXXXX* XXXXXX XXXXXX* X X X *XXXx. X XXXXXX X" << endl;
- cout << "X X X X *x X X X x X X X" << endl;
- cout << "X X X X *x X X X X X X X" << endl;
- cout << "X X X X X X .x* X x x X X X" << endl;
- cout << "X X XXXXXXXXX X X XXXXXX* X XXXXXXX* X XXXXXXXXX X" << endl;
- cout << "X X" << endl;
- cout << "X X" << endl;
- cout << "X X" << endl;
- cout << "X X" << endl;
- cout << "X X" << endl;
- cout << "X X" << endl;
- cout << "X X" << endl;
- cout << "X X" << endl;
- cout << "X X" << endl;
- cout << "X X" << endl;
- cout << "X X" << endl;
- cout << "X X" << endl;
- cout << "X X" << endl;
- cout << "X X" << endl;
- cout << "X X" << endl;
- cout << "X X" << endl;
- cout << "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX" << endl;//121-82
- system("pause>0");
- }
- void instrucciones() {
- CambiarColorLetra(ROJO);
- cout << "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX" << endl;
- cout << "X X" << endl;
- cout << "X X" << endl;
- cout << "X X" << endl;
- cout << "X X" << endl;
- cout << "X X" << endl;
- cout << "X X" << endl;
- cout << "X X" << endl;
- cout << "X X" << endl;
- cout << "X X" << endl;
- cout << "X X" << endl;
- cout << "X X" << endl;
- cout << "X X" << endl;
- cout << "X X" << endl;
- cout << "X --------------------------------- INSTRUCCIONES: ------------------------------ X" << endl;
- cout << "X X" << endl;
- cout << "X [ESPACIO] -> Disparar X" << endl;
- cout << "X [A] -> Mover nave a la izquierda X" << endl;
- cout << "X [D] -> Mover nave a la derecha X" << endl;
- cout << "X X" << endl;
- cout << "X X" << endl;
- cout << "X X" << endl;
- cout << "X X" << endl;
- cout << "X X" << endl;
- cout << "X X" << endl;
- cout << "X X" << endl;
- cout << "X X" << endl;
- cout << "X X" << endl;
- cout << "X X" << endl;
- cout << "X X" << endl;
- cout << "X X" << endl;
- cout << "X X" << endl;
- cout << "X X" << endl;
- cout << "X X" << endl;
- cout << "X X" << endl;
- cout << "X X" << endl;
- cout << "X X" << endl;
- cout << "X X" << endl;
- cout << "X X" << endl;
- cout << "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX" << endl;//121-82
- system("pause>0");
- }
- typedef struct avispa {
- short x = 10; short y = 10; short mx = 1; short my = 1; int pasos = 0; bool pausa = true; short auxx; short auxxy; int retraso = 0; short _my = 1; short _mx = 1;
- char img[3] = { '>','i','<' };
- avispa(short a = 2, short b = 3) {
- x = a;
- y = b;
- };
- void moverINI(int limite) {
- if (pasos <= 5) {
- y++;
- }
- else if (pasos > 5 && pasos <= limite) {
- x--;
- }
- }
- void animar(int limite, int limitex, int variacion) {
- if (pasos <= 40) {
- auxx = x; auxxy = y;
- borrar();
- moverINI(limite);
- dibujar();
- }
- else if (pasos>40 && pasos<limitex) {
- borrar();
- mover2();//circulos
- dibujar();
- }
- else if (pasos >= limitex && pasos<limitex + 20 + (variacion * 50)) {
- borrar();
- recto();
- dibujar();
- }
- else {
- borrar();
- aleatorio();
- dibujar();
- }
- pasos++;
- retraso++;
- }
- void recto() {
- if (y >= 30) {
- y = 24;
- _my = _my*-1;
- }
- else if (y <= 10) {
- y = 11;
- _my = _my*-1;
- }
- y = y - _my;
- }
- void mover2() {
- if (x <= auxx - 3) {
- x = auxx - 3;
- mx *= -1;
- }
- else if (x >= auxx + 3) {
- x = auxx + 3;
- mx *= -1;
- }
- else if (y <= auxxy) {
- y = auxxy;
- my *= -1;
- }
- else if (y >= auxxy + 6) {
- y = auxxy + 6;
- my *= -1;
- }
- y = y + my;
- x = x + mx;
- }
- void aleatorio() {
- if (x <= 6) {
- x = 7;
- _mx *= -1;
- }
- else if (x >= 95) {
- x = 94;
- _mx *= -1;
- }
- else if (y <= 8) {
- y = 9;
- _my *= -1;
- }
- else if (y >= 25) {
- y = 24;
- _my *= -1;
- }
- y = y + _my;
- x = x + _mx;
- }
- void dibujar() {
- Console::SetCursorPosition(x, y);
- for (int j = 0; j < 3; j++) {
- CambiarColorLetra(ROJO);
- cout << img[j];
- CambiarColorLetra(BLANCO);
- }
- }
- void borrar() {
- Console::SetCursorPosition(x, y);
- for (int j = 0; j < 3; j++) {
- cout << " ";
- }
- }
- };
- typedef struct mari {
- short x = 10; short y = 10; short mx = 1; short my = 1; int pasos = 0; bool pausa = true; short auxx; short auxxy; short _my = 1; short _mx = 1; int pasos2 = 0;
- char img[3] = { '8','i','8' };
- mari(short a = 2, short b = 3) {
- x = a;
- y = b;
- };
- void moverINI(int limite) {
- if (pasos <= 5) {
- y++;
- }
- else if (pasos > 5 && pasos <= limite) {
- x++;
- }
- }
- void animar(int limite, int limitex, int variación) {
- if (pasos <= 40) {
- auxx = x; auxxy = y;
- borrar();
- moverINI(limite);
- dibujar();
- }
- else if (pasos>40 && pasos<limitex) {
- borrar();
- mover2();//movimiento en circulo
- dibujar();
- }
- else if (pasos >= limitex && pasos<limitex + 15) {
- borrar();
- recto();//cae en linea recta
- dibujar();
- }
- else if (pasos >= limitex + 20 && pasos<limitex + 20 + (variación * 50)) {
- borrar();
- mover3();//aleatorio
- dibujar();
- }
- else {
- borrar();
- aleatorio();
- dibujar();
- }
- pasos++;
- }
- void recto() {
- y++;
- }
- void mover2() {
- if (x <= auxx - 3) {
- x = auxx - 3;
- mx *= -1;
- }
- else if (x >= auxx + 3) {
- x = auxx + 3;
- mx *= -1;
- }
- else if (y <= auxxy) {
- y = auxxy;
- my *= -1;
- }
- else if (y >= auxxy + 6) {
- y = auxxy + 6;
- my *= -1;
- }
- y = y + my;
- x = x - mx;
- }
- void mover3() {
- if (x <= 50) {
- x = 51;
- _mx *= -1;
- }
- else if (x >= 95) {
- x = 94;
- _mx *= -1;
- }
- else if (y <= 5) {
- y = 6;
- _my *= -1;
- }
- else if (y >= 30) {
- y = 29;
- _my *= -1;
- }
- y = y + _my;
- x = x + _mx;
- }
- void aleatorio() {
- if (x <= 8) {
- x = 9;
- _mx *= -1;
- }
- else if (x >= 95) {
- x = 94;
- _mx *= -1;
- }
- else if (y <= 8) {
- y = 9;
- _my *= -1;
- }
- else if (y >= 25) {
- y = 24;
- _my *= -1;
- }
- y = y + _my;
- x = x + _mx;
- }
- void dibujar() {
- Console::SetCursorPosition(x, y);
- for (int j = 0; j < 3; j++) {
- CambiarColorLetra(AZUL);
- cout << img[j];
- CambiarColorLetra(BLANCO);
- }
- }
- void borrar() {
- Console::SetCursorPosition(x, y);
- for (int j = 0; j < 3; j++) {
- cout << " ";
- }
- }
- };
- typedef struct bala {
- short x;
- short y;
- bool pausa = true;
- bala(short a = 2, short b = 3) {
- x = a;
- y = b;
- }
- bool colision(short x1, short y1, short ancho, short largo) {
- if (x <= x1 + ancho && x + 1 >= x1 && y <= y1 + largo && y + 1 >= y1)
- {
- return true;
- }
- return false;
- }
- void animar() {
- if (pausa) {
- borrar();
- if (y > 0) {
- y--;
- }
- CambiarColorLetra(AMARILLO);
- Console::SetCursorPosition(x, y);
- cout << "|";
- CambiarColorLetra(BLANCO);
- }
- }
- void animar2() {
- if (pausa) {
- borrar();
- if (y <36) {
- y++;
- }
- CambiarColorLetra(ROJO);
- Console::SetCursorPosition(x, y);
- cout << "*";
- CambiarColorLetra(BLANCO);
- }
- }
- void animar3() {
- if (pausa) {
- borrar();
- if (y <36) {
- y++;
- }
- CambiarColorLetra(AZUL);
- Console::SetCursorPosition(x, y);
- cout << "_";
- CambiarColorLetra(BLANCO);
- }
- }
- void borrar() {
- Console::SetCursorPosition(x, y);
- cout << " ";
- }
- ~bala() {
- Console::SetCursorPosition(x, y);
- cout << " ";
- }
- };
- typedef struct comandante {
- short x = 10; short y = 10; short mx = 1; short my = 1; int pasos = 0; char img[5] = { '(',')','*','(',')' }; int auxx; int auxy; bala d;
- comandante(short _x, short _y) {
- x = _x; y = _y;
- }
- void animar() {
- borrar();
- mover();
- dibujar();
- pasos++;
- }
- void mover() {
- if (pasos == 0) {
- auxx = x; auxy = y;
- }
- if (x <= 4 && y>8) {
- x = 9;
- mx *= -1;
- y = y + my;
- }
- else if (x >= 95 && y<20) {
- x = 94;
- mx *= -1;
- y = y + my;
- }
- else if (x >= 98 && y >= 20) {
- my *= -1;
- y = 19;
- y = y + my;
- mx *= -1;
- }
- else if (x <= 4 && y <= 8) {
- my *= -1;
- y = 9;
- y = y + my;
- mx *= -1;
- }
- x = x + mx;
- pasos++;
- }
- void dibujar() {
- Console::SetCursorPosition(x, y);
- for (int j = 0; j < 5; j++) {
- CambiarColorLetra(VERDE);
- cout << img[j];
- CambiarColorLetra(BLANCO);
- }
- }
- void borrar() {
- Console::SetCursorPosition(x, y);
- for (int j = 0; j < 5; j++) {
- cout << " ";
- }
- }
- };
- typedef struct personaje {
- short x;
- short y;
- int pasos;
- char imagen[4][7] = { { ' ',' ',' ','A',' ',' ',' ' },{ ' ',':','M','M','M',':',' ' },{ '<',' ',' ','=',' ',' ','>' },{ '"',' ',' ',' ',' ',' ','"' } };
- personaje(short a = 40, short b = 35, short c = 0) {
- x = a;
- y = b;
- pasos = c;
- }
- void animar(char direccion) {
- borrar();
- mover(direccion);
- dibujar();
- }
- void dibujar() {
- for (int i = 0; i < 4; i++) {
- Console::SetCursorPosition(x, y + i);
- for (int j = 0; j < 7; j++) {
- if (i == 0 && j == 3 || i == 1 && j == 1 || i == 1 && j == 5) {
- CambiarColorLetra(ROJO);
- CambiarColorFondo(NEGRO);
- }
- else if (i == 1 && (j == 2 || j == 3 || j == 4)) {
- CambiarColorLetra(BLANCO);
- CambiarColorFondo(BLANCO);
- }
- else if (i == 2 && j == 0 || i == 2 && j == 3 || i == 2 && j == 6) {
- CambiarColorLetra(AZUL);
- CambiarColorFondo(NEGRO);
- }
- else if (i == 2 && (j == 1 || j == 2 || j == 4 || j == 5)) {
- CambiarColorFondo(AZUL);
- }
- else if (i == 3 && j == 0 || i == 3 && j == 6) {
- CambiarColorLetra(AMARILLO);
- CambiarColorFondo(NEGRO);
- }
- else {
- CambiarColorLetra(BLANCO);
- CambiarColorFondo(NEGRO);
- }
- cout << imagen[i][j];
- }
- }
- }
- void borrar() {
- for (int i = 0; i < 4; i++) {
- Console::SetCursorPosition(x, y + i);
- for (int j = 0; j < 7; j++) {
- cout << ' ';
- }
- }
- }
- void mover(char direccion) {
- switch (toupper(direccion)) {
- case IZQUIERDA: if (x>2)x--; pasos++; break;
- case DERECHA: if (x<89)x++; pasos++; break;
- }
- }
- };
- void nivel1() {
- personaje* personajeA = new personaje[1];
- vector<bala*> disparar; vector<bala*> disparajefe; vector<bala*> haz;
- vector<avispa*> avi;
- vector<mari*> maripos;
- bool continuar = true;
- int cantidad = 0; int tiempo = 0; int tiempo1 = 0; short vidas = 3;
- avi.push_back(new avispa(48, 2)); avi.push_back(new avispa(48, 2)); avi.push_back(new avispa(48, 2)); avi.push_back(new avispa(48, 2));
- maripos.push_back(new mari(52, 2)); maripos.push_back(new mari(52, 2)); maripos.push_back(new mari(52, 2)); maripos.push_back(new mari(52, 2));
- //tanda 1 -----------------------------------------------------------------------------------------------------------------------------------------------
- while (continuar) {
- if (tiempo == 20) {
- tiempo = 0;
- tiempo1++;;
- Console::SetCursorPosition(10, 4);
- cout << "TIEMPO: " << tiempo1;
- }
- Console::SetCursorPosition(85, 4);
- cout << "PUNTAJE: " << cantidad;
- Console::SetCursorPosition(45, 3);
- cout << "TANDA " << 1;
- Console::SetCursorPosition(45, 2);
- cout << "NIVEL 1";
- if (toupper(kbhit())) {
- char direccion = getch();
- personajeA[0].animar(direccion);
- if (direccion == 32) {
- disparar.push_back(new bala(personajeA->x + 3, personajeA->y - 1));
- }
- }
- //inicia movimiento de avispa
- for (int l = 0; l < avi.size(); l++) {
- avi[l]->animar(40 - 7 * l, 90 - 7 * l, l);
- }
- //inicia movimiento de mariposa
- for (int m = 0; m < maripos.size(); m++) {
- maripos[m]->animar(40 - 7 * m, 90 - 7 * m, m);
- }
- //crea y elimina disparos
- for (int i = 0; i < disparar.size(); i++) {
- disparar[i]->animar();
- if (disparar[i]->y == 2) {
- delete disparar[i];
- disparar.erase(disparar.begin() + i);
- i--;
- }
- }
- for (int j = 0; j < disparar.size(); j++) {
- //borra avispa
- for (int k = 0; k < avi.size(); k++) {
- if (disparar[j]->colision(avi[k]->x, avi[k]->y, 3, 2) && disparar[j]->y>2) {
- avi[k]->borrar();
- delete avi[k];
- avi.erase(avi.begin() + k);
- Console::SetCursorPosition(85, 4);
- cantidad = cantidad + 100;
- cout << "PUNTAJE: " << cantidad;
- }
- }
- //borra mariposa
- for (int k = 0; k < maripos.size(); k++) {
- if (disparar[j]->colision(maripos[k]->x, maripos[k]->y, 3, 2) && disparar[j]->y>2) {
- maripos[k]->borrar();
- delete maripos[k];
- maripos.erase(maripos.begin() + k);
- Console::SetCursorPosition(85, 4);
- cantidad = cantidad + 160;
- cout << "PUNTAJE: " << cantidad;
- }
- }
- }
- if (cantidad == 1040) {
- continuar = false;
- }
- tiempo++;
- _sleep(20);
- }
- //tanda 2 -----------------------------------------------------------------------------------------------------------
- bool continuar2 = true;
- vector<comandante*> jefe;
- vector<mari*> mariposa2;
- mariposa2.push_back(new mari(5, 2)); mariposa2.push_back(new mari(5, 2)); mariposa2.push_back(new mari(5, 2)); mariposa2.push_back(new mari(5, 2));
- jefe.push_back(new comandante(5, 8));
- while (continuar2) {
- if (tiempo == 20) {
- tiempo = 0;
- tiempo1++;;
- Console::SetCursorPosition(10, 4);
- cout << "TIEMPO: " << tiempo1;
- }
- Console::SetCursorPosition(85,3);
- cout << "VIDAS: " << vidas;
- Console::SetCursorPosition(45, 3);
- cout << "TANDA " << 2;
- Console::SetCursorPosition(45, 2);
- cout << "NIVEL 1";
- Console::SetCursorPosition(85, 4);
- cout << "PUNTAJE: " << cantidad;
- if (toupper(kbhit())) {
- char direccion = getch();
- personajeA[0].animar(direccion);
- if (direccion == 32) {
- disparar.push_back(new bala(personajeA->x + 3, personajeA->y - 1));
- }
- }
- //crea y elimina disparos
- for (int i = 0; i < disparar.size(); i++) {
- disparar[i]->animar();
- if (disparar[i]->y == 2) {
- delete disparar[i];
- disparar.erase(disparar.begin() + i);
- i--;
- }
- }
- // anima y elimina las balas del JEFE
- for (int f = 0; f < disparajefe.size(); f++) {
- disparajefe[f]->animar2();
- if (disparajefe[f]->y == 35) {
- vidas--;
- delete disparajefe[f];
- disparajefe.erase(disparajefe.begin() + f);
- f--;
- }
- }
- //haz
- for (int f = 0; f < haz.size(); f++) {
- haz[f]->animar3();
- if (personajeA[0].y==haz[f]->y ) {
- delete haz[f];
- haz.erase(haz.begin() + f);
- f--;
- }
- }
- //dibuja mariposa
- for (int m = 0; m < mariposa2.size(); m++) {
- mariposa2[m]->animar(40 - 7 * m, 90 - 7 * m, m);
- }
- //dibuja comandantes
- for (int i = 0; i < jefe.size(); i++) {
- if (personajeA[0].x == jefe[i]->x) {
- disparajefe.push_back(new bala(jefe[i]->x, jefe[i]->y));
- }
- if (jefe[i]->x == 50) {
- haz.push_back(new bala(jefe[i]->x, jefe[i]->y));
- }
- jefe[i]->animar();
- }
- for (int j = 0; j < disparar.size(); j++) {
- //borra mariposa
- for (int k = 0; k < mariposa2.size(); k++) {
- if (disparar[j]->colision(mariposa2[k]->x, mariposa2[k]->y, 3, 0) && disparar[j]->y > 2) {
- mariposa2[k]->borrar();
- delete mariposa2[k];
- mariposa2.erase(mariposa2.begin() + k);
- Console::SetCursorPosition(85, 4);
- cantidad = cantidad + 160;
- cout << "PUNTAJE: " << cantidad;
- }
- }
- //borra acomandante
- for (int k = 0; k < jefe.size(); k++) {
- if (disparar[j]->colision(jefe[k]->x, jefe[k]->y, 3, 0) && disparar[j]->y > 2) {
- jefe[k]->borrar();
- delete jefe[k];
- jefe.erase(jefe.begin() + k);
- Console::SetCursorPosition(85, 4);
- cantidad = cantidad + 400;
- cout << "PUNTAJE: " << cantidad;
- }
- }
- }
- if (vidas == -1) {
- continuar2 = false;
- system("cls");
- perdiste();
- system("pause>0"); break;
- }
- if (cantidad == 2080) {
- continuar2 = false;
- }
- tiempo++;
- _sleep(20);
- }
- // tanda 3-------------------------------------------------------------------------------------------------------------------------------
- bool continuar3 = true;
- vector<mari*> mariposa3;
- mariposa3.push_back(new mari(20, 2)); mariposa3.push_back(new mari(20, 2)); mariposa3.push_back(new mari(20, 2)); mariposa3.push_back(new mari(20, 2));
- mariposa3.push_back(new mari(20, 2)); mariposa3.push_back(new mari(20, 2));
- while (continuar3) {
- if (tiempo == 20) {
- tiempo = 0; tiempo1++;;
- Console::SetCursorPosition(10, 4);
- cout << "TIEMPO: " << tiempo1;
- }
- Console::SetCursorPosition(85, 3);
- cout << "VIDAS: " << vidas;
- Console::SetCursorPosition(45, 3);
- cout << "TANDA " << 3;
- Console::SetCursorPosition(45, 2);
- cout << "NIVEL 1";
- Console::SetCursorPosition(85, 4);
- cout << "PUNTAJE: " << cantidad;
- if (toupper(kbhit())) {
- char direccion = getch();
- personajeA[0].animar(direccion);
- if (direccion == 32) {
- disparar.push_back(new bala(personajeA->x + 3, personajeA->y - 1));
- }
- }
- //crea y elimina disparos
- for (int i = 0; i < disparar.size(); i++) {
- disparar[i]->animar();
- if (disparar[i]->y == 2) {
- delete disparar[i];
- disparar.erase(disparar.begin() + i);
- i--;
- }
- }
- //dibuja mariposa
- for (int m = 0; m < mariposa3.size(); m++) {
- mariposa3[m]->animar(40 - 7 * m, 90 - 7 * m, m);
- }
- for (int j = 0; j < disparar.size(); j++) {
- //borra mariposa
- for (int k = 0; k < mariposa3.size(); k++) {
- if (disparar[j]->colision(mariposa3[k]->x, mariposa3[k]->y, 3, 0) && disparar[j]->y > 2) {
- mariposa3[k]->borrar();
- delete mariposa3[k];
- mariposa3.erase(mariposa3.begin() + k);
- Console::SetCursorPosition(85, 4);
- cantidad = cantidad + 160;
- cout << "PUNTAJE: " << cantidad;
- }
- }
- }
- if (vidas == -1) {
- continuar3 = false;
- system("cls");
- perdiste();
- system("pause>0"); break;
- }
- if (cantidad == 3040) {
- continuar3 = false;
- }
- tiempo++;
- _sleep(20);
- }
- //tanda 4 --------------------------------------------------------------------------------------------------------------
- bool continuar4 = true;
- vector<avispa*> avispas2;
- avispas2.push_back(new avispa(55, 2)); avispas2.push_back(new avispa(55, 2)); avispas2.push_back(new avispa(55, 2)); avispas2.push_back(new avispa(55, 2));
- avispas2.push_back(new avispa(55, 2)); avispas2.push_back(new avispa(55, 2));
- while (continuar4) {
- if (tiempo == 20) {
- tiempo = 0; tiempo1++;;
- Console::SetCursorPosition(10, 4);
- cout << "TIEMPO: " << tiempo1;
- }
- Console::SetCursorPosition(85, 3);
- cout << "VIDAS: " << vidas;
- Console::SetCursorPosition(45, 3);
- cout << "TANDA " << 4;
- Console::SetCursorPosition(45, 2);
- cout << "NIVEL 1";
- Console::SetCursorPosition(85, 4);
- cout << "PUNTAJE: " << cantidad;
- if (toupper(kbhit())) {
- char direccion = getch();
- personajeA[0].animar(direccion);
- if (direccion == 32) {
- disparar.push_back(new bala(personajeA->x + 3, personajeA->y - 1));
- }
- }
- //crea y elimina disparos
- for (int i = 0; i < disparar.size(); i++) {
- disparar[i]->animar();
- if (disparar[i]->y == 2) {
- delete disparar[i];
- disparar.erase(disparar.begin() + i);
- i--;
- }
- }
- //inicia movimiento de avispa
- for (int l = 0; l < avispas2.size(); l++) {
- avispas2[l]->animar(40 - 7 * l, 90 - 7 * l, l);
- }
- for (int j = 0; j < disparar.size(); j++) {
- //borra avispa
- for (int k = 0; k < avispas2.size(); k++) {
- if (disparar[j]->colision(avispas2[k]->x, avispas2[k]->y, 3, 2) && disparar[j]->y>2) {
- avispas2[k]->borrar();
- delete avispas2[k];
- avispas2.erase(avispas2.begin() + k);
- Console::SetCursorPosition(85, 4);
- cantidad = cantidad + 100;
- cout << "PUNTAJE: " << cantidad;
- }
- }
- }
- if (vidas == -1) {
- continuar4 = false;
- system("cls");
- perdiste();
- system("pause>0"); break;
- }
- if (cantidad == 3640) {
- continuar4 = false;
- }
- tiempo++;
- _sleep(20);
- }
- delete personajeA, avi, disparar, maripos, maripos, jefe,disparajefe,avispas2;
- }
- void nivel2() {
- personaje* personajeA = new personaje[1];
- vector<bala*> disparar; vector<bala*> disparajefe; vector<bala*> haz;
- vector<avispa*> avi;
- vector<mari*> maripos;
- bool continuar = true;
- int cantidad = 0; int tiempo = 0; int tiempo1 = 0; short vidas = 3;
- avi.push_back(new avispa(48, 2)); avi.push_back(new avispa(48, 2)); avi.push_back(new avispa(48, 2)); avi.push_back(new avispa(48, 2));
- maripos.push_back(new mari(52, 2)); maripos.push_back(new mari(52, 2)); maripos.push_back(new mari(52, 2)); maripos.push_back(new mari(52, 2)); maripos.push_back(new mari(52, 2));
- //tanda 1 -----------------------------------------------------------------------------------------------------------------------------------------------
- while (continuar) {
- if (tiempo == 20) {
- tiempo = 0;
- tiempo1++;;
- Console::SetCursorPosition(10, 4);
- cout << "TIEMPO: " << tiempo1;
- }
- Console::SetCursorPosition(85, 4);
- cout << "PUNTAJE: " << cantidad;
- Console::SetCursorPosition(45, 3);
- cout << "TANDA " << 1;
- Console::SetCursorPosition(45, 2);
- cout << "NIVEL 2";
- if (toupper(kbhit())) {
- char direccion = getch();
- personajeA[0].animar(direccion);
- if (direccion == 32) {
- disparar.push_back(new bala(personajeA->x + 3, personajeA->y - 1));
- }
- }
- //inicia movimiento de avispa
- for (int l = 0; l < avi.size(); l++) {
- avi[l]->animar(40 - 7 * l, 90 - 7 * l, l);
- }
- //inicia movimiento de mariposa
- for (int m = 0; m < maripos.size(); m++) {
- if (maripos[0]) {
- maripos[0]->borrar();
- maripos[0]->aleatorio();
- maripos[0]->dibujar();
- }
- maripos[m]->animar(40 - 7 * m, 90 - 7 * m, m);
- }
- //crea y elimina disparos
- for (int i = 0; i < disparar.size(); i++) {
- disparar[i]->animar();
- if (disparar[i]->y == 2) {
- delete disparar[i];
- disparar.erase(disparar.begin() + i);
- i--;
- }
- }
- for (int j = 0; j < disparar.size(); j++) {
- //borra avispa
- for (int k = 0; k < avi.size(); k++) {
- if (disparar[j]->colision(avi[k]->x, avi[k]->y, 3, 2) && disparar[j]->y>2) {
- avi[k]->borrar();
- delete avi[k];
- avi.erase(avi.begin() + k);
- Console::SetCursorPosition(85, 4);
- cantidad = cantidad + 100;
- cout << "PUNTAJE: " << cantidad;
- }
- }
- //borra mariposa
- for (int k = 0; k < maripos.size(); k++) {
- if (disparar[j]->colision(maripos[k]->x, maripos[k]->y, 3, 2) && disparar[j]->y>2) {
- maripos[k]->borrar();
- delete maripos[k];
- maripos.erase(maripos.begin() + k);
- Console::SetCursorPosition(85, 4);
- cantidad = cantidad + 160;
- cout << "PUNTAJE: " << cantidad;
- }
- }
- }
- if (cantidad == 1200) {
- continuar = false;
- }
- tiempo++;
- _sleep(20);
- }
- //tanda 2 -----------------------------------------------------------------------------------------------------------
- bool continuar2 = true;
- vector<comandante*> jefe;
- vector<mari*> mariposa2;
- mariposa2.push_back(new mari(5, 10)); mariposa2.push_back(new mari(5, 10)); mariposa2.push_back(new mari(5, 10)); mariposa2.push_back(new mari(5, 10));
- jefe.push_back(new comandante(5, 10)); jefe.push_back(new comandante(90, 10));
- while (continuar2) {
- if (tiempo == 20) {
- tiempo = 0;
- tiempo1++;;
- Console::SetCursorPosition(10, 4);
- cout << "TIEMPO: " << tiempo1;
- }
- Console::SetCursorPosition(85, 3);
- cout << "VIDAS: " << vidas;
- Console::SetCursorPosition(45, 3);
- cout << "TANDA " << 2;
- Console::SetCursorPosition(45, 2);
- cout << "NIVEL 2";
- Console::SetCursorPosition(85, 4);
- cout << "PUNTAJE: " << cantidad;
- if (toupper(kbhit())) {
- char direccion = getch();
- personajeA[0].animar(direccion);
- if (direccion == 32) {
- disparar.push_back(new bala(personajeA->x + 3, personajeA->y - 1));
- }
- }
- //crea y elimina disparos
- for (int i = 0; i < disparar.size(); i++) {
- disparar[i]->animar();
- if (disparar[i]->y == 2) {
- delete disparar[i];
- disparar.erase(disparar.begin() + i);
- i--;
- }
- }
- // anima y elimina las balas del JEFE
- for (int f = 0; f < disparajefe.size(); f++) {
- disparajefe[f]->animar2();
- if (disparajefe[f]->y == 35) {
- vidas--;
- delete disparajefe[f];
- disparajefe.erase(disparajefe.begin() + f);
- f--;
- }
- }
- //haz
- for (int f = 0; f < haz.size(); f++) {
- haz[f]->animar3();
- if (personajeA[0].y == haz[f]->y) {
- delete haz[f];
- haz.erase(haz.begin() + f);
- f--;
- }
- }
- //dibuja mariposa
- for (int m = 0; m < mariposa2.size(); m++) {
- mariposa2[m]->animar(40 - 7 * m, 90 - 7 * m, m);
- }
- //dibuja comandantes
- for (int i = 0; i < jefe.size(); i++) {
- if (personajeA[0].x == jefe[i]->x) {
- disparajefe.push_back(new bala(jefe[i]->x, jefe[i]->y));
- }
- if (jefe[i]->x == 50) {
- haz.push_back(new bala(jefe[i]->x, jefe[i]->y));
- }
- jefe[i]->animar();
- }
- for (int j = 0; j < disparar.size(); j++) {
- //borra mariposa
- for (int k = 0; k < mariposa2.size(); k++) {
- if (disparar[j]->colision(mariposa2[k]->x, mariposa2[k]->y, 3, 0) && disparar[j]->y > 2) {
- mariposa2[k]->borrar();
- delete mariposa2[k];
- mariposa2.erase(mariposa2.begin() + k);
- Console::SetCursorPosition(85, 4);
- cantidad = cantidad + 160;
- cout << "PUNTAJE: " << cantidad;
- }
- }
- //borra acomandante
- for (int k = 0; k < jefe.size(); k++) {
- if (disparar[j]->colision(jefe[k]->x, jefe[k]->y, 3, 0) && disparar[j]->y > 2) {
- jefe[k]->borrar();
- delete jefe[k];
- jefe.erase(jefe.begin() + k);
- Console::SetCursorPosition(85, 4);
- cantidad = cantidad + 400;
- cout << "PUNTAJE: " << cantidad;
- }
- }
- }
- if (vidas == -1) {
- continuar2 = false;
- system("cls");
- perdiste();
- system("pause>0"); break;
- }
- if (cantidad == 2640) {
- continuar2 = false;
- }
- tiempo++;
- _sleep(20);
- }
- // tanda 3-------------------------------------------------------------------------------------------------------------------------------
- bool continuar3 = true;
- vector<mari*> mariposa3; vector<mari*> mariposa31;
- mariposa3.push_back(new mari(10, 2)); mariposa3.push_back(new mari(10, 2)); mariposa3.push_back(new mari(10, 2)); mariposa3.push_back(new mari(10, 2));
- mariposa31.push_back(new mari(10, 10)); mariposa31.push_back(new mari(10, 10)); mariposa31.push_back(new mari(10, 10)); mariposa31.push_back(new mari(10, 10));
- while (continuar3) {
- if (tiempo == 20) {
- tiempo = 0; tiempo1++;;
- Console::SetCursorPosition(10, 4);
- cout << "TIEMPO: " << tiempo1;
- }
- Console::SetCursorPosition(85, 3);
- cout << "VIDAS: " << vidas;
- Console::SetCursorPosition(45, 3);
- cout << "TANDA " << 3;
- Console::SetCursorPosition(45, 2);
- cout << "NIVEL 2";
- Console::SetCursorPosition(85, 4);
- cout << "PUNTAJE: " << cantidad;
- if (toupper(kbhit())) {
- char direccion = getch();
- personajeA[0].animar(direccion);
- if (direccion == 32) {
- disparar.push_back(new bala(personajeA->x + 3, personajeA->y - 1));
- }
- }
- //crea y elimina disparos
- for (int i = 0; i < disparar.size(); i++) {
- disparar[i]->animar();
- if (disparar[i]->y == 2) {
- delete disparar[i];
- disparar.erase(disparar.begin() + i);
- i--;
- }
- }
- //dibuja mariposa
- for (int m = 0; m < mariposa3.size(); m++) {
- mariposa3[m]->animar(40 - 7 * m, 90 - 7 * m, m);
- }
- for (int n = 0; n < mariposa31.size(); n++) {
- mariposa31[n]->animar(40 - 7 * n, 90 - 7 * n, n);
- }
- for (int j = 0; j < disparar.size(); j++) {
- //borra mariposa
- for (int k = 0; k < mariposa3.size(); k++) {
- if (disparar[j]->colision(mariposa3[k]->x, mariposa3[k]->y, 3, 0) && disparar[j]->y > 2) {
- mariposa3[k]->borrar();
- delete mariposa3[k];
- mariposa3.erase(mariposa3.begin() + k);
- Console::SetCursorPosition(85, 4);
- cantidad = cantidad + 160;
- cout << "PUNTAJE: " << cantidad;
- }
- }
- for (int l = 0; l < mariposa31.size(); l++) {
- if (disparar[j]->colision(mariposa31[l]->x, mariposa31[l]->y, 3, 0) && disparar[j]->y > 2) {
- mariposa31[l]->borrar();
- delete mariposa31[l];
- mariposa31.erase(mariposa31.begin() + l);
- Console::SetCursorPosition(85, 4);
- cantidad = cantidad + 160;
- cout << "PUNTAJE: " << cantidad;
- }
- }
- }
- if (vidas == -1) {
- continuar3 = false;
- system("cls");
- perdiste();
- system("pause>0"); break;
- }
- if (cantidad == 3920) {
- continuar3 = false;
- }
- tiempo++;
- _sleep(20);
- }
- //tanda 4 --------------------------------------------------------------------------------------------------------------
- bool continuar4 = true;
- vector<avispa*> avispas2; vector<avispa*> avispas21;
- avispas2.push_back(new avispa(80, 2)); avispas2.push_back(new avispa(80, 2)); avispas2.push_back(new avispa(80, 2)); avispas2.push_back(new avispa(80, 2));
- avispas21.push_back(new avispa(80, 12)); avispas21.push_back(new avispa(80, 12)); avispas21.push_back(new avispa(80, 12)); avispas21.push_back(new avispa(80, 12));
- while (continuar4) {
- if (tiempo == 20) {
- tiempo = 0; tiempo1++;;
- Console::SetCursorPosition(10, 4);
- cout << "TIEMPO: " << tiempo1;
- }
- Console::SetCursorPosition(85, 3);
- cout << "VIDAS: " << vidas;
- Console::SetCursorPosition(45, 3);
- cout << "TANDA " << 4;
- Console::SetCursorPosition(45, 2);
- cout << "NIVEL 2";
- Console::SetCursorPosition(85, 4);
- cout << "PUNTAJE: " << cantidad;
- if (toupper(kbhit())) {
- char direccion = getch();
- personajeA[0].animar(direccion);
- if (direccion == 32) {
- disparar.push_back(new bala(personajeA->x + 3, personajeA->y - 1));
- }
- }
- //crea y elimina disparos
- for (int i = 0; i < disparar.size(); i++) {
- disparar[i]->animar();
- if (disparar[i]->y == 2) {
- delete disparar[i];
- disparar.erase(disparar.begin() + i);
- i--;
- }
- }
- //inicia movimiento de avispa
- for (int l = 0; l < avispas2.size(); l++) {
- avispas2[l]->animar(40 - 7 * l, 90 - 7 * l, l);
- }
- for (int n = 0; n < avispas21.size(); n++) {
- avispas21[n]->animar(40 - 7 * n, 90 - 7 * n, n);
- }
- for (int j = 0; j < disparar.size(); j++) {
- //borra avispa
- for (int k = 0; k < avispas2.size(); k++) {
- if (disparar[j]->colision(avispas2[k]->x, avispas2[k]->y, 3, 2) && disparar[j]->y>2) {
- avispas2[k]->borrar();
- delete avispas2[k];
- avispas2.erase(avispas2.begin() + k);
- Console::SetCursorPosition(85, 4);
- cantidad = cantidad + 100;
- cout << "PUNTAJE: " << cantidad;
- }
- }
- for (int c = 0; c < avispas21.size(); c++) {
- if (disparar[j]->colision(avispas21[c]->x, avispas21[c]->y, 3, 2) && disparar[j]->y>2) {
- avispas21[c]->borrar();
- delete avispas21[c];
- avispas21.erase(avispas21.begin() + c);
- Console::SetCursorPosition(85, 4);
- cantidad = cantidad + 100;
- cout << "PUNTAJE: " << cantidad;
- }
- }
- }
- if (vidas == -1) {
- continuar4 = false;
- system("cls");
- perdiste();
- system("pause>0"); break;
- }
- if (cantidad == 4720) {
- continuar4 = false;
- }
- tiempo++;
- _sleep(20);
- }
- delete personajeA, avi, disparar, maripos, maripos, jefe, disparajefe, avispas2;
- }
- void nivel3() {
- personaje* personajeA = new personaje[1];
- vector<bala*> disparar; vector<bala*> disparajefe; vector<bala*> haz;
- vector<avispa*> avi;
- vector<mari*> maripos;
- bool continuar = true;
- int cantidad = 0; int tiempo = 0; int tiempo1 = 0; short vidas = 3;
- avi.push_back(new avispa(48, 2)); avi.push_back(new avispa(48, 2)); avi.push_back(new avispa(48, 2)); avi.push_back(new avispa(48, 2)); avi.push_back(new avispa(48, 2));
- maripos.push_back(new mari(52, 2)); maripos.push_back(new mari(52, 2)); maripos.push_back(new mari(52, 2)); maripos.push_back(new mari(52, 2)); maripos.push_back(new mari(52, 2));
- //tanda 1 -----------------------------------------------------------------------------------------------------------------------------------------------
- while (continuar) {
- if (tiempo == 20) {
- tiempo = 0;
- tiempo1++;;
- Console::SetCursorPosition(10, 4);
- cout << "TIEMPO: " << tiempo1;
- }
- Console::SetCursorPosition(85, 4);
- cout << "PUNTAJE: " << cantidad;
- Console::SetCursorPosition(45, 3);
- cout << "TANDA " << 1;
- Console::SetCursorPosition(45, 2);
- cout << "NIVEL 3";
- if (toupper(kbhit())) {
- char direccion = getch();
- personajeA[0].animar(direccion);
- if (direccion == 32) {
- disparar.push_back(new bala(personajeA->x + 3, personajeA->y - 1));
- }
- }
- //inicia movimiento de avispa
- for (int l = 0; l < avi.size(); l++) {
- avi[l]->animar(40 - 7 * l, 90 - 7 * l, l);
- }
- //inicia movimiento de mariposa
- for (int m = 0; m < maripos.size(); m++) {
- maripos[m]->animar(40 - 7 * m, 90 - 7 * m, m);
- }
- //crea y elimina disparos
- for (int i = 0; i < disparar.size(); i++) {
- disparar[i]->animar();
- if (disparar[i]->y == 2) {
- delete disparar[i];
- disparar.erase(disparar.begin() + i);
- i--;
- }
- }
- for (int j = 0; j < disparar.size(); j++) {
- //borra avispa
- for (int k = 0; k < avi.size(); k++) {
- if (disparar[j]->colision(avi[k]->x, avi[k]->y, 3, 2) && disparar[j]->y>2) {
- avi[k]->borrar();
- delete avi[k];
- avi.erase(avi.begin() + k);
- Console::SetCursorPosition(85, 4);
- cantidad = cantidad + 100;
- cout << "PUNTAJE: " << cantidad;
- }
- }
- //borra mariposa
- for (int k = 0; k < maripos.size(); k++) {
- if (disparar[j]->colision(maripos[k]->x, maripos[k]->y, 3, 2) && disparar[j]->y>2) {
- maripos[k]->borrar();
- delete maripos[k];
- maripos.erase(maripos.begin() + k);
- Console::SetCursorPosition(85, 4);
- cantidad = cantidad + 160;
- cout << "PUNTAJE: " << cantidad;
- }
- }
- }
- if (vidas == -1) {
- continuar = false;
- system("cls");
- perdiste();
- system("pause>0"); break;
- }
- if (cantidad == 1300) {
- continuar = false;
- }
- tiempo++;
- _sleep(20);
- }
- //tanda 2 -----------------------------------------------------------------------------------------------------------
- bool continuar2 = true;
- vector<comandante*> jefe;
- vector<mari*> mariposa2;
- mariposa2.push_back(new mari(5, 2)); mariposa2.push_back(new mari(5, 2)); mariposa2.push_back(new mari(5, 2)); mariposa2.push_back(new mari(5, 2));
- jefe.push_back(new comandante(5, 8)); jefe.push_back(new comandante(95, 8)); jefe.push_back(new comandante(5, 10));
- while (continuar2) {
- if (tiempo == 20) {
- tiempo = 0;
- tiempo1++;;
- Console::SetCursorPosition(10, 4);
- cout << "TIEMPO: " << tiempo1;
- }
- Console::SetCursorPosition(85, 3);
- cout << "VIDAS: " << vidas;
- Console::SetCursorPosition(45, 3);
- cout << "TANDA " << 2;
- Console::SetCursorPosition(45, 2);
- cout << "NIVEL 3";
- Console::SetCursorPosition(85, 4);
- cout << "PUNTAJE: " << cantidad;
- if (toupper(kbhit())) {
- char direccion = getch();
- personajeA[0].animar(direccion);
- if (direccion == 32) {
- disparar.push_back(new bala(personajeA->x + 3, personajeA->y - 1));
- }
- }
- //crea y elimina disparos
- for (int i = 0; i < disparar.size(); i++) {
- disparar[i]->animar();
- if (disparar[i]->y == 2) {
- delete disparar[i];
- disparar.erase(disparar.begin() + i);
- i--;
- }
- }
- // anima y elimina las balas del JEFE
- for (int f = 0; f < disparajefe.size(); f++) {
- disparajefe[f]->animar2();
- if (disparajefe[f]->y == 35) {
- vidas--;
- delete disparajefe[f];
- disparajefe.erase(disparajefe.begin() + f);
- f--;
- }
- }
- //haz
- for (int f = 0; f < haz.size(); f++) {
- haz[f]->animar3();
- if (personajeA[0].y == haz[f]->y) {
- delete haz[f];
- haz.erase(haz.begin() + f);
- f--;
- }
- }
- //dibuja mariposa
- for (int m = 0; m < mariposa2.size(); m++) {
- mariposa2[m]->animar(40 - 7 * m, 90 - 7 * m, m);
- }
- //dibuja comandantes
- for (int i = 0; i < jefe.size(); i++) {
- if (personajeA[0].x == jefe[i]->x) {
- disparajefe.push_back(new bala(jefe[i]->x, jefe[i]->y));
- }
- if (jefe[i]->x == 50) {
- haz.push_back(new bala(jefe[i]->x, jefe[i]->y));
- }
- jefe[i]->animar();
- }
- for (int j = 0; j < disparar.size(); j++) {
- //borra mariposa
- for (int k = 0; k < mariposa2.size(); k++) {
- if (disparar[j]->colision(mariposa2[k]->x, mariposa2[k]->y, 3, 0) && disparar[j]->y > 2) {
- mariposa2[k]->borrar();
- delete mariposa2[k];
- mariposa2.erase(mariposa2.begin() + k);
- Console::SetCursorPosition(85, 4);
- cantidad = cantidad + 160;
- cout << "PUNTAJE: " << cantidad;
- }
- }
- //borra acomandante
- for (int k = 0; k < jefe.size(); k++) {
- if (disparar[j]->colision(jefe[k]->x, jefe[k]->y, 3, 0) && disparar[j]->y > 2) {
- jefe[k]->borrar();
- delete jefe[k];
- jefe.erase(jefe.begin() + k);
- Console::SetCursorPosition(85, 4);
- cantidad = cantidad + 400;
- cout << "PUNTAJE: " << cantidad;
- }
- }
- }
- if (vidas == -1) {
- continuar2 = false;
- system("cls");
- perdiste();
- system("pause>0"); break;
- }
- if (cantidad == 3140) {
- continuar2 = false;
- }
- tiempo++;
- _sleep(20);
- }
- // tanda 3-------------------------------------------------------------------------------------------------------------------------------
- bool continuar3 = true;
- vector<mari*> mariposa3;
- mariposa3.push_back(new mari(20, 2)); mariposa3.push_back(new mari(20, 2)); mariposa3.push_back(new mari(20, 2)); mariposa3.push_back(new mari(20, 2));
- mariposa3.push_back(new mari(20, 2)); mariposa3.push_back(new mari(20, 2)); mariposa3.push_back(new mari(20, 2)); mariposa3.push_back(new mari(20, 2));
- while (continuar3) {
- if (tiempo == 20) {
- tiempo = 0; tiempo1++;;
- Console::SetCursorPosition(10, 4);
- cout << "TIEMPO: " << tiempo1;
- }
- Console::SetCursorPosition(85, 3);
- cout << "VIDAS: " << vidas;
- Console::SetCursorPosition(45, 3);
- cout << "TANDA " << 3;
- Console::SetCursorPosition(45, 2);
- cout << "NIVEL 3";
- Console::SetCursorPosition(85, 4);
- cout << "PUNTAJE: " << cantidad;
- if (toupper(kbhit())) {
- char direccion = getch();
- personajeA[0].animar(direccion);
- if (direccion == 32) {
- disparar.push_back(new bala(personajeA->x + 3, personajeA->y - 1));
- }
- }
- //crea y elimina disparos
- for (int i = 0; i < disparar.size(); i++) {
- disparar[i]->animar();
- if (disparar[i]->y == 2) {
- delete disparar[i];
- disparar.erase(disparar.begin() + i);
- i--;
- }
- }
- //dibuja mariposa
- for (int m = 0; m < mariposa3.size(); m++) {
- mariposa3[m]->animar(40 - 7 * m, 90 - 7 * m, m);
- }
- for (int j = 0; j < disparar.size(); j++) {
- //borra mariposa
- for (int k = 0; k < mariposa3.size(); k++) {
- if (disparar[j]->colision(mariposa3[k]->x, mariposa3[k]->y, 3, 0) && disparar[j]->y > 2) {
- mariposa3[k]->borrar();
- delete mariposa3[k];
- mariposa3.erase(mariposa3.begin() + k);
- Console::SetCursorPosition(85, 4);
- cantidad = cantidad + 160;
- cout << "PUNTAJE: " << cantidad;
- }
- }
- }
- if (vidas == -1) {
- continuar3 = false;
- system("cls");
- perdiste();
- system("pause>0"); break;
- }
- if (cantidad == 4420) {
- continuar3 = false;
- }
- tiempo++;
- _sleep(20);
- }
- //tanda 4 --------------------------------------------------------------------------------------------------------------
- bool continuar4 = true;
- vector<avispa*> avispas2;
- avispas2.push_back(new avispa(55, 2)); avispas2.push_back(new avispa(55, 2)); avispas2.push_back(new avispa(55, 2)); avispas2.push_back(new avispa(55, 2));
- avispas2.push_back(new avispa(55, 2)); avispas2.push_back(new avispa(55, 2)); avispas2.push_back(new avispa(55, 2)); avispas2.push_back(new avispa(55, 2));
- while (continuar4) {
- if (tiempo == 20) {
- tiempo = 0; tiempo1++;;
- Console::SetCursorPosition(10, 4);
- cout << "TIEMPO: " << tiempo1;
- }
- Console::SetCursorPosition(85, 3);
- cout << "VIDAS: " << vidas;
- Console::SetCursorPosition(45, 3);
- cout << "TANDA " << 4;
- Console::SetCursorPosition(45, 2);
- cout << "NIVEL 3";
- Console::SetCursorPosition(85, 4);
- cout << "PUNTAJE: " << cantidad;
- if (toupper(kbhit())) {
- char direccion = getch();
- personajeA[0].animar(direccion);
- if (direccion == 32) {
- disparar.push_back(new bala(personajeA->x + 3, personajeA->y - 1));
- }
- }
- //crea y elimina disparos
- for (int i = 0; i < disparar.size(); i++) {
- disparar[i]->animar();
- if (disparar[i]->y == 2) {
- delete disparar[i];
- disparar.erase(disparar.begin() + i);
- i--;
- }
- }
- //inicia movimiento de avispa
- for (int l = 0; l < avispas2.size(); l++) {
- avispas2[l]->animar(40 - 7 * l, 90 - 7 * l, l);
- }
- for (int j = 0; j < disparar.size(); j++) {
- //borra avispa
- for (int k = 0; k < avispas2.size(); k++) {
- if (disparar[j]->colision(avispas2[k]->x, avispas2[k]->y, 3, 2) && disparar[j]->y>2) {
- avispas2[k]->borrar();
- delete avispas2[k];
- avispas2.erase(avispas2.begin() + k);
- Console::SetCursorPosition(85, 4);
- cantidad = cantidad + 100;
- cout << "PUNTAJE: " << cantidad;
- }
- }
- }
- if (vidas == -1) {
- continuar4 = false;
- system("cls");
- perdiste();
- system("pause>0"); break;
- }
- if (cantidad == 5220) {
- continuar4 = false;
- }
- tiempo++;
- _sleep(20);
- }
- delete personajeA, avi, disparar, maripos, jefe, disparajefe, avispas2;
- }
- void nivel4() {
- personaje* personajeA = new personaje[1];
- vector<bala*> disparar; vector<bala*> disparajefe; vector<bala*> haz;
- vector<avispa*> avi;
- vector<mari*> maripos;
- bool continuar = true;
- int cantidad = 0; int tiempo = 0; int tiempo1 = 0; short vidas = 3;
- avi.push_back(new avispa(48, 2)); avi.push_back(new avispa(48, 2)); avi.push_back(new avispa(48, 2)); avi.push_back(new avispa(48, 2)); avi.push_back(new avispa(48, 2)); avi.push_back(new avispa(48, 2));
- maripos.push_back(new mari(52, 2)); maripos.push_back(new mari(52, 2)); maripos.push_back(new mari(52, 2)); maripos.push_back(new mari(52, 2)); maripos.push_back(new mari(52, 2)); maripos.push_back(new mari(52, 2));
- //tanda 1 -----------------------------------------------------------------------------------------------------------------------------------------------
- while (continuar) {
- if (tiempo == 20) {
- tiempo = 0;
- tiempo1++;;
- Console::SetCursorPosition(10, 4);
- cout << "TIEMPO: " << tiempo1;
- }
- Console::SetCursorPosition(85, 4);
- cout << "PUNTAJE: " << cantidad;
- Console::SetCursorPosition(45, 3);
- cout << "TANDA " << 1;
- Console::SetCursorPosition(45, 2);
- cout << "NIVEL 4";
- if (toupper(kbhit())) {
- char direccion = getch();
- personajeA[0].animar(direccion);
- if (direccion == 32) {
- disparar.push_back(new bala(personajeA->x + 3, personajeA->y - 1));
- }
- }
- //inicia movimiento de avispa
- for (int l = 0; l < avi.size(); l++) {
- if (avi[0]) {
- avi[0]->borrar();
- avi[0]->aleatorio();
- avi[0]->dibujar();
- }
- avi[l]->animar(40 - 7 * l, 90 - 7 * l, l);
- }
- //inicia movimiento de mariposa
- for (int m = 0; m < maripos.size(); m++) {
- if (maripos[0]) {
- maripos[0]->borrar();
- maripos[0]->aleatorio();
- maripos[0]->dibujar();
- }
- maripos[m]->animar(40 - 7 * m, 90 - 7 * m, m);
- }
- //crea y elimina disparos
- for (int i = 0; i < disparar.size(); i++) {
- disparar[i]->animar();
- if (disparar[i]->y == 2) {
- delete disparar[i];
- disparar.erase(disparar.begin() + i);
- i--;
- }
- }
- for (int j = 0; j < disparar.size(); j++) {
- //borra avispa
- for (int k = 0; k < avi.size(); k++) {
- if (disparar[j]->colision(avi[k]->x, avi[k]->y, 3, 2) && disparar[j]->y>2) {
- avi[k]->borrar();
- delete avi[k];
- avi.erase(avi.begin() + k);
- Console::SetCursorPosition(85, 4);
- cantidad = cantidad + 100;
- cout << "PUNTAJE: " << cantidad;
- }
- }
- //borra mariposa
- for (int k = 0; k < maripos.size(); k++) {
- if (disparar[j]->colision(maripos[k]->x, maripos[k]->y, 3, 2) && disparar[j]->y>2) {
- maripos[k]->borrar();
- delete maripos[k];
- maripos.erase(maripos.begin() + k);
- Console::SetCursorPosition(85, 4);
- cantidad = cantidad + 160;
- cout << "PUNTAJE: " << cantidad;
- }
- }
- }
- if (cantidad == 1560) {
- continuar = false;
- }
- tiempo++;
- _sleep(20);
- }
- //tanda 2 -----------------------------------------------------------------------------------------------------------
- bool continuar2 = true;
- vector<comandante*> jefe;
- vector<mari*> mariposa2;
- mariposa2.push_back(new mari(5, 10)); mariposa2.push_back(new mari(5, 10)); mariposa2.push_back(new mari(5, 10)); mariposa2.push_back(new mari(5, 10)); mariposa2.push_back(new mari(5, 10));
- jefe.push_back(new comandante(60, 10)); jefe.push_back(new comandante(80, 10)); jefe.push_back(new comandante(70, 13)); jefe.push_back(new comandante(90, 13));
- while (continuar2) {
- if (tiempo == 20) {
- tiempo = 0;
- tiempo1++;;
- Console::SetCursorPosition(10, 4);
- cout << "TIEMPO: " << tiempo1;
- }
- Console::SetCursorPosition(85, 3);
- cout << "VIDAS: " << vidas;
- Console::SetCursorPosition(45, 3);
- cout << "TANDA " << 2;
- Console::SetCursorPosition(45, 2);
- cout << "NIVEL 4";
- Console::SetCursorPosition(85, 4);
- cout << "PUNTAJE: " << cantidad;
- if (toupper(kbhit())) {
- char direccion = getch();
- personajeA[0].animar(direccion);
- if (direccion == 32) {
- disparar.push_back(new bala(personajeA->x + 3, personajeA->y - 1));
- }
- }
- //crea y elimina disparos
- for (int i = 0; i < disparar.size(); i++) {
- disparar[i]->animar();
- if (disparar[i]->y == 2) {
- delete disparar[i];
- disparar.erase(disparar.begin() + i);
- i--;
- }
- }
- // anima y elimina las balas del JEFE
- for (int f = 0; f < disparajefe.size(); f++) {
- disparajefe[f]->animar2();
- if (disparajefe[f]->y == 35) {
- vidas--;
- delete disparajefe[f];
- disparajefe.erase(disparajefe.begin() + f);
- f--;
- }
- }
- //haz
- for (int f = 0; f < haz.size(); f++) {
- haz[f]->animar3();
- if (personajeA[0].y == haz[f]->y) {
- delete haz[f];
- haz.erase(haz.begin() + f);
- f--;
- }
- }
- //dibuja mariposa
- for (int m = 0; m < mariposa2.size(); m++) {
- mariposa2[m]->animar(40 - 7 * m, 90 - 7 * m, m);
- }
- //dibuja comandantes
- for (int i = 0; i < jefe.size(); i++) {
- if (personajeA[0].x == jefe[i]->x) {
- disparajefe.push_back(new bala(jefe[i]->x, jefe[i]->y));
- }
- if (jefe[i]->x == 50) {
- haz.push_back(new bala(jefe[i]->x, jefe[i]->y));
- }
- jefe[i]->animar();
- }
- for (int j = 0; j < disparar.size(); j++) {
- //borra mariposa
- for (int k = 0; k < mariposa2.size(); k++) {
- if (disparar[j]->colision(mariposa2[k]->x, mariposa2[k]->y, 3, 0) && disparar[j]->y > 2) {
- mariposa2[k]->borrar();
- delete mariposa2[k];
- mariposa2.erase(mariposa2.begin() + k);
- Console::SetCursorPosition(85, 4);
- cantidad = cantidad + 160;
- cout << "PUNTAJE: " << cantidad;
- }
- }
- //borra acomandante
- for (int k = 0; k < jefe.size(); k++) {
- if (disparar[j]->colision(jefe[k]->x, jefe[k]->y, 3, 0) && disparar[j]->y > 2) {
- jefe[k]->borrar();
- delete jefe[k];
- jefe.erase(jefe.begin() + k);
- Console::SetCursorPosition(85, 4);
- cantidad = cantidad + 400;
- cout << "PUNTAJE: " << cantidad;
- }
- }
- }
- if (vidas == -1) {
- continuar2 = false;
- system("cls");
- perdiste();
- system("pause>0"); break;
- }
- if (cantidad == 3960) {
- continuar2 = false;
- }
- tiempo++;
- _sleep(20);
- }
- // tanda 3-------------------------------------------------------------------------------------------------------------------------------
- bool continuar3 = true;
- vector<mari*> mariposa3; vector<mari*> mariposa31;
- mariposa3.push_back(new mari(10, 2)); mariposa3.push_back(new mari(10, 2)); mariposa3.push_back(new mari(10, 2)); mariposa3.push_back(new mari(10, 2)); mariposa3.push_back(new mari(10, 2));
- mariposa31.push_back(new mari(10, 10)); mariposa31.push_back(new mari(10, 10)); mariposa31.push_back(new mari(10, 10)); mariposa31.push_back(new mari(10, 10)); mariposa31.push_back(new mari(10, 10));
- while (continuar3) {
- if (tiempo == 20) {
- tiempo = 0; tiempo1++;;
- Console::SetCursorPosition(10, 4);
- cout << "TIEMPO: " << tiempo1;
- }
- Console::SetCursorPosition(85, 3);
- cout << "VIDAS: " << vidas;
- Console::SetCursorPosition(45, 3);
- cout << "TANDA " << 3;
- Console::SetCursorPosition(45, 2);
- cout << "NIVEL 4";
- Console::SetCursorPosition(85, 4);
- cout << "PUNTAJE: " << cantidad;
- if (toupper(kbhit())) {
- char direccion = getch();
- personajeA[0].animar(direccion);
- if (direccion == 32) {
- disparar.push_back(new bala(personajeA->x + 3, personajeA->y - 1));
- }
- }
- //crea y elimina disparos
- for (int i = 0; i < disparar.size(); i++) {
- disparar[i]->animar();
- if (disparar[i]->y == 2) {
- delete disparar[i];
- disparar.erase(disparar.begin() + i);
- i--;
- }
- }
- //dibuja mariposa
- for (int m = 0; m < mariposa3.size(); m++) {
- mariposa3[m]->animar(40 - 7 * m, 90 - 7 * m, m);
- }
- for (int n = 0; n < mariposa31.size(); n++) {
- mariposa31[n]->animar(40 - 7 * n, 90 - 7 * n, n);
- }
- for (int j = 0; j < disparar.size(); j++) {
- //borra mariposa
- for (int k = 0; k < mariposa3.size(); k++) {
- if (disparar[j]->colision(mariposa3[k]->x, mariposa3[k]->y, 3, 0) && disparar[j]->y > 2) {
- mariposa3[k]->borrar();
- delete mariposa3[k];
- mariposa3.erase(mariposa3.begin() + k);
- Console::SetCursorPosition(85, 4);
- cantidad = cantidad + 160;
- cout << "PUNTAJE: " << cantidad;
- }
- }
- for (int l = 0; l < mariposa31.size(); l++) {
- if (disparar[j]->colision(mariposa31[l]->x, mariposa31[l]->y, 3, 0) && disparar[j]->y > 2) {
- mariposa31[l]->borrar();
- delete mariposa31[l];
- mariposa31.erase(mariposa31.begin() + l);
- Console::SetCursorPosition(85, 4);
- cantidad = cantidad + 160;
- cout << "PUNTAJE: " << cantidad;
- }
- }
- }
- if (vidas == -1) {
- continuar3 = false;
- system("cls");
- perdiste();
- system("pause>0"); break;
- }
- if (cantidad == 5560) {
- continuar3 = false;
- }
- tiempo++;
- _sleep(20);
- }
- //tanda 4 --------------------------------------------------------------------------------------------------------------
- bool continuar4 = true;
- vector<avispa*> avispas2; vector<avispa*> avispas21;
- avispas2.push_back(new avispa(80, 2)); avispas2.push_back(new avispa(80, 2)); avispas2.push_back(new avispa(80, 2)); avispas2.push_back(new avispa(80, 2)); avispas2.push_back(new avispa(80, 2));
- avispas21.push_back(new avispa(80, 12)); avispas21.push_back(new avispa(80, 12)); avispas21.push_back(new avispa(80, 12)); avispas21.push_back(new avispa(80, 12)); avispas21.push_back(new avispa(80, 12));
- while (continuar4) {
- if (tiempo == 20) {
- tiempo = 0; tiempo1++;;
- Console::SetCursorPosition(10, 4);
- cout << "TIEMPO: " << tiempo1;
- }
- Console::SetCursorPosition(85, 3);
- cout << "VIDAS: " << vidas;
- Console::SetCursorPosition(45, 3);
- cout << "TANDA " << 4;
- Console::SetCursorPosition(45, 2);
- cout << "NIVEL 4";
- Console::SetCursorPosition(85, 4);
- cout << "PUNTAJE: " << cantidad;
- if (toupper(kbhit())) {
- char direccion = getch();
- personajeA[0].animar(direccion);
- if (direccion == 32) {
- disparar.push_back(new bala(personajeA->x + 3, personajeA->y - 1));
- }
- }
- //crea y elimina disparos
- for (int i = 0; i < disparar.size(); i++) {
- disparar[i]->animar();
- if (disparar[i]->y == 2) {
- delete disparar[i];
- disparar.erase(disparar.begin() + i);
- i--;
- }
- }
- //inicia movimiento de avispa
- for (int l = 0; l < avispas2.size(); l++) {
- avispas2[l]->animar(40 - 7 * l, 90 - 7 * l, l);
- }
- for (int n = 0; n < avispas21.size(); n++) {
- avispas21[n]->animar(40 - 7 * n, 90 - 7 * n, n);
- }
- for (int j = 0; j < disparar.size(); j++) {
- //borra avispa
- for (int k = 0; k < avispas2.size(); k++) {
- if (disparar[j]->colision(avispas2[k]->x, avispas2[k]->y, 3, 2) && disparar[j]->y>2) {
- avispas2[k]->borrar();
- delete avispas2[k];
- avispas2.erase(avispas2.begin() + k);
- Console::SetCursorPosition(85, 4);
- cantidad = cantidad + 100;
- cout << "PUNTAJE: " << cantidad;
- }
- }
- for (int c = 0; c < avispas21.size(); c++) {
- if (disparar[j]->colision(avispas21[c]->x, avispas21[c]->y, 3, 2) && disparar[j]->y>2) {
- avispas21[c]->borrar();
- delete avispas21[c];
- avispas21.erase(avispas21.begin() + c);
- Console::SetCursorPosition(85, 4);
- cantidad = cantidad + 100;
- cout << "PUNTAJE: " << cantidad;
- }
- }
- }
- if (vidas == -1) {
- continuar3 = false;
- system("cls");
- perdiste();
- system("pause>0"); break;
- }
- if (cantidad == 6560) {
- continuar4 = false;
- system("cls");
- ganaste();
- }
- tiempo++;
- _sleep(20);
- }
- delete personajeA, avi, disparar, maripos, maripos, jefe, disparajefe, avispas2;
- }
- void main() {
- Console::CursorVisible = false;
- Console::SetWindowSize(110, 42);
- galaga(); system("cls");
- instrucciones(); system("cls");
- level1(); system("cls");
- marco();
- nivel1(); system("cls");
- level2(); system("cls");
- marco();
- nivel2(); system("cls");
- level3(); system("cls");
- marco();
- nivel3(); system("cls");
- level4(); system("cls");
- marco();
- nivel4(); system("cls");
- return;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement