Advertisement
GonzaloGuerreroP

Juego_Version5

Nov 17th, 2019
151
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 20.02 KB | None | 0 0
  1. #include <iostream>
  2. #include <conio.h>
  3. #include <ctime>
  4. #include <stdlib.h>
  5. #include <list>
  6. using namespace System;
  7. using namespace std;
  8. #define FILAS 20
  9. #define COLUMNAS 75
  10. #define ARRIBA 72
  11. #define ABAJO 80
  12. #define IZQUIERDA 75
  13. #define DERECHA 77
  14. #define LIMITEX 20
  15. #define LIMITEY 20
  16. #define LIMITER 5
  17. #define DISPARO 32
  18. #define DISPARO2 13
  19.  
  20. int matrizIntro[29][85] = {
  21. {1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1},
  22. {1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1},
  23. {1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1},
  24. {1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,2,0,0,0,2,2,0,0,2,2,2,2,2,2,0,0,2,2,2,2,0,0,2,2,2,2,0,0,0,0,2,2,2,2,2,0,2,2,2,2,0,0,0,0,0,0,0,0,0,0,0,0,0,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0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1},
  81. {1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1},
  82. };
  83.  
  84. int matrizcopia[29][85];
  85.  
  86. void copiasmatriz(int nivel) {
  87. for (int f = 0; f < 29; f++)
  88. {
  89. for (int c = 0; c < 85; c++)
  90. {
  91. if (nivel == 1) {
  92. matrizcopia[f][c] = matrizIntro[f][c];
  93. }
  94. if (nivel == 2) {
  95. matrizcopia[f][c] = matrizEstructura[f][c];
  96. }
  97. }
  98. }
  99. }
  100.  
  101. void imprimirmatriz(int nivel) {
  102. Console::Clear();
  103. for (int i = 0; i < 29; i++) {
  104. for (int j = 0; j < 85; j++) {
  105. if (nivel == 1) {
  106. if (matrizcopia[i][j] == 0) {
  107. cout << " ";
  108. }
  109. if (matrizcopia[i][j] == 1) {
  110. Console::ForegroundColor = ConsoleColor::Yellow;
  111. cout << "*";
  112. }
  113. if (matrizcopia[i][j] == 2) {
  114. Console::ForegroundColor = ConsoleColor::Blue;
  115. cout << char(219);
  116. }
  117. }
  118. if (nivel == 2) {
  119. if (matrizcopia[i][j] == 1) {
  120. Console::ForegroundColor = ConsoleColor::Red;
  121. cout << "*";
  122. }
  123. if (matrizcopia[i][j] == 0) {
  124. cout << " ";
  125. }
  126. }
  127.  
  128. }
  129. cout << "\n";
  130. }
  131. }
  132.  
  133. typedef struct Nave {
  134. int _x, _y, _vidas;
  135. public:
  136. Nave(int x, int y) {
  137. _x = x;
  138. _y = y;
  139. _vidas = 3;
  140. }
  141. int X() { return _x; }
  142. int Y() { return _y; }
  143. void animar(short tecla) {
  144. borrar();
  145. mover(tecla);
  146. dibujar();
  147. }
  148. void borrar() {
  149. Console::SetCursorPosition(_x, _y);
  150. cout << " ";
  151. Console::SetCursorPosition(_x - 1, _y + 1);
  152. cout << " ";
  153. Console::SetCursorPosition(_x + 1, _y + 1);
  154. cout << " ";
  155. Console::SetCursorPosition(_x - 1, _y + 1);
  156. cout << " ";
  157. Console::SetCursorPosition(_x, _y + 2);
  158. cout << " ";
  159. Console::SetCursorPosition(_x - 1, _y + 2);
  160. cout << " ";
  161. Console::SetCursorPosition(_x + 1, _y + 2);
  162. cout << " ";
  163. Console::SetCursorPosition(_x + 2, _y + 2);
  164. cout << " ";
  165. Console::SetCursorPosition(_x - 2, _y + 2);
  166. cout << " ";
  167. Console::SetCursorPosition(_x - 2, _y + 3);
  168. cout << " ";
  169. Console::SetCursorPosition(_x + 2, _y + 3);
  170. cout << " ";
  171. }
  172. void mover(short tecla) {
  173. short direccion;
  174. direccion = toupper(tecla);
  175. switch (direccion) {
  176. case 'W': if (_y - 1 >= 1) {
  177. _y--;
  178. break;
  179. }
  180. case 'S': if (_y + 4 <= 27) {
  181. _y++;
  182. break;
  183. }
  184. case 'A': if (_x - 2 >= 2) {
  185. _x--;
  186. break;
  187. }
  188. case 'D': if (_x + 3 <= 83) {
  189. _x++;
  190. break;
  191. }
  192. }
  193. }
  194. void dibujar() {
  195. Console::SetCursorPosition(_x, _y);
  196. Console::ForegroundColor = ConsoleColor::Green;
  197. cout << char(219);
  198. Console::SetCursorPosition(_x, _y + 1);
  199. Console::ForegroundColor = ConsoleColor::Blue;
  200. cout << char(219);
  201. Console::SetCursorPosition(_x + 1, _y + 1);
  202. Console::ForegroundColor = ConsoleColor::Green;
  203. cout << char(219);
  204. Console::SetCursorPosition(_x - 1, _y + 1);
  205. Console::ForegroundColor = ConsoleColor::Green;
  206. cout << char(219);
  207. Console::SetCursorPosition(_x, _y + 2);
  208. Console::ForegroundColor = ConsoleColor::Blue;
  209. cout << char(223);
  210. Console::SetCursorPosition(_x - 1, _y + 2);
  211. Console::ForegroundColor = ConsoleColor::Blue;
  212. cout << char(219);
  213. Console::SetCursorPosition(_x + 1, _y + 2);
  214. Console::ForegroundColor = ConsoleColor::Blue;
  215. cout << char(219);
  216. Console::SetCursorPosition(_x + 2, _y + 2);
  217. Console::ForegroundColor = ConsoleColor::Green;
  218. cout << char(219);
  219. Console::SetCursorPosition(_x - 2, _y + 2);
  220. Console::ForegroundColor = ConsoleColor::Green;
  221. cout << char(219);
  222. Console::SetCursorPosition(_x - 2, _y + 3);
  223. Console::ForegroundColor = ConsoleColor::Green;
  224. cout << char(223);
  225. Console::SetCursorPosition(_x + 2, _y + 3);
  226. Console::ForegroundColor = ConsoleColor::Green;
  227. cout << char(223);
  228. }
  229. };
  230.  
  231. typedef struct NaveEnemiga {
  232. short _x, _y, _dx, _dy, _retraso;
  233. char _img;
  234. public:
  235. NaveEnemiga(short x, short y, short dx, short dy) {
  236. _x = x;
  237. _y = y;
  238. _dx = dx;
  239. _dy = dy;
  240. _retraso = 0;
  241. _img = (char)2;
  242. }
  243. void animar() {
  244. if (_retraso == LIMITER) {
  245.  
  246. borrar();
  247. mover();
  248. dibujar();
  249. _retraso = 0;
  250. }
  251. _retraso++;
  252. }
  253. void borrar() {
  254. Console::SetCursorPosition(_x, _y);
  255. cout << " ";
  256. }
  257. void mover() {
  258. if (_x + _dx < 1 || _x + _dx > 83) {
  259. _dx *= -1;
  260. _y++;
  261. }
  262. if (_y == 28) {
  263. _y = 1;
  264. }
  265. _x += _dx;
  266. }
  267. void dibujar() {
  268. Console::SetCursorPosition(_x, _y);
  269. Console::ForegroundColor = ConsoleColor::Green;
  270. cout << _img;
  271. }
  272. };
  273.  
  274. typedef struct Nave2 {
  275. int _x, _y, _vidas;
  276. public:
  277. Nave2(int x, int y) {
  278. _x = x;
  279. _y = y;
  280. _vidas = 3;
  281. }
  282. int X() { return _x; }
  283. int Y() { return _y; }
  284. void animar(short tecla) {
  285. borrar();
  286. mover(tecla);
  287. dibujar();
  288. }
  289. void borrar() {
  290. Console::SetCursorPosition(_x, _y);
  291. cout << " ";
  292. Console::SetCursorPosition(_x - 1, _y + 1);
  293. cout << " ";
  294. Console::SetCursorPosition(_x + 1, _y + 1);
  295. cout << " ";
  296. Console::SetCursorPosition(_x - 1, _y + 1);
  297. cout << " ";
  298. Console::SetCursorPosition(_x, _y + 2);
  299. cout << " ";
  300. Console::SetCursorPosition(_x - 1, _y + 2);
  301. cout << " ";
  302. Console::SetCursorPosition(_x + 1, _y + 2);
  303. cout << " ";
  304. Console::SetCursorPosition(_x + 2, _y + 2);
  305. cout << " ";
  306. Console::SetCursorPosition(_x - 2, _y + 2);
  307. cout << " ";
  308. Console::SetCursorPosition(_x - 2, _y + 3);
  309. cout << " ";
  310. Console::SetCursorPosition(_x + 2, _y + 3);
  311. cout << " ";
  312. }
  313. void mover(short tecla) {
  314. switch (tecla) {
  315. case ARRIBA: if (_y - 1 >= 1) _y--; break;
  316. case ABAJO: if (_y + 4 <= 27) _y++; break;
  317. case IZQUIERDA: if (_x - 2 >= 2) _x--; break;
  318. case DERECHA: if (_x + 3 <= 83) _x++; break;
  319. }
  320. }
  321. void dibujar() {
  322. Console::SetCursorPosition(_x, _y);
  323. Console::ForegroundColor = ConsoleColor::White;
  324. cout << char(219);
  325. Console::SetCursorPosition(_x, _y + 1);
  326. Console::ForegroundColor = ConsoleColor::Red;
  327. cout << char(219);
  328. Console::SetCursorPosition(_x + 1, _y + 1);
  329. Console::ForegroundColor = ConsoleColor::White;
  330. cout << char(219);
  331. Console::SetCursorPosition(_x - 1, _y + 1);
  332. Console::ForegroundColor = ConsoleColor::White;
  333. cout << char(219);
  334. Console::SetCursorPosition(_x, _y + 2);
  335. Console::ForegroundColor = ConsoleColor::Red;
  336. cout << char(223);
  337. Console::SetCursorPosition(_x - 1, _y + 2);
  338. Console::ForegroundColor = ConsoleColor::Red;
  339. cout << char(219);
  340. Console::SetCursorPosition(_x + 1, _y + 2);
  341. Console::ForegroundColor = ConsoleColor::Red;
  342. cout << char(219);
  343. Console::SetCursorPosition(_x + 2, _y + 2);
  344. Console::ForegroundColor = ConsoleColor::White;
  345. cout << char(219);
  346. Console::SetCursorPosition(_x - 2, _y + 2);
  347. Console::ForegroundColor = ConsoleColor::White;
  348. cout << char(219);
  349. Console::SetCursorPosition(_x - 2, _y + 3);
  350. Console::ForegroundColor = ConsoleColor::White;
  351. cout << char(223);
  352. Console::SetCursorPosition(_x + 2, _y + 3);
  353. Console::ForegroundColor = ConsoleColor::White;
  354. cout << char(223);
  355. }
  356. };
  357.  
  358. typedef struct BALA {
  359. int _x, _y;
  360. public:
  361. BALA(int x, int y) {
  362. _x = x;
  363. _y = y;
  364. }
  365. int X() { return _x;}
  366. int Y() {return _y;}
  367. void mover() {
  368. Console::SetCursorPosition(_x, _y);
  369. cout << " ";
  370. _y--;
  371. Console::SetCursorPosition(_x, _y);
  372. Console::ForegroundColor = ConsoleColor::Blue;
  373. cout << "*";
  374. }
  375.  
  376. bool fuera() {
  377. if (_y == 1) return true;
  378. return false;
  379. }
  380. };
  381.  
  382. void jugar(int players) {
  383. bool continuar = true;
  384. //BALAS de nave1 y nave3
  385. list<BALA*> B;
  386. list<BALA*> ::iterator it2;
  387. //BALAS de nave 2
  388. list<BALA*>B2;
  389. list<BALA*> ::iterator it3;
  390. //ENEMIGOS
  391. list<NaveEnemiga*> E;
  392. list<NaveEnemiga*>::iterator it;
  393. //CREA ENEMIGOS
  394. for (int i = 0; i < 20; i++)
  395. {
  396. E.push_back(new NaveEnemiga(2 + (i * 3), 2, -1, +1));
  397. }
  398. //CREA HEROES
  399. Nave nave1 = Nave(40, 20);
  400. Nave nave3 = Nave(30, 20);
  401. Nave2 nave2 = Nave2(55, 20);
  402. //JUEGO
  403. while (continuar) {
  404. if (kbhit()) {
  405. if (players == 1) {
  406. char tecla = getch();
  407. nave1.animar(tecla);
  408. if (tecla == DISPARO)
  409. B.push_back(new BALA(nave1.X(), nave1.Y()-1));
  410. }
  411. else if (players == 2) {
  412. char tecla = getch();
  413. nave3.animar(tecla);
  414. if (tecla == DISPARO)
  415. B.push_back(new BALA(nave3.X(), nave3.Y() - 1));
  416. nave2.animar(tecla);
  417. if (tecla == DISPARO2)
  418. B2.push_back(new BALA(nave2.X(), nave2.Y() - 1));
  419. }
  420. }
  421. //Imprime , mueve y borra las balas nave1 y nave3 (mueve con awsd)
  422. for (it2 = B.begin(); it2 != B.end(); it2) {
  423. (*it2)->mover();
  424. if ((*it2)->fuera()) {
  425. Console::SetCursorPosition((*it2)->X(), (*it2)->Y());
  426. cout << " ";
  427. delete(*it2);
  428. //da un valor de la lista al eliminado
  429. it2 = B.erase(it2);
  430. }
  431. else {
  432. it2++;
  433. }
  434. }
  435. //Imprime , mueve y borra las balas de nave2(mueve con flechitas)
  436. for (it3 = B2.begin(); it3 != B2.end(); it3) {
  437. (*it3)->mover();
  438. if ((*it3)->fuera()) {
  439. Console::SetCursorPosition((*it3)->X(), (*it3)->Y());
  440. cout << " ";
  441. delete(*it3);
  442. //da un valor de la lista al eliminado
  443. it3 = B2.erase(it3);
  444. }
  445. else {
  446. it3++;
  447. }
  448. }
  449. //Imprime a los enemigos
  450. for (it = E.begin(); it != E.end(); it++) {
  451. (*it)->animar();
  452. }
  453. _sleep(20);
  454. }
  455. }
  456.  
  457. int main() {
  458. int nivel;
  459. int players;
  460. Console::CursorVisible = false;
  461. copiasmatriz(nivel = 1);
  462. imprimirmatriz(nivel = 1);
  463. Console::SetCursorPosition(27, 27);
  464. Console::ForegroundColor = ConsoleColor::White;
  465. cout << "<<PRESIONE CUALQUIER TECLA PARA COMENZAR>>";
  466. if (getch()) {
  467. do {
  468. system("cls");
  469. copiasmatriz(nivel = 2);
  470. imprimirmatriz(nivel = 2);
  471. Console::SetCursorPosition(16, 14);
  472. Console::ForegroundColor = ConsoleColor::Green;
  473. cout << "Seleccione una cantidad de jugadores entre 1 y 2: ";
  474. cin >> players;
  475. } while (!(players == 1 || players == 2));
  476. system("cls");
  477. copiasmatriz(nivel = 2);
  478. imprimirmatriz(nivel = 2);
  479. jugar(players);
  480. }
  481. return 0;
  482. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement