Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include "stdafx.h"
- #include <iostream>
- #include <conio.h>
- #include <time.h>
- #include <stdlib.h>
- #define posX 40
- #define posY 7
- using namespace System;
- using namespace std;
- void niv_1()
- {
- Console::SetCursorPosition(20, 11);
- Console::ForegroundColor = ConsoleColor::Gray;
- cout << "888b 888 8888888 888 888 8888888888 888 d888 " << endl;
- cout << "\t\t 8888b 888 888 888 888 888 888 d8888 " << endl;
- cout << "\t\t 88888b 888 888 888 888 888 888 888 " << endl;
- cout << "\t\t 888Y88b 888 888 Y88b d88P 8888888 888 888 " << endl;
- cout << "\t\t 888 Y88b888 888 Y88b d88P 888 888 888 " << endl;
- cout << "\t\t 888 Y88888 888 Y88o88P 888 888 888 " << endl;
- cout << "\t\t 888 Y8888 888 Y888P 888 888 888 " << endl;
- cout << "\t\t 888 Y888 8888888 Y8P 8888888888 88888888 8888888";
- getch();
- Console::Clear();
- }
- void niv_2()
- {
- Console::SetCursorPosition(20, 11);
- Console::ForegroundColor = ConsoleColor::Magenta;
- cout << "888b 888 8888888 888 888 8888888888 888 .d8888b. " << endl;
- cout << "\t\t 8888b 888 888 888 888 888 888 d88P Y88b" << endl;
- cout << "\t\t 88888b 888 888 888 888 888 888 888" << endl;
- cout << "\t\t 888Y88b 888 888 Y88b d88P 8888888 888 .d88P" << endl;
- cout << "\t\t 888 Y88b888 888 Y88b d88P 888 888 .od888P' " << endl;
- cout << "\t\t 888 Y88888 888 Y88o88P 888 888 d88P' " << endl;
- cout << "\t\t 888 Y8888 888 Y888P 888 888 888' " << endl;
- cout << "\t\t 888 Y888 8888888 Y8P 8888888888 88888888 888888888 ";
- getch();
- Console::Clear();
- }
- void niv_3()
- {
- Console::SetCursorPosition(20, 11);
- Console::ForegroundColor = ConsoleColor::White;
- cout << "888b 888 8888888 888 888 8888888888 888 .d8888b. " << endl;
- cout << "\t\t 8888b 888 888 888 888 888 888 d88P Y88b" << endl;
- cout << "\t\t 88888b 888 888 888 888 888 888 .d88P" << endl;
- cout << "\t\t 888Y88b 888 888 Y88b d88P 8888888 888 8888' " << endl;
- cout << "\t\t 888 Y88b888 888 Y88b d88P 888 888 'Y8b." << endl;
- cout << "\t\t 888 Y88888 888 Y88o88P 888 888 888 888" << endl;
- cout << "\t\t 888 Y8888 888 Y888P 888 888 Y88b d88P" << endl;
- cout << "\t\t 888 Y888 8888888 Y8P 8888888888 88888888 'Y8888P' ";
- getch();
- Console::Clear();
- }
- void niv_4()
- {
- Console::SetCursorPosition(20, 11);
- Console::ForegroundColor = ConsoleColor::Cyan;
- cout << "888b 888 8888888 888 888 8888888888 888 d8888 " << endl;
- cout << "\t\t 8888b 888 888 888 888 888 888 d8P888 " << endl;
- cout << "\t\t 88888b 888 888 888 888 888 888 d8P 888 " << endl;
- cout << "\t\t 888Y88b 888 888 Y88b d88P 8888888 888 d8P 888 " << endl;
- cout << "\t\t 888 Y88b888 888 Y88b d88P 888 888 d88 888 " << endl;
- cout << "\t\t 888 Y88888 888 Y88o88P 888 888 8888888888" << endl;
- cout << "\t\t 888 Y8888 888 Y888P 888 888 888" << endl;
- cout << "\t\t 888 Y888 8888888 Y8P 8888888888 88888888 888";
- getch();
- Console::Clear();
- }
- void niv_5()
- {
- Console::SetCursorPosition(20, 11);
- Console::ForegroundColor = ConsoleColor::Yellow;
- cout << "888b 888 8888888 888 888 8888888888 888 888888888" << endl;
- cout << "\t\t 8888b 888 888 888 888 888 888 888 " << endl;
- cout << "\t\t 88888b 888 888 888 888 888 888 888 " << endl;
- cout << "\t\t 888Y88b 888 888 Y88b d88P 8888888 888 8888888b." << endl;
- cout << "\t\t 888 Y88b888 888 Y88b d88P 888 888 'Y88b" << endl;
- cout << "\t\t 888 Y88888 888 Y88o88P 888 888 888" << endl;
- cout << "\t\t 888 Y8888 888 Y888P 888 888 Y88b d88P" << endl;
- cout << "\t\t 888 Y888 8888888 Y8P 8888888888 88888888 'Y8888P' ";
- getch();
- Console::Clear();
- }
- void niv_6()
- {
- Console::SetCursorPosition(20, 11);
- Console::ForegroundColor = ConsoleColor::Green;
- cout << "888b 888 8888888 888 888 8888888888 888 .d8888b. " << endl;
- cout << "\t\t 8888b 888 888 888 888 888 888 d88P Y88b" << endl;
- cout << "\t\t 88888b 888 888 888 888 888 888 888 " << endl;
- cout << "\t\t 888Y88b 888 888 Y88b d88P 8888888 888 888d888b. " << endl;
- cout << "\t\t 888 Y88b888 888 Y88b d88P 888 888 888P 'Y88b" << endl;
- cout << "\t\t 888 Y88888 888 Y88o88P 888 888 888 888" << endl;
- cout << "\t\t 888 Y8888 888 Y888P 888 888 Y88b d88P" << endl;
- cout << "\t\t 888 Y888 8888888 Y8P 8888888888 88888888 'Y8888P' ";
- getch();
- Console::Clear();
- }
- void niv_7()
- {
- Console::SetCursorPosition(20, 11);
- Console::ForegroundColor = ConsoleColor::Blue;
- cout << "888b 888 8888888 888 888 8888888888 888 8888888888 " << endl;
- cout << "\t\t 8888b 888 888 888 888 888 888 d88P " << endl;
- cout << "\t\t 88888b 888 888 888 888 888 888 d88P " << endl;
- cout << "\t\t 888Y88b 888 888 Y88b d88P 8888888 888 d88P " << endl;
- cout << "\t\t 888 Y88b888 888 Y88b d88P 888 888 88888888 " << endl;
- cout << "\t\t 888 Y88888 888 Y88o88P 888 888 d88P " << endl;
- cout << "\t\t 888 Y8888 888 Y888P 888 888 d88P " << endl;
- cout << "\t\t 888 Y888 8888888 Y8P 8888888888 88888888 d88P ";
- getch();
- Console::Clear();
- }
- void niv_8()
- {
- Console::SetCursorPosition(20, 11);
- Console::ForegroundColor = ConsoleColor::Red;
- cout << "888b 888 8888888 888 888 8888888888 888 .d8888b. " << endl;
- cout << "\t\t 8888b 888 888 888 888 888 888 d88P Y88b" << endl;
- cout << "\t\t 88888b 888 888 888 888 888 888 Y88b. d88P" << endl;
- cout << "\t\t 888Y88b 888 888 Y88b d88P 8888888 888 'Y88888' " << endl;
- cout << "\t\t 888 Y88b888 888 Y88b d88P 888 888 .d8P''Y8b." << endl;
- cout << "\t\t 888 Y88888 888 Y88o88P 888 888 888 888" << endl;
- cout << "\t\t 888 Y8888 888 Y888P 888 888 Y88b d88P" << endl;
- cout << "\t\t 888 Y888 8888888 Y8P 8888888888 88888888 'Y8888P'";
- getch();
- Console::Clear();
- }
- bool comprobarNivel(int **mapa)
- {
- for (int i = 0; i < 20; ++i)
- {
- for (int j = 0; j < 25; ++j)
- {
- if (mapa[i][j] == 2)
- {
- return false;
- }
- }
- }
- return true;
- }
- void borrarEnemigo1(int **mapa, int *xe1, int *ye1)
- {
- Console::SetCursorPosition(posX + *xe1, posY + *ye1);
- cout << " ";
- Console::SetCursorPosition(posX + *xe1, posY + *ye1);
- if (mapa[*ye1][*xe1] == 2)//Comida
- {
- Console::ForegroundColor = ConsoleColor::Cyan;
- cout << char(254);
- }
- }
- void dibujarEnemigo1(int *xe1, int *ye1)
- {
- Console::ForegroundColor = ConsoleColor::Yellow;
- Console::SetCursorPosition(posX + *xe1, posY + *ye1);
- cout << char(2);
- Console::ResetColor();
- }
- void moverEnemigo1(int **mapa, int *xe1, int *ye1, int *yei1, int *xei1)
- {
- static int dx = 1;
- if (*xe1 + dx >= 24 || *xe1 + dx <= 0)
- {
- dx *= -1;
- }
- borrarEnemigo1(mapa, xe1, ye1);
- *xe1 += dx;
- dibujarEnemigo1(xe1, ye1);
- }
- void borrarEnemigo2(int **mapa, int *xe2, int *ye2)
- {
- Console::SetCursorPosition(posX + *xe2, posY + *ye2);
- cout << " ";
- Console::SetCursorPosition(posX + *xe2, posY + *ye2);
- if (mapa[*ye2][*xe2] == 2)//Comida
- {
- Console::ForegroundColor = ConsoleColor::Cyan;
- cout << char(254);
- }
- }
- void dibujarEnemigo2(int *xe2, int *ye2)
- {
- Console::ForegroundColor = ConsoleColor::Yellow;
- Console::SetCursorPosition(posX + *xe2, posY + *ye2);
- cout << char(2);
- Console::ResetColor();
- }
- void moverEnemigo2(int **mapa, int *xe2, int *ye2, int *yei2, int *xei2)
- {
- static int dx = 1;
- if (*xe2 + dx >= 24 || *xe2 + dx <= 0)
- {
- dx *= -1;
- }
- borrarEnemigo2(mapa, xe2, ye2);
- *xe2 += dx;
- dibujarEnemigo2(xe2, ye2);
- }
- void dibujaPersonaje(int *x, int*y)
- {
- Console::SetCursorPosition(*x + posX, *y + posY);
- Console::ForegroundColor = ConsoleColor::Magenta;
- cout << (char)184;
- }
- void borrarPersonaje(int *x, int *y)
- {
- Console::SetCursorPosition(*x + posX, *y + posY);
- cout << " ";
- }
- void moverpersonaje(int **mapa, char *c, int *x, int *y, int *p, int *v, int*xi, int *yi)
- {
- switch (*c)
- {
- case 'w':
- {
- if (mapa[*y - 1][*x] != 1 && mapa[*y - 1][*x] != 5)
- {
- borrarPersonaje(x, y);
- --*y;
- }
- if (mapa[*y][*x] == 2)
- {
- *p += 10;
- Console::SetCursorPosition(posX + 39, posY + 5);
- Console::ForegroundColor = ConsoleColor::Green;
- cout << *p;
- mapa[*y][*x] = 9;
- }
- break;
- }
- case 's':
- {
- if (mapa[*y + 1][*x] != 1 && mapa[*y + 1][*x] != 5)
- {
- borrarPersonaje(x, y);
- ++*y;
- }
- if (mapa[*y][*x] == 2)
- {
- *p += 10;
- Console::SetCursorPosition(posX + 39, posY + 5);
- Console::ForegroundColor = ConsoleColor::Green;
- cout << *p;
- mapa[*y][*x] = 9;
- }
- break;
- }
- case 'a':
- {
- if (mapa[*y][*x - 1] != 1 && mapa[*y][*x - 1] != 5)
- {
- borrarPersonaje(x, y);
- --*x;
- }
- if (mapa[*y][*x] == 2)
- {
- *p += 10;
- Console::SetCursorPosition(posX + 39, posY + 5);
- Console::ForegroundColor = ConsoleColor::Green;
- cout << *p;
- mapa[*y][*x] = 9;
- }
- break;
- }
- case 'd':
- {
- if (mapa[*y][*x + 1] != 1 && mapa[*y][*x + 1] != 5)
- {
- borrarPersonaje(x, y);
- ++*x;
- }
- if (mapa[*y][*x] == 2)
- {
- *p += 10;
- Console::SetCursorPosition(posX + 39, posY + 5);
- Console::ForegroundColor = ConsoleColor::Green;
- cout << *p;
- mapa[*y][*x] = 9;
- }
- break;
- }
- }
- dibujaPersonaje(x, y);
- }
- void dibujaMenuCarga(int *r)
- {
- *r = 1 + rand() % 15;
- Console::ForegroundColor = ConsoleColor(*r);
- Console::SetCursorPosition(15, 2);
- cout << " :::::::: :::::::: ::: ::: ::::::::: " << endl;
- cout << "\t\t :+: :+::+: :+::+: :+: :+: :+: :+:" << endl;
- cout << "\t\t +:+ +:+ +:++:+ +:+ +:+ +:+ +:+ " << endl;
- cout << "\t\t +#++:++#+++#+ +:++#+ +#++:++#++:+#++:++#: " << endl;
- cout << "\t\t +#++#+ +#++#+ +#+ +#++#+ +#+ " << endl;
- cout << "\t\t #+# #+##+# #+##+# #+# #+##+# #+# " << endl;
- cout << "\t\t ######## ######## ############# ###### ### " << endl;
- cout << "\t\t :::::::::::::::::: ::: ::: " << endl;
- cout << "\t\t :+: :+: :+::+: :+: " << endl;
- cout << "\t\t +:+ +:+ +:+ +:+ +:+ " << endl;
- cout << "\t\t :#::+::# +#+ +:+ +#++:+ " << endl;
- cout << "\t\t +#+ +#+ +#+ +#+ +#+ " << endl;
- cout << "\t\t #+# #+# #+##+# #+# " << endl;
- cout << "\t\t ### ######## ### ### " << endl;
- cout << endl << endl;
- Console::ForegroundColor = ConsoleColor::Cyan;
- cout << "\t\t\t\t\t 1.-Jugar" << endl;
- Console::ForegroundColor = ConsoleColor::Green;
- cout << "\t\t\t\t\t 2.-Instrucciones" << endl;
- Console::ForegroundColor = ConsoleColor::Magenta;
- cout << "\t\t\t\t\t 3.-Salir" << endl;
- Console::ForegroundColor = ConsoleColor(*r);
- cout << endl << endl << endl << "\t\t\t\t\t * * **** ****" << endl;
- cout << "\t\t\t\t\t * * * * *" << endl;
- cout << "\t\t\t\t\t * * **** *" << endl;
- cout << "\t\t\t\t\t * * * *" << endl;
- cout << "\t\t\t\t\t ***** * ****" << endl;
- }
- void borrarPersonajeMenu()
- {
- Console::SetCursorPosition(15, 0);
- cout << " ";
- }
- void dibujarPersonajeMenu(int *xm, int *ym, int *v)
- {
- Console::SetCursorPosition(*xm, *ym);
- switch (*v)
- {
- case 0:
- cout << "U";
- break;
- case 1:
- cout << "P";
- break;
- case 2:
- cout << "C";
- break;
- case 3:
- cout << " ";
- break;
- }
- *v += 1;
- if (*v == 4)*v = 0;
- }
- void moverPersonajeMenu(int *xm, int *ym, int *v, int *r)
- {
- _sleep(80);
- if (*ym == 0 && *xm <= 91)
- {
- ++*xm;
- if (*xm == 92)
- {
- borrarPersonajeMenu();
- dibujaMenuCarga(r);
- *xm = 15;
- *v = 0;
- }
- }
- dibujarPersonajeMenu(xm, ym, v);
- }
- void instrucciones(int *v, int *xm, int *ym)
- {
- *v = *ym = 0;
- *xm = 15;
- getch();
- }
- void pu_vi(int *p, int *vi)
- {
- Console::ForegroundColor = ConsoleColor::Red;
- Console::SetCursorPosition(posX + 30, posY + 7);
- cout << "Vida: ";
- for (int i = 0; i < *vi; ++i)
- {
- cout << char(3);
- }Console::ForegroundColor = ConsoleColor::White;
- Console::SetCursorPosition(posX + 30, posY + 5);
- cout << "Puntaje: " << *p;
- }
- void posicion(int *xe1, int *ye1, int *x, int *y, int *xi, int *yi, int *xei1, int *yei1, int *xe2, int *ye2, int *xei2, int *yei2)
- {
- *xe1 = 1;
- *ye1 = 14;
- *xe2 = 1;
- *ye2 = 6;
- *x = 6;
- *y = 5;
- *xi = *x;
- *yi = *y;
- *xei1 = *xe1;
- *yei1 = *ye1;
- *xei2 = *xe2;
- *yei2 = *ye2;
- }
- void generarmapa(int **mapa, int m[20][25], int *cmpM)
- {
- for (int i = 0; i < 20; i++)
- {
- for (int j = 0; j < 25; ++j)
- {
- mapa[i][j] = m[i][j];
- }
- }
- *cmpM += 1;
- }
- void dibujamapa(int **mapa)
- {
- for (int i = 0; i < 20; ++i)
- {
- for (int j = 0; j < 25; ++j)
- {
- Console::SetCursorPosition(j + posX, i + posY);
- if (mapa[i][j] == 1)//pared
- {
- Console::ForegroundColor = ConsoleColor::Magenta;
- cout << char(219);
- }
- if (mapa[i][j] == 0)//espacios
- {
- cout << " ";
- }
- if (mapa[i][j] == 2)//Comida
- {
- Console::ForegroundColor = ConsoleColor::Cyan;
- cout << char(254);
- }
- if (mapa[i][j] == 5)//pared dentro
- {
- Console::ForegroundColor = ConsoleColor::Magenta;
- cout << char(219);
- }
- }
- }
- }
- void jugar(int *x, int *xe1, int *y, int *ye1, int *xi, int *yi, char*c, int*vi, bool *cmp, int **mapa, int *p, int *xei1, int *yei1, int *cmpM, int *xe2, int *ye2, int *xei2, int *yei2)
- {
- do
- {
- if (*x == *xe1 && *y == *ye1 && *cmpM <= 5)
- {
- borrarEnemigo1(mapa, xe1, ye1);
- *xe1 == *xei1;
- Console::ForegroundColor = ConsoleColor::Red;
- Console::SetCursorPosition(posX + 36, posY + 7);
- for (int i = 0; i < *vi; i++)
- {
- cout << " ";
- }
- --*vi;
- Console::SetCursorPosition(posX + 36, posY + 7);
- for (int i = 0; i < *vi; i++)
- {
- cout << char(3);
- }
- *x = *xi;
- *y = *yi;
- dibujaPersonaje(x, y);
- }
- if (*x == *xe2 && *y == *ye2 && *cmpM > 2)
- {
- borrarEnemigo2(mapa, xe2, ye2);
- *xe2 == *xei2;
- Console::ForegroundColor = ConsoleColor::Red;
- Console::SetCursorPosition(posX + 36, posY + 7);
- for (int i = 0; i < *vi; i++)
- {
- cout << " ";
- }
- --*vi;
- Console::SetCursorPosition(posX + 36, posY + 7);
- for (int i = 0; i < *vi; i++)
- {
- cout << char(3);
- }
- *x = *xi;
- *y = *yi;
- dibujaPersonaje(x, y);
- }
- if (kbhit())
- {
- *c = getch();
- *c = tolower(*c);
- moverpersonaje(mapa, c, x, y, p, vi, xi, yi);
- }
- _sleep(100);
- switch (*cmpM)
- {
- case 1:
- moverEnemigo1(mapa, xe1, ye1, yei1, xei1); break;
- case 2:
- moverEnemigo1(mapa, xe1, ye1, yei1, xei1); break;
- case 3:
- moverEnemigo1(mapa, xe1, ye1, yei1, xei1); moverEnemigo2(mapa, xe2, ye2, yei2, xei2); break;
- case 4:
- moverEnemigo1(mapa, xe1, ye1, yei1, xei1); moverEnemigo2(mapa, xe2, ye2, yei2, xei2); break;
- case 5:
- moverEnemigo1(mapa, xe1, ye1, yei1, xei1); moverEnemigo2(mapa, xe2, ye2, yei2, xei2); break;
- }
- *cmp = comprobarNivel(mapa);
- } while (*cmp == false && *vi != 0);//dos condiciones si la vida = 0 o termina el nivel
- }
- void main()
- {
- Console::SetWindowSize(110, 30);//tamaño de la pantalla
- Console::SetBufferSize(110, 30);//el tamaño que se vera cuando compile
- srand(time(NULL));
- Console::CursorVisible = false;
- int *v = new int;
- int *xm = new int;
- int *ym = new int;
- int *r = new int;
- char *opc = new char;
- *xm = 15;
- *ym = 0;
- *v = 0;
- dibujaMenuCarga(r);
- for (;;)
- {
- if (kbhit())
- {
- *opc = getch();
- if (*opc == '1')
- {
- Console::Clear();
- break;
- }
- else
- {
- switch (*opc)
- {
- case '2':
- Console::Clear();
- instrucciones(v, xm, ym);
- dibujaMenuCarga(r);
- break;
- case '3':
- exit(0);
- break;
- }
- }
- }
- moverPersonajeMenu(xm, ym, v, r);
- }
- int *xe1 = new int, *ye1 = new int;//posicion del enemigo 1
- int *xei1 = new int, *yei1 = new int;//posiciones iniciales del enemigo
- int *xe2 = new int, *ye2 = new int;//posicion del enemigo 2
- int *xei2 = new int, *yei2 = new int;//posicion inicial del enemigo 2
- int *x = new int, *y = new int;//posicion del jugador
- int *xi = new int, *yi = new int;//posicion inicial del personaje
- char *c = new char;//tecla del movimiento
- bool *cmp = new bool;//comprobar si termina el nivel
- int *p = new int, *vi = new int;//puntaje y vida
- int *cmpM = new int; *cmpM = 0;//comprueba el mapa para el numero de enemigos
- int **mapa = new int*[25];//crear la matriz del mapa todos del mismo tamaño
- for (int i = 0; i < 20; ++i)
- {
- mapa[i] = new int[25];
- }
- int m1[20][25] = { { 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,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,0,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,2,1 },
- { 1,0,0,0,0,2,0,0,2,0,2,0,2,0,2,0,0,0,0,0,2,0,0,0,1 },
- { 1,2,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,0,0,0,0,2,0,0,1 },
- { 1,0,1,0,2,0,1,1,0,0,1,0,0,2,0,1,0,0,1,1,0,0,1,0,1 },
- { 1,2,1,2,0,1,1,0,2,0,0,1,2,0,1,0,2,0,0,1,1,2,1,2,1 },
- { 1,0,1,0,2,1,0,2,0,2,0,2,1,1,0,2,0,2,0,2,1,0,1,0,1 },
- { 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1 } };
- *p = 0;
- *vi = 5;
- niv_1();//escribe nivel uno
- pu_vi(p, vi);//escribe los respectivos puntajes y vidas
- posicion(xe1, ye1, x, y, xi, yi, xei1, yei1, xe2, ye2, xei2, yei2);//pocisiones iniciales de todos
- generarmapa(mapa, m1, cmpM);//manda los datos del "mapa" a el mapa general
- dibujamapa(mapa);//dibuja el mapa
- dibujaPersonaje(x, y);//dibuja el personaje
- jugar(x, xe1, y, ye1, xi, yi, c, vi, cmp, mapa, p, xei1, yei1, cmpM, xe2, ye2, xei2, yei2);//aca esta lo bueno
- Console::Clear();
- niv_2();
- pu_vi(p, vi);
- posicion(xe1, ye1, x, y, xi, yi, xei1, yei1, xe2, ye2, xei2, yei2);
- generarmapa(mapa, m2, cmpM);
- dibujamapa(mapa);
- dibujaPersonaje(x, y);
- jugar(x, xe1, y, ye1, xi, yi, c, vi, cmp, mapa, p, xei1, yei1, cmpM, xe2, ye2, xei2, yei2);
- Console::Clear();
- niv_3();
- pu_vi(p, vi);
- posicion(xe1, ye1, x, y, xi, yi, xei1, yei1, xe2, ye2, xei2, yei2);
- generarmapa(mapa, m3, cmpM);
- dibujamapa(mapa);
- dibujaPersonaje(x, y);
- jugar(x, xe1, y, ye1, xi, yi, c, vi, cmp, mapa, p, xei1, yei1, cmpM, xe2, ye2, xei2, yei2);
- Console::Clear();
- niv_4();
- pu_vi(p, vi);
- posicion(xe1, ye1, x, y, xi, yi, xei1, yei1, xe2, ye2, xei2, yei2);
- generarmapa(mapa, m4, cmpM);
- dibujamapa(mapa);
- dibujaPersonaje(x, y);
- jugar(x, xe1, y, ye1, xi, yi, c, vi, cmp, mapa, p, xei1, yei1, cmpM, xe2, ye2, xei2, yei2);
- Console::Clear();
- niv_5();
- pu_vi(p, vi);
- posicion(xe1, ye1, x, y, xi, yi, xei1, yei1, xe2, ye2, xei2, yei2);
- generarmapa(mapa, m5, cmpM);
- dibujamapa(mapa);
- dibujaPersonaje(x, y);
- jugar(x, xe1, y, ye1, xi, yi, c, vi, cmp, mapa, p, xei1, yei1, cmpM, xe2, ye2, xei2, yei2);
- Console::Clear();
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement