Advertisement
GonzaloGuerreroP

Juego_Version12

Nov 23rd, 2019
314
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 60.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. int vidas1 = 5;
  20. int vidas2 = 5;
  21. int matrizIntro[29][85] = {
  22. {1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,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,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,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},
  25. {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,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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,0,0,0,0,0,0,0,0,0,0,0,0,1},
  82. {1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1},
  83. };
  84.  
  85. int matrizcopia[29][85];
  86.  
  87. void copiasmatriz(int nivel) {
  88. for (int f = 0; f < 29; f++)
  89. {
  90. for (int c = 0; c < 85; c++)
  91. {
  92. if (nivel == 1) {
  93. matrizcopia[f][c] = matrizIntro[f][c];
  94. }
  95. if (nivel == 2) {
  96. matrizcopia[f][c] = matrizEstructura[f][c];
  97. }
  98. }
  99. }
  100. }
  101.  
  102. void imprimirmatriz(int nivel) {
  103. Console::Clear();
  104. for (int i = 0; i < 29; i++) {
  105. for (int j = 0; j < 85; j++) {
  106. if (nivel == 1) {
  107. if (matrizcopia[i][j] == 0) {
  108. cout << " ";
  109. }
  110. if (matrizcopia[i][j] == 1) {
  111. Console::ForegroundColor = ConsoleColor::Yellow;
  112. cout << "*";
  113. }
  114. if (matrizcopia[i][j] == 2) {
  115. Console::ForegroundColor = ConsoleColor::Blue;
  116. cout << char(219);
  117. }
  118. }
  119. if (nivel == 2) {
  120. if (matrizcopia[i][j] == 1) {
  121. Console::ForegroundColor = ConsoleColor::Red;
  122. cout << "*";
  123. }
  124. if (matrizcopia[i][j] == 0) {
  125. cout << " ";
  126. }
  127. }
  128.  
  129. }
  130. cout << "\n";
  131. }
  132. }
  133.  
  134. typedef struct Nave {
  135. int _x, _y;
  136. public:
  137. Nave(int x, int y) {
  138. _x = x;
  139. _y = y;
  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. bool _colisiono = false;
  234. char _img;
  235. public:
  236. NaveEnemiga(short x, short y, short dx, short dy) {
  237. _x = x;
  238. _y = y;
  239. _dx = dx;
  240. _dy = dy;
  241. _retraso = 0;
  242. _img = (char)2;
  243. }
  244. int X() { return _x; }
  245. int Y() { return _y; }
  246. bool colisiono() { return _colisiono; }
  247. void marcar_colision() {
  248. _colisiono = true;
  249. }
  250. void animar() {
  251. if (_retraso == LIMITER) {
  252.  
  253. borrar();
  254. mover();
  255. dibujar();
  256. _retraso = 0;
  257. }
  258. _retraso++;
  259. }
  260. void borrar() {
  261. Console::SetCursorPosition(_x, _y);
  262. cout << " ";
  263. }
  264. void mover() {
  265. if (_x + _dx < 1 || _x + _dx > 83) {
  266. _dx *= -1;
  267. _y++;
  268. }
  269. if (_y == 28) {
  270. _y = 1;
  271. }
  272. _x += _dx;
  273. }
  274. void dibujar() {
  275. if (!(_colisiono)) {
  276. Console::SetCursorPosition(_x, _y);
  277. Console::ForegroundColor = ConsoleColor::Green;
  278. cout << _img;
  279. }
  280. }
  281.  
  282.  
  283. };
  284.  
  285. typedef struct Boss {
  286. short _x, _y, _dx, _dy, _retraso;
  287. bool _colisiono = false;
  288. char _img;
  289. public:
  290. Boss(short x, short y, short dx, short dy) {
  291. _x = x;
  292. _y = y;
  293. _dx = dx;
  294. _dy = dy;
  295. _retraso = 0;
  296. _img = (char)219;
  297. }
  298. int X() { return _x; }
  299. int Y() { return _y; }
  300. bool colisiono() { return _colisiono; }
  301. void marcar_colision() {
  302. _colisiono = true;
  303. }
  304. void animar() {
  305. if (_retraso == LIMITER) {
  306.  
  307. borrar();
  308. mover();
  309. dibujar();
  310. _retraso = 0;
  311. }
  312. _retraso++;
  313. }
  314. void borrar() {
  315. Console::SetCursorPosition(_x, _y);
  316. cout << " ";
  317. Console::SetCursorPosition(_x + 1, _y);
  318. cout << " ";
  319. Console::SetCursorPosition(_x + 2, _y);
  320. cout << " ";
  321. Console::SetCursorPosition(_x + 3, _y);
  322. cout << " ";
  323. Console::SetCursorPosition(_x + 4, _y);
  324. cout << " ";
  325. Console::SetCursorPosition(_x + 5, _y);
  326. cout << " ";
  327. Console::SetCursorPosition(_x - 1, _y);
  328. cout << " ";
  329. Console::SetCursorPosition(_x - 2, _y);
  330. cout << " ";
  331. Console::SetCursorPosition(_x - 3, _y);
  332. cout << " ";
  333. Console::SetCursorPosition(_x - 4, _y);
  334. cout << " ";
  335. Console::SetCursorPosition(_x - 4, _y - 1);
  336. cout << " ";
  337. Console::SetCursorPosition(_x - 3, _y - 1);
  338. cout << " ";
  339. Console::SetCursorPosition(_x - 2, _y - 1);
  340. cout << " ";
  341. Console::SetCursorPosition(_x - 1, _y - 1);
  342. cout << " ";
  343. Console::SetCursorPosition(_x, _y - 1);
  344. cout << " ";
  345. Console::SetCursorPosition(_x + 1, _y - 1);
  346. cout << " ";
  347. Console::SetCursorPosition(_x + 2, _y - 1);
  348. cout << " ";
  349. Console::SetCursorPosition(_x + 3, _y - 1);
  350. cout << " ";
  351. Console::SetCursorPosition(_x + 4, _y - 1);
  352. cout << " ";
  353. Console::SetCursorPosition(_x + 5, _y - 1);
  354. cout << " ";
  355. Console::SetCursorPosition(_x + 5, _y - 2);
  356. cout << " ";
  357. Console::SetCursorPosition(_x + 4, _y - 2);
  358. cout << " ";
  359. Console::SetCursorPosition(_x + 3, _y - 2);
  360. cout << " ";
  361. Console::SetCursorPosition(_x + 2, _y - 2);
  362. cout << " ";
  363. Console::SetCursorPosition(_x + 1, _y - 2);
  364. cout << " ";
  365. Console::SetCursorPosition(_x, _y - 2);
  366. cout << " ";
  367. Console::SetCursorPosition(_x - 1, _y - 2);
  368. cout << " ";
  369. Console::SetCursorPosition(_x - 2, _y - 2);
  370. cout << " ";
  371. Console::SetCursorPosition(_x - 3, _y - 2);
  372. cout << " ";
  373. Console::SetCursorPosition(_x - 4, _y - 2);
  374. cout << " ";
  375. Console::SetCursorPosition(_x - 4, _y - 3);
  376. cout << " ";
  377. Console::SetCursorPosition(_x - 3, _y - 3);
  378. cout << " ";
  379. Console::SetCursorPosition(_x - 2, _y - 3);
  380. cout << " ";
  381. Console::SetCursorPosition(_x - 1, _y - 3);
  382. cout << " ";
  383. Console::SetCursorPosition(_x, _y - 3);
  384. cout << " ";
  385. Console::SetCursorPosition(_x + 1, _y - 3);;
  386. cout << " ";
  387. Console::SetCursorPosition(_x + 2, _y - 3);
  388. cout << " ";
  389. Console::SetCursorPosition(_x + 3, _y - 3);
  390. cout << " ";
  391. Console::SetCursorPosition(_x + 4, _y - 3);
  392. cout << " ";
  393. Console::SetCursorPosition(_x + 5, _y - 3);
  394. cout << " ";
  395. Console::SetCursorPosition(_x + 5, _y - 4);
  396. cout << " ";
  397. Console::SetCursorPosition(_x + 4, _y - 4);
  398. cout << " ";
  399. Console::SetCursorPosition(_x + 3, _y - 4);
  400. cout << " ";
  401. Console::SetCursorPosition(_x + 2, _y - 4);
  402. cout << " ";
  403. Console::SetCursorPosition(_x + 1, _y - 4);
  404. cout << " ";
  405. Console::SetCursorPosition(_x, _y - 4);
  406. cout << " ";
  407. Console::SetCursorPosition(_x - 1, _y - 4);
  408. cout << " ";
  409. Console::SetCursorPosition(_x - 2, _y - 4);
  410. cout << " ";
  411. Console::SetCursorPosition(_x - 3, _y - 4);;
  412. cout << " ";
  413. Console::SetCursorPosition(_x - 4, _y - 4);
  414. cout << " ";
  415. Console::SetCursorPosition(_x - 4, _y - 5);
  416. cout << " ";
  417. Console::SetCursorPosition(_x - 3, _y - 5);
  418. cout << " ";
  419. Console::SetCursorPosition(_x - 2, _y - 5);
  420. cout << " ";
  421. Console::SetCursorPosition(_x - 1, _y - 5);
  422. cout << " ";
  423. Console::SetCursorPosition(_x, _y - 5);
  424. cout << " ";
  425. Console::SetCursorPosition(_x + 1, _y - 5);
  426. cout << " ";
  427. Console::SetCursorPosition(_x + 2, _y - 5);
  428. cout << " ";
  429. Console::SetCursorPosition(_x + 3, _y - 5);
  430. cout << " ";
  431. Console::SetCursorPosition(_x + 4, _y - 5);
  432. cout << " ";
  433. Console::SetCursorPosition(_x + 5, _y - 5);
  434. cout << " ";
  435. Console::SetCursorPosition(_x + 5, _y - 6);
  436. cout << " ";
  437. Console::SetCursorPosition(_x + 4, _y - 6);
  438. cout << " ";
  439. Console::SetCursorPosition(_x + 3, _y - 6);
  440. cout << " ";
  441. Console::SetCursorPosition(_x + 2, _y - 6);
  442. cout << " ";
  443. Console::SetCursorPosition(_x + 1, _y - 6);
  444. cout << " ";
  445. Console::SetCursorPosition(_x, _y - 6);
  446. cout << " ";
  447. Console::SetCursorPosition(_x - 1, _y - 6);
  448. cout << " ";
  449. Console::SetCursorPosition(_x - 2, _y - 6);
  450. cout << " ";
  451. Console::SetCursorPosition(_x - 3, _y - 6);
  452. cout << " ";
  453. Console::SetCursorPosition(_x - 4, _y - 6);
  454. cout << " ";
  455. Console::SetCursorPosition(_x + 5, _y - 7);
  456. cout << " ";
  457. Console::SetCursorPosition(_x + 4, _y - 7);
  458. cout << " ";
  459. Console::SetCursorPosition(_x + 3, _y - 7);
  460. cout << " ";
  461. Console::SetCursorPosition(_x + 2, _y - 7);
  462. cout << " ";
  463. Console::SetCursorPosition(_x + 1, _y - 7);
  464. cout << " ";
  465. Console::SetCursorPosition(_x, _y - 7);
  466. cout << " ";
  467. Console::SetCursorPosition(_x - 1, _y - 7);
  468. cout << " ";
  469. Console::SetCursorPosition(_x - 2, _y - 7);
  470. cout << " ";
  471. Console::SetCursorPosition(_x - 3, _y - 7);
  472. cout << " ";
  473. Console::SetCursorPosition(_x - 4, _y - 7);
  474. cout << " ";
  475. Console::SetCursorPosition(_x + 6, _y - 1);
  476. cout << " ";
  477. Console::SetCursorPosition(_x + 6, _y - 2);
  478. cout << " ";
  479. Console::SetCursorPosition(_x + 7, _y - 1);
  480. cout << " ";
  481. Console::SetCursorPosition(_x + 7, _y - 2);
  482. cout << " ";
  483. Console::SetCursorPosition(_x + 8, _y - 2);
  484. cout << " ";
  485. Console::SetCursorPosition(_x + 9, _y - 2);
  486. cout << " ";
  487. Console::SetCursorPosition(_x + 8, _y - 3);
  488. cout << " ";
  489. Console::SetCursorPosition(_x + 9, _y - 3);
  490. cout << " ";
  491. Console::SetCursorPosition(_x + 10, _y - 3);
  492. cout << " ";
  493. Console::SetCursorPosition(_x + 11, _y - 3);
  494. cout << " ";
  495. Console::SetCursorPosition(_x + 10, _y - 4);
  496. cout << " ";
  497. Console::SetCursorPosition(_x + 11, _y - 4);
  498. cout << " ";
  499. Console::SetCursorPosition(_x + 12, _y - 4);
  500. cout << " ";
  501. Console::SetCursorPosition(_x + 13, _y - 4);
  502. cout << " ";
  503. Console::SetCursorPosition(_x + 12, _y - 5);
  504. cout << " ";
  505. Console::SetCursorPosition(_x + 13, _y - 5);
  506. cout << " ";
  507. Console::SetCursorPosition(_x + 14, _y - 5);
  508. cout << " ";
  509. Console::SetCursorPosition(_x + 15, _y - 5);
  510. cout << " ";
  511. Console::SetCursorPosition(_x + 14, _y - 6);
  512. cout << " ";
  513. Console::SetCursorPosition(_x + 15, _y - 6);
  514. cout << " ";
  515. Console::SetCursorPosition(_x - 5, _y - 1);
  516. cout << " ";
  517. Console::SetCursorPosition(_x - 6, _y - 1);
  518. cout << " ";
  519. Console::SetCursorPosition(_x - 5, _y - 2);
  520. cout << " ";
  521. Console::SetCursorPosition(_x - 6, _y - 2);
  522. cout << " ";
  523. Console::SetCursorPosition(_x - 7, _y - 2);
  524. cout << " ";
  525. Console::SetCursorPosition(_x - 8, _y - 2);
  526. cout << " ";
  527. Console::SetCursorPosition(_x - 7, _y - 3);
  528. cout << " ";
  529. Console::SetCursorPosition(_x - 8, _y - 3);
  530. cout << " ";
  531. Console::SetCursorPosition(_x - 9, _y - 3);
  532. cout << " ";
  533. Console::SetCursorPosition(_x - 10, _y - 3);
  534. cout << " ";
  535. Console::SetCursorPosition(_x - 9, _y - 4);
  536. cout << " ";
  537. Console::SetCursorPosition(_x - 10, _y - 4);
  538. cout << " ";
  539. Console::SetCursorPosition(_x - 11, _y - 4);
  540. cout << " ";
  541. Console::SetCursorPosition(_x - 12, _y - 4);
  542. cout << " ";
  543. Console::SetCursorPosition(_x - 11, _y - 5);
  544. cout << " ";
  545. Console::SetCursorPosition(_x - 12, _y - 5);
  546. cout << " ";
  547. Console::SetCursorPosition(_x - 13, _y - 5);
  548. cout << " ";
  549. Console::SetCursorPosition(_x - 14, _y - 5);
  550. cout << " ";
  551. Console::SetCursorPosition(_x - 13, _y - 6);
  552. cout << " ";
  553. Console::SetCursorPosition(_x - 14, _y - 6);
  554. cout << " ";
  555. }
  556. void mover() {
  557. if ((_x - 14) + _dx < 1 || (_x + 15) + _dx > 83) {
  558. _dx *= -1;
  559. }
  560. _x += _dx;
  561. }
  562. void dibujar() {
  563. if (!(_colisiono)) {
  564. Console::SetCursorPosition(_x, _y);
  565. Console::ForegroundColor = ConsoleColor::Yellow;
  566. cout << _img;
  567. Console::SetCursorPosition(_x + 1, _y);
  568. Console::ForegroundColor = ConsoleColor::Yellow;
  569. cout << _img;
  570. Console::SetCursorPosition(_x + 2, _y);
  571. Console::ForegroundColor = ConsoleColor::Yellow;
  572. cout << _img;
  573. Console::SetCursorPosition(_x + 3, _y);
  574. Console::ForegroundColor = ConsoleColor::Yellow;
  575. cout << _img;
  576. Console::SetCursorPosition(_x + 4, _y);
  577. Console::ForegroundColor = ConsoleColor::Yellow;
  578. cout << _img;
  579. Console::SetCursorPosition(_x + 5, _y);
  580. Console::ForegroundColor = ConsoleColor::Yellow;
  581. cout << _img;
  582. Console::SetCursorPosition(_x - 1, _y);
  583. Console::ForegroundColor = ConsoleColor::Yellow;
  584. cout << _img;
  585. Console::SetCursorPosition(_x - 2, _y);
  586. Console::ForegroundColor = ConsoleColor::Yellow;
  587. cout << _img;
  588. Console::SetCursorPosition(_x - 3, _y);
  589. Console::ForegroundColor = ConsoleColor::Yellow;
  590. cout << _img;
  591. Console::SetCursorPosition(_x - 4, _y);
  592. Console::ForegroundColor = ConsoleColor::Yellow;
  593. cout << _img;
  594. Console::SetCursorPosition(_x - 4, _y - 1);
  595. Console::ForegroundColor = ConsoleColor::Yellow;
  596. cout << _img;
  597. Console::SetCursorPosition(_x - 3, _y - 1);
  598. Console::ForegroundColor = ConsoleColor::Yellow;
  599. cout << _img;
  600. Console::SetCursorPosition(_x - 2, _y - 1);
  601. Console::ForegroundColor = ConsoleColor::Red;
  602. cout << _img;
  603. Console::SetCursorPosition(_x - 1, _y - 1);
  604. Console::ForegroundColor = ConsoleColor::Red;
  605. cout << _img;
  606. Console::SetCursorPosition(_x, _y - 1);
  607. Console::ForegroundColor = ConsoleColor::Yellow;
  608. cout << _img;
  609. Console::SetCursorPosition(_x + 1, _y - 1);
  610. Console::ForegroundColor = ConsoleColor::Yellow;
  611. cout << _img;
  612. Console::SetCursorPosition(_x + 2, _y - 1);
  613. Console::ForegroundColor = ConsoleColor::Red;
  614. cout << _img;
  615. Console::SetCursorPosition(_x + 3, _y - 1);
  616. Console::ForegroundColor = ConsoleColor::Red;
  617. cout << _img;
  618. Console::SetCursorPosition(_x + 4, _y - 1);
  619. Console::ForegroundColor = ConsoleColor::Yellow;
  620. cout << _img;
  621. Console::SetCursorPosition(_x + 5, _y - 1);
  622. Console::ForegroundColor = ConsoleColor::Yellow;
  623. cout << _img;
  624. Console::SetCursorPosition(_x + 5, _y - 2);
  625. Console::ForegroundColor = ConsoleColor::Yellow;
  626. cout << _img;
  627. Console::SetCursorPosition(_x + 4, _y - 2);
  628. Console::ForegroundColor = ConsoleColor::Yellow;
  629. cout << _img;
  630. Console::SetCursorPosition(_x + 3, _y - 2);
  631. Console::ForegroundColor = ConsoleColor::Red;
  632. cout << _img;
  633. Console::SetCursorPosition(_x + 2, _y - 2);
  634. Console::ForegroundColor = ConsoleColor::Red;
  635. cout << _img;
  636. Console::SetCursorPosition(_x + 1, _y - 2);
  637. Console::ForegroundColor = ConsoleColor::Yellow;
  638. cout << _img;
  639. Console::SetCursorPosition(_x, _y - 2);
  640. Console::ForegroundColor = ConsoleColor::Yellow;
  641. cout << _img;
  642. Console::SetCursorPosition(_x - 1, _y - 2);
  643. Console::ForegroundColor = ConsoleColor::Red;
  644. cout << _img;
  645. Console::SetCursorPosition(_x - 2, _y - 2);
  646. Console::ForegroundColor = ConsoleColor::Red;
  647. cout << _img;
  648. Console::SetCursorPosition(_x - 3, _y - 2);
  649. Console::ForegroundColor = ConsoleColor::Yellow;
  650. cout << _img;
  651. Console::SetCursorPosition(_x - 4, _y - 2);
  652. Console::ForegroundColor = ConsoleColor::Yellow;
  653. cout << _img;
  654. Console::SetCursorPosition(_x - 4, _y - 3);
  655. Console::ForegroundColor = ConsoleColor::Yellow;
  656. cout << _img;
  657. Console::SetCursorPosition(_x - 3, _y - 3);
  658. Console::ForegroundColor = ConsoleColor::Yellow;
  659. cout << _img;
  660. Console::SetCursorPosition(_x - 2, _y - 3);
  661. Console::ForegroundColor = ConsoleColor::Yellow;
  662. cout << _img;
  663. Console::SetCursorPosition(_x - 1, _y - 3);
  664. Console::ForegroundColor = ConsoleColor::Yellow;
  665. cout << _img;
  666. Console::SetCursorPosition(_x, _y - 3);
  667. Console::ForegroundColor = ConsoleColor::Yellow;
  668. cout << _img;
  669. Console::SetCursorPosition(_x + 1, _y - 3);
  670. Console::ForegroundColor = ConsoleColor::Yellow;
  671. cout << _img;
  672. Console::SetCursorPosition(_x + 2, _y - 3);
  673. Console::ForegroundColor = ConsoleColor::Yellow;
  674. cout << _img;
  675. Console::SetCursorPosition(_x + 3, _y - 3);
  676. Console::ForegroundColor = ConsoleColor::Yellow;
  677. cout << _img;
  678. Console::SetCursorPosition(_x + 4, _y - 3);
  679. Console::ForegroundColor = ConsoleColor::Yellow;
  680. cout << _img;
  681. Console::SetCursorPosition(_x + 5, _y - 3);
  682. Console::ForegroundColor = ConsoleColor::Yellow;
  683. cout << _img;
  684. Console::SetCursorPosition(_x + 5, _y - 4);
  685. Console::ForegroundColor = ConsoleColor::Yellow;
  686. cout << _img;
  687. Console::SetCursorPosition(_x + 4, _y - 4);
  688. Console::ForegroundColor = ConsoleColor::Yellow;
  689. cout << _img;
  690. Console::SetCursorPosition(_x + 3, _y - 4);
  691. Console::ForegroundColor = ConsoleColor::Yellow;
  692. cout << _img;
  693. Console::SetCursorPosition(_x + 2, _y - 4);
  694. Console::ForegroundColor = ConsoleColor::Yellow;
  695. cout << _img;
  696. Console::SetCursorPosition(_x + 1, _y - 4);
  697. Console::ForegroundColor = ConsoleColor::Yellow;
  698. cout << _img;
  699. Console::SetCursorPosition(_x, _y - 4);
  700. Console::ForegroundColor = ConsoleColor::Yellow;
  701. cout << _img;
  702. Console::SetCursorPosition(_x - 1, _y - 4);
  703. Console::ForegroundColor = ConsoleColor::Yellow;
  704. cout << _img;
  705. Console::SetCursorPosition(_x - 2, _y - 4);
  706. Console::ForegroundColor = ConsoleColor::Yellow;
  707. cout << _img;
  708. Console::SetCursorPosition(_x - 3, _y - 4);
  709. Console::ForegroundColor = ConsoleColor::Yellow;
  710. cout << _img;
  711. Console::SetCursorPosition(_x - 4, _y - 4);
  712. Console::ForegroundColor = ConsoleColor::Yellow;
  713. cout << _img;
  714. Console::SetCursorPosition(_x - 4, _y - 5);
  715. Console::ForegroundColor = ConsoleColor::Yellow;
  716. cout << _img;
  717. Console::SetCursorPosition(_x - 3, _y - 5);
  718. Console::ForegroundColor = ConsoleColor::Yellow;
  719. cout << _img;
  720. Console::SetCursorPosition(_x - 2, _y - 5);
  721. Console::ForegroundColor = ConsoleColor::Red;
  722. cout << _img;
  723. Console::SetCursorPosition(_x - 1, _y - 5);
  724. Console::ForegroundColor = ConsoleColor::Red;
  725. cout << _img;
  726. Console::SetCursorPosition(_x, _y - 5);
  727. Console::ForegroundColor = ConsoleColor::Red;
  728. cout << _img;
  729. Console::SetCursorPosition(_x + 1, _y - 5);
  730. Console::ForegroundColor = ConsoleColor::Red;
  731. cout << _img;
  732. Console::SetCursorPosition(_x + 2, _y - 5);
  733. Console::ForegroundColor = ConsoleColor::Red;
  734. cout << _img;
  735. Console::SetCursorPosition(_x + 3, _y - 5);
  736. Console::ForegroundColor = ConsoleColor::Red;
  737. cout << _img;
  738. Console::SetCursorPosition(_x + 4, _y - 5);
  739. Console::ForegroundColor = ConsoleColor::Yellow;
  740. cout << _img;
  741. Console::SetCursorPosition(_x + 5, _y - 5);
  742. Console::ForegroundColor = ConsoleColor::Yellow;
  743. cout << _img;
  744. Console::SetCursorPosition(_x + 5, _y - 6);
  745. Console::ForegroundColor = ConsoleColor::Yellow;
  746. cout << _img;
  747. Console::SetCursorPosition(_x + 4, _y - 6);
  748. Console::ForegroundColor = ConsoleColor::Yellow;
  749. cout << _img;
  750. Console::SetCursorPosition(_x + 3, _y - 6);
  751. Console::ForegroundColor = ConsoleColor::Red;
  752. cout << _img;
  753. Console::SetCursorPosition(_x + 2, _y - 6);
  754. Console::ForegroundColor = ConsoleColor::Red;
  755. cout << _img;
  756. Console::SetCursorPosition(_x + 1, _y - 6);
  757. Console::ForegroundColor = ConsoleColor::Red;
  758. cout << _img;
  759. Console::SetCursorPosition(_x, _y - 6);
  760. Console::ForegroundColor = ConsoleColor::Red;
  761. cout << _img;
  762. Console::SetCursorPosition(_x - 1, _y - 6);
  763. Console::ForegroundColor = ConsoleColor::Red;
  764. cout << _img;
  765. Console::SetCursorPosition(_x - 2, _y - 6);
  766. Console::ForegroundColor = ConsoleColor::Red;
  767. cout << _img;
  768. Console::SetCursorPosition(_x - 3, _y - 6);
  769. Console::ForegroundColor = ConsoleColor::Yellow;
  770. cout << _img;
  771. Console::SetCursorPosition(_x - 4, _y - 6);
  772. Console::ForegroundColor = ConsoleColor::Yellow;
  773. cout << _img;
  774. Console::SetCursorPosition(_x + 5, _y - 7);
  775. Console::ForegroundColor = ConsoleColor::Yellow;
  776. cout << _img;
  777. Console::SetCursorPosition(_x + 4, _y - 7);
  778. Console::ForegroundColor = ConsoleColor::Yellow;
  779. cout << _img;
  780. Console::SetCursorPosition(_x + 3, _y - 7);
  781. Console::ForegroundColor = ConsoleColor::Yellow;
  782. cout << _img;
  783. Console::SetCursorPosition(_x + 2, _y - 7);
  784. Console::ForegroundColor = ConsoleColor::Yellow;
  785. cout << _img;
  786. Console::SetCursorPosition(_x + 1, _y - 7);
  787. Console::ForegroundColor = ConsoleColor::Yellow;
  788. cout << _img;
  789. Console::SetCursorPosition(_x, _y - 7);
  790. Console::ForegroundColor = ConsoleColor::Yellow;
  791. cout << _img;
  792. Console::SetCursorPosition(_x - 1, _y - 7);
  793. Console::ForegroundColor = ConsoleColor::Yellow;
  794. cout << _img;
  795. Console::SetCursorPosition(_x - 2, _y - 7);
  796. Console::ForegroundColor = ConsoleColor::Yellow;
  797. cout << _img;
  798. Console::SetCursorPosition(_x - 3, _y - 7);
  799. Console::ForegroundColor = ConsoleColor::Yellow;
  800. cout << _img;
  801. Console::SetCursorPosition(_x - 4, _y - 7);
  802. Console::ForegroundColor = ConsoleColor::Yellow;
  803. cout << _img;
  804. Console::SetCursorPosition(_x + 6, _y - 1);
  805. Console::ForegroundColor = ConsoleColor::Yellow;
  806. cout << _img;
  807. Console::SetCursorPosition(_x + 6, _y - 2);
  808. Console::ForegroundColor = ConsoleColor::Yellow;
  809. cout << _img;
  810. Console::SetCursorPosition(_x + 7, _y - 1);
  811. Console::ForegroundColor = ConsoleColor::Yellow;
  812. cout << _img;
  813. Console::SetCursorPosition(_x + 7, _y - 2);
  814. Console::ForegroundColor = ConsoleColor::Yellow;
  815. cout << _img;
  816. Console::SetCursorPosition(_x + 8, _y - 2);
  817. Console::ForegroundColor = ConsoleColor::Yellow;
  818. cout << _img;
  819. Console::SetCursorPosition(_x + 9, _y - 2);
  820. Console::ForegroundColor = ConsoleColor::Yellow;
  821. cout << _img;
  822. Console::SetCursorPosition(_x + 8, _y - 3);
  823. Console::ForegroundColor = ConsoleColor::Yellow;
  824. cout << _img;
  825. Console::SetCursorPosition(_x + 9, _y - 3);
  826. Console::ForegroundColor = ConsoleColor::Yellow;
  827. cout << _img;
  828. Console::SetCursorPosition(_x + 10, _y - 3);
  829. Console::ForegroundColor = ConsoleColor::Yellow;
  830. cout << _img;
  831. Console::SetCursorPosition(_x + 11, _y - 3);
  832. Console::ForegroundColor = ConsoleColor::Yellow;
  833. cout << _img;
  834. Console::SetCursorPosition(_x + 10, _y - 4);
  835. Console::ForegroundColor = ConsoleColor::Yellow;
  836. cout << _img;
  837. Console::SetCursorPosition(_x + 11, _y - 4);
  838. Console::ForegroundColor = ConsoleColor::Yellow;
  839. cout << _img;
  840. Console::SetCursorPosition(_x + 12, _y - 4);
  841. Console::ForegroundColor = ConsoleColor::Yellow;
  842. cout << _img;
  843. Console::SetCursorPosition(_x + 13, _y - 4);
  844. Console::ForegroundColor = ConsoleColor::Yellow;
  845. cout << _img;
  846. Console::SetCursorPosition(_x + 12, _y - 5);
  847. Console::ForegroundColor = ConsoleColor::Yellow;
  848. cout << _img;
  849. Console::SetCursorPosition(_x + 13, _y - 5);
  850. Console::ForegroundColor = ConsoleColor::Yellow;
  851. cout << _img;
  852. Console::SetCursorPosition(_x + 14, _y - 5);
  853. Console::ForegroundColor = ConsoleColor::Yellow;
  854. cout << _img;
  855. Console::SetCursorPosition(_x + 15, _y - 5);
  856. Console::ForegroundColor = ConsoleColor::Yellow;
  857. cout << _img;
  858. Console::SetCursorPosition(_x + 14, _y - 6);
  859. Console::ForegroundColor = ConsoleColor::Yellow;
  860. cout << _img;
  861. Console::SetCursorPosition(_x + 15, _y - 6);
  862. Console::ForegroundColor = ConsoleColor::Yellow;
  863. cout << _img;
  864. Console::SetCursorPosition(_x - 5, _y - 1);
  865. Console::ForegroundColor = ConsoleColor::Yellow;
  866. cout << _img;
  867. Console::SetCursorPosition(_x - 6, _y - 1);
  868. Console::ForegroundColor = ConsoleColor::Yellow;
  869. cout << _img;
  870. Console::SetCursorPosition(_x - 5, _y - 2);
  871. Console::ForegroundColor = ConsoleColor::Yellow;
  872. cout << _img;
  873. Console::SetCursorPosition(_x - 6, _y - 2);
  874. Console::ForegroundColor = ConsoleColor::Yellow;
  875. cout << _img;
  876. Console::SetCursorPosition(_x - 7, _y - 2);
  877. Console::ForegroundColor = ConsoleColor::Yellow;
  878. cout << _img;
  879. Console::SetCursorPosition(_x - 8, _y - 2);
  880. Console::ForegroundColor = ConsoleColor::Yellow;
  881. cout << _img;
  882. Console::SetCursorPosition(_x - 7, _y - 3);
  883. Console::ForegroundColor = ConsoleColor::Yellow;
  884. cout << _img;
  885. Console::SetCursorPosition(_x - 8, _y - 3);
  886. Console::ForegroundColor = ConsoleColor::Yellow;
  887. cout << _img;
  888. Console::SetCursorPosition(_x - 9, _y - 3);
  889. Console::ForegroundColor = ConsoleColor::Yellow;
  890. cout << _img;
  891. Console::SetCursorPosition(_x - 10, _y - 3);
  892. Console::ForegroundColor = ConsoleColor::Yellow;
  893. cout << _img;
  894. Console::SetCursorPosition(_x - 9, _y - 4);
  895. Console::ForegroundColor = ConsoleColor::Yellow;
  896. cout << _img;
  897. Console::SetCursorPosition(_x - 10, _y -4);
  898. Console::ForegroundColor = ConsoleColor::Yellow;
  899. cout << _img;
  900. Console::SetCursorPosition(_x - 11, _y - 4);
  901. Console::ForegroundColor = ConsoleColor::Yellow;
  902. cout << _img;
  903. Console::SetCursorPosition(_x - 12, _y - 4);
  904. Console::ForegroundColor = ConsoleColor::Yellow;
  905. cout << _img;
  906. Console::SetCursorPosition(_x - 11, _y - 5);
  907. Console::ForegroundColor = ConsoleColor::Yellow;
  908. cout << _img;
  909. Console::SetCursorPosition(_x - 12, _y - 5);
  910. Console::ForegroundColor = ConsoleColor::Yellow;
  911. cout << _img;
  912. Console::SetCursorPosition(_x - 13, _y - 5);
  913. Console::ForegroundColor = ConsoleColor::Yellow;
  914. cout << _img;
  915. Console::SetCursorPosition(_x - 14, _y - 5);
  916. Console::ForegroundColor = ConsoleColor::Yellow;
  917. cout << _img;
  918. Console::SetCursorPosition(_x - 13, _y - 6);
  919. Console::ForegroundColor = ConsoleColor::Yellow;
  920. cout << _img;
  921. Console::SetCursorPosition(_x - 14, _y - 6);
  922. Console::ForegroundColor = ConsoleColor::Yellow;
  923. cout << _img;
  924. }
  925. }
  926.  
  927. };
  928.  
  929. typedef struct Nave2 {
  930. int _x, _y;
  931. public:
  932. Nave2(int x, int y) {
  933. _x = x;
  934. _y = y;
  935. }
  936. int X() { return _x; }
  937. int Y() { return _y; }
  938. void animar(short tecla) {
  939. borrar();
  940. mover(tecla);
  941. dibujar();
  942. }
  943. void borrar() {
  944. Console::SetCursorPosition(_x, _y);
  945. cout << " ";
  946. Console::SetCursorPosition(_x - 1, _y + 1);
  947. cout << " ";
  948. Console::SetCursorPosition(_x + 1, _y + 1);
  949. cout << " ";
  950. Console::SetCursorPosition(_x - 1, _y + 1);
  951. cout << " ";
  952. Console::SetCursorPosition(_x, _y + 2);
  953. cout << " ";
  954. Console::SetCursorPosition(_x - 1, _y + 2);
  955. cout << " ";
  956. Console::SetCursorPosition(_x + 1, _y + 2);
  957. cout << " ";
  958. Console::SetCursorPosition(_x + 2, _y + 2);
  959. cout << " ";
  960. Console::SetCursorPosition(_x - 2, _y + 2);
  961. cout << " ";
  962. Console::SetCursorPosition(_x - 2, _y + 3);
  963. cout << " ";
  964. Console::SetCursorPosition(_x + 2, _y + 3);
  965. cout << " ";
  966. }
  967. void mover(short tecla) {
  968. switch (tecla) {
  969. case ARRIBA: if (_y - 1 >= 1) _y--; break;
  970. case ABAJO: if (_y + 4 <= 27) _y++; break;
  971. case IZQUIERDA: if (_x - 2 >= 2) _x--; break;
  972. case DERECHA: if (_x + 3 <= 83) _x++; break;
  973. }
  974. }
  975. void dibujar() {
  976. Console::SetCursorPosition(_x, _y);
  977. Console::ForegroundColor = ConsoleColor::White;
  978. cout << char(219);
  979. Console::SetCursorPosition(_x, _y + 1);
  980. Console::ForegroundColor = ConsoleColor::Red;
  981. cout << char(219);
  982. Console::SetCursorPosition(_x + 1, _y + 1);
  983. Console::ForegroundColor = ConsoleColor::White;
  984. cout << char(219);
  985. Console::SetCursorPosition(_x - 1, _y + 1);
  986. Console::ForegroundColor = ConsoleColor::White;
  987. cout << char(219);
  988. Console::SetCursorPosition(_x, _y + 2);
  989. Console::ForegroundColor = ConsoleColor::Red;
  990. cout << char(223);
  991. Console::SetCursorPosition(_x - 1, _y + 2);
  992. Console::ForegroundColor = ConsoleColor::Red;
  993. cout << char(219);
  994. Console::SetCursorPosition(_x + 1, _y + 2);
  995. Console::ForegroundColor = ConsoleColor::Red;
  996. cout << char(219);
  997. Console::SetCursorPosition(_x + 2, _y + 2);
  998. Console::ForegroundColor = ConsoleColor::White;
  999. cout << char(219);
  1000. Console::SetCursorPosition(_x - 2, _y + 2);
  1001. Console::ForegroundColor = ConsoleColor::White;
  1002. cout << char(219);
  1003. Console::SetCursorPosition(_x - 2, _y + 3);
  1004. Console::ForegroundColor = ConsoleColor::White;
  1005. cout << char(223);
  1006. Console::SetCursorPosition(_x + 2, _y + 3);
  1007. Console::ForegroundColor = ConsoleColor::White;
  1008. cout << char(223);
  1009. }
  1010. };
  1011.  
  1012. typedef struct BALA {
  1013. int _x, _y;
  1014. public:
  1015. BALA(int x, int y) {
  1016. _x = x;
  1017. _y = y;
  1018. }
  1019. int X() { return _x; }
  1020. int Y() { return _y; }
  1021. void mover() {
  1022. Console::SetCursorPosition(_x, _y);
  1023. cout << " ";
  1024. _y--;
  1025. Console::SetCursorPosition(_x, _y);
  1026. Console::ForegroundColor = ConsoleColor::Blue;
  1027. cout << "*";
  1028. }
  1029.  
  1030. bool fuera() {
  1031. if (_y == 1) return true;
  1032. return false;
  1033. }
  1034. };
  1035.  
  1036. void MatrizNivel1() {
  1037. int nivel;
  1038. system("cls");
  1039. copiasmatriz(nivel = 2);
  1040. imprimirmatriz(nivel = 2);
  1041. Console::SetCursorPosition(9, 8);
  1042. Console::ForegroundColor = ConsoleColor::Yellow;
  1043. cout << "** ** ** ** ** ********** *** ******" << endl;
  1044. Console::SetCursorPosition(9, 9);
  1045. Console::ForegroundColor = ConsoleColor::Yellow;
  1046. cout << "**** ** ** ** ** ********** *** *******" << endl;
  1047. Console::SetCursorPosition(9, 10);
  1048. Console::ForegroundColor = ConsoleColor::Yellow;
  1049. cout << "**** ** ** ** ** ** *** *** ****" << endl;
  1050. Console::SetCursorPosition(9, 11);
  1051. Console::ForegroundColor = ConsoleColor::Yellow;
  1052. cout << "** ** ** ** ** ** ** *** *** ****" << endl;
  1053. Console::SetCursorPosition(9, 12);
  1054. Console::ForegroundColor = ConsoleColor::Yellow;
  1055. cout << "** ** ** ** ** ** ********** *** ****" << endl;
  1056. Console::SetCursorPosition(9, 13);
  1057. Console::ForegroundColor = ConsoleColor::Yellow;
  1058. cout << "** ** ** ** ** ** ********** *** ****" << endl;
  1059. Console::SetCursorPosition(9, 14);
  1060. Console::ForegroundColor = ConsoleColor::Yellow;
  1061. cout << "** ** ** ** ** ** ** *** ****" << endl;
  1062. Console::SetCursorPosition(9, 15);
  1063. Console::ForegroundColor = ConsoleColor::Yellow;
  1064. cout << "** **** ** ** ** ** *** ****" << endl;
  1065. Console::SetCursorPosition(9, 16);
  1066. Console::ForegroundColor = ConsoleColor::Yellow;
  1067. cout << "** **** ** **** ********** *********** ****" << endl;
  1068. Console::SetCursorPosition(9, 17);
  1069. Console::ForegroundColor = ConsoleColor::Yellow;
  1070. cout << "** ** ** **** ********** *********** ****" << endl;
  1071. }
  1072.  
  1073. void MatrizNivel2() {
  1074. int nivel;
  1075. system("cls");
  1076. copiasmatriz(nivel = 2);
  1077. imprimirmatriz(nivel = 2);
  1078. Console::SetCursorPosition(9, 8);
  1079. Console::ForegroundColor = ConsoleColor::Yellow;
  1080. cout << "** ** ** ** ** ********** *** **********" << endl;
  1081. Console::SetCursorPosition(9, 9);
  1082. Console::ForegroundColor = ConsoleColor::Yellow;
  1083. cout << "**** ** ** ** ** ********** *** ***********" << endl;
  1084. Console::SetCursorPosition(9, 10);
  1085. Console::ForegroundColor = ConsoleColor::Yellow;
  1086. cout << "**** ** ** ** ** ** *** *** ****" << endl;
  1087. Console::SetCursorPosition(9, 11);
  1088. Console::ForegroundColor = ConsoleColor::Yellow;
  1089. cout << "** ** ** ** ** ** ** *** *** **** " << endl;
  1090. Console::SetCursorPosition(9, 12);
  1091. Console::ForegroundColor = ConsoleColor::Yellow;
  1092. cout << "** ** ** ** ** ** ********** *** **** " << endl;
  1093. Console::SetCursorPosition(9, 13);
  1094. Console::ForegroundColor = ConsoleColor::Yellow;
  1095. cout << "** ** ** ** ** ** ********** *** **** " << endl;
  1096. Console::SetCursorPosition(9, 14);
  1097. Console::ForegroundColor = ConsoleColor::Yellow;
  1098. cout << "** ** ** ** ** ** ** *** **** " << endl;
  1099. Console::SetCursorPosition(9, 15);
  1100. Console::ForegroundColor = ConsoleColor::Yellow;
  1101. cout << "** **** ** ** ** ** *** **** " << endl;
  1102. Console::SetCursorPosition(9, 16);
  1103. Console::ForegroundColor = ConsoleColor::Yellow;
  1104. cout << "** **** ** **** ********** *********** ************" << endl;
  1105. Console::SetCursorPosition(9, 17);
  1106. Console::ForegroundColor = ConsoleColor::Yellow;
  1107. cout << "** ** ** **** ********** *********** ************" << endl;
  1108. }
  1109.  
  1110. void MatrizNivel3() {
  1111. int nivel;
  1112. system("cls");
  1113. copiasmatriz(nivel = 2);
  1114. imprimirmatriz(nivel = 2);
  1115. Console::SetCursorPosition(9, 8);
  1116. Console::ForegroundColor = ConsoleColor::Yellow;
  1117. cout << "** ** ** ** ** ********** *** ************" << endl;
  1118. Console::SetCursorPosition(9, 9);
  1119. Console::ForegroundColor = ConsoleColor::Yellow;
  1120. cout << "**** ** ** ** ** ********** *** ************" << endl;
  1121. Console::SetCursorPosition(9, 10);
  1122. Console::ForegroundColor = ConsoleColor::Yellow;
  1123. cout << "**** ** ** ** ** ** *** ***" << endl;
  1124. Console::SetCursorPosition(9, 11);
  1125. Console::ForegroundColor = ConsoleColor::Yellow;
  1126. cout << "** ** ** ** ** ** ** *** ***" << endl;
  1127. Console::SetCursorPosition(9, 12);
  1128. Console::ForegroundColor = ConsoleColor::Yellow;
  1129. cout << "** ** ** ** ** ** ********** *** ************" << endl;
  1130. Console::SetCursorPosition(9, 13);
  1131. Console::ForegroundColor = ConsoleColor::Yellow;
  1132. cout << "** ** ** ** ** ** ********** *** ************" << endl;
  1133. Console::SetCursorPosition(9, 14);
  1134. Console::ForegroundColor = ConsoleColor::Yellow;
  1135. cout << "** ** ** ** ** ** ** *** ***" << endl;
  1136. Console::SetCursorPosition(9, 15);
  1137. Console::ForegroundColor = ConsoleColor::Yellow;
  1138. cout << "** **** ** ** ** ** *** ***" << endl;
  1139. Console::SetCursorPosition(9, 16);
  1140. Console::ForegroundColor = ConsoleColor::Yellow;
  1141. cout << "** **** ** **** ********** *********** ************" << endl;
  1142. Console::SetCursorPosition(9, 17);
  1143. Console::ForegroundColor = ConsoleColor::Yellow;
  1144. cout << "** ** ** **** ********** *********** ************" << endl;
  1145. }
  1146.  
  1147. int jugar(int players) {
  1148. int puntos = 0;
  1149. int contadornivel1 = 0;
  1150. bool gameover = false;
  1151. int cantidadEnemigos = 28;
  1152. //BALAS de nave1
  1153. list<BALA*> B;
  1154. list<BALA*> ::iterator it2;
  1155. //BALAS de nave 2
  1156. list<BALA*>B2;
  1157. list<BALA*> ::iterator it3;
  1158. //ENEMIGOS
  1159. list<NaveEnemiga*> E;
  1160. list<NaveEnemiga*>::iterator it;
  1161. //CREA ENEMIGOS
  1162. for (int i = 0; i < cantidadEnemigos; i++)
  1163. {
  1164. E.push_back(new NaveEnemiga(2+rand()%79, 2+rand()%9, -1, +1));
  1165. }
  1166. //CREA HEROES
  1167. Nave nave1 = Nave(40, 20);
  1168. Nave nave3 = Nave(30, 20);
  1169. Nave2 nave2 = Nave2(55, 20);
  1170. //JUEGO
  1171. while (!(gameover)) {
  1172. //puntos
  1173. Console::SetCursorPosition(89, 3);
  1174. Console::ForegroundColor = ConsoleColor::Yellow;
  1175. cout << "Puntos: " << puntos;
  1176. //Lee la tecla presionada y genera valores en las listas
  1177. if (kbhit()) {
  1178. if (players == 1) {
  1179. char tecla = getch();
  1180. nave1.animar(tecla);
  1181. if (tecla == DISPARO)
  1182. B.push_back(new BALA(nave1.X(), nave1.Y() - 1));
  1183. }
  1184. else if (players == 2) {
  1185. char tecla = getch();
  1186. nave3.animar(tecla);
  1187. if (tecla == DISPARO)
  1188. B.push_back(new BALA(nave3.X(), nave3.Y() - 1));
  1189. nave2.animar(tecla);
  1190. if (tecla == DISPARO2)
  1191. B2.push_back(new BALA(nave2.X(), nave2.Y() - 1));
  1192. }
  1193. }
  1194. //Imprime , mueve y borra las balas nave1 y nave 3(mueve con awsd)
  1195. for (it2 = B.begin(); it2 != B.end();) {
  1196. (*it2)->mover();
  1197. if ((*it2)->fuera()) {
  1198. Console::SetCursorPosition((*it2)->X(), (*it2)->Y());
  1199. cout << " ";
  1200. delete(*it2);
  1201. //da un valor de la lista al eliminado
  1202. it2 = B.erase(it2);
  1203. }
  1204. else {
  1205. it2++;
  1206. }
  1207. }
  1208. //Imprime , mueve y borra las balas de nave2(mueve con flechitas)
  1209. for (it3 = B2.begin(); it3 != B2.end();) {
  1210. (*it3)->mover();
  1211. if ((*it3)->fuera()) {
  1212. Console::SetCursorPosition((*it3)->X(), (*it3)->Y());
  1213. cout << " ";
  1214. delete(*it3);
  1215. //da un valor de la lista al eliminado
  1216. it3 = B2.erase(it3);
  1217. }
  1218. else {
  1219. it3++;
  1220. }
  1221. }
  1222. //Imprime a los enemigos
  1223. for (it = E.begin(); it != E.end(); it++) {
  1224. (*it)->animar();
  1225. }
  1226. //Balas de nave 1 y nave 3 que eliminan enemigos
  1227. for (it = E.begin(); it != E.end(); it++) {
  1228. for (it2 = B.begin(); it2 != B.end();)
  1229. {
  1230. if ((*it)->X() == (*it2)->X() && ((*it)->Y() == (*it2)->Y() || (*it)->Y() + 1 == (*it2)->Y()) && !((*it)->colisiono())) {
  1231. Console::SetCursorPosition((*it2)->X(), (*it2)->Y());
  1232. cout << " ";
  1233. delete(*it2);
  1234. it2 = B.erase(it2);
  1235. Console::SetCursorPosition((*it)->X(), (*it)->Y());
  1236. cout << " ";
  1237. (*it)->marcar_colision();
  1238. puntos += 5;
  1239. contadornivel1 += 1;
  1240. }
  1241. else { it2++; }
  1242.  
  1243. }
  1244. }
  1245. //Balas de nave 2 que eliminan enemigos
  1246. for (it = E.begin(); it != E.end(); it++) {
  1247. for (it3 = B2.begin(); it3 != B2.end();)
  1248. {
  1249. if ((*it)->X() == (*it3)->X() && ((*it)->Y() == (*it3)->Y() || (*it)->Y() + 1 == (*it3)->Y()) && !((*it)->colisiono())) {
  1250. Console::SetCursorPosition((*it3)->X(), (*it3)->Y());
  1251. cout << " ";
  1252. delete(*it3);
  1253. it3 = B2.erase(it3);
  1254. Console::SetCursorPosition((*it)->X(), (*it)->Y());
  1255. cout << " ";
  1256. (*it)->marcar_colision();
  1257. puntos += 5;
  1258. contadornivel1 += 1;
  1259. }
  1260. else { it3++; }
  1261.  
  1262. }
  1263. }
  1264. _sleep(10);
  1265. if (contadornivel1 == cantidadEnemigos) {
  1266. gameover = true;
  1267. }
  1268. }
  1269. //devuelve puntos
  1270. return puntos;
  1271. }
  1272.  
  1273. int jugar2(int players, int puntosacumulados) {
  1274. int contadornivel2 = 0;
  1275. bool gameover2 = false;
  1276. int cantidadEnemigos = 28;
  1277. //BALAS de nave1
  1278. list<BALA*> B;
  1279. list<BALA*> ::iterator it2;
  1280. //BALAS de nave 2
  1281. list<BALA*>B2;
  1282. list<BALA*> ::iterator it3;
  1283. //ENEMIGOS2
  1284. list<NaveEnemiga*> E2;
  1285. list<NaveEnemiga*>::iterator itE2;
  1286. //CREA ENEMIGOS
  1287. for (int i = 0; i < cantidadEnemigos; i++)
  1288. {
  1289. E2.push_back(new NaveEnemiga(2 + rand() % 79, 2 + rand() % 9, -1, +1));
  1290. }
  1291. //CREA HEROES
  1292. Nave nave1 = Nave(40, 20);
  1293. Nave nave3 = Nave(30, 20);
  1294. Nave2 nave2 = Nave2(55, 20);
  1295. //JUEGO
  1296. while (!(gameover2)) {
  1297. //puntos
  1298. Console::SetCursorPosition(89, 3);
  1299. Console::ForegroundColor = ConsoleColor::Yellow;
  1300. cout << "Puntos: " << puntosacumulados;
  1301. //Lee la tecla presionada y genera valores en las listas
  1302. if (kbhit()) {
  1303. if (players == 1) {
  1304. char tecla = getch();
  1305. nave1.animar(tecla);
  1306. if (tecla == DISPARO)
  1307. B.push_back(new BALA(nave1.X(), nave1.Y() - 1));
  1308. }
  1309. else if (players == 2) {
  1310. char tecla = getch();
  1311. nave3.animar(tecla);
  1312. if (tecla == DISPARO)
  1313. B.push_back(new BALA(nave3.X(), nave3.Y() - 1));
  1314. nave2.animar(tecla);
  1315. if (tecla == DISPARO2)
  1316. B2.push_back(new BALA(nave2.X(), nave2.Y() - 1));
  1317. }
  1318. }
  1319. //Imprime , mueve y borra las balas nave1 y nave 3(mueve con awsd)
  1320. for (it2 = B.begin(); it2 != B.end();) {
  1321. (*it2)->mover();
  1322. if ((*it2)->fuera()) {
  1323. Console::SetCursorPosition((*it2)->X(), (*it2)->Y());
  1324. cout << " ";
  1325. delete(*it2);
  1326. //da un valor de la lista al eliminado
  1327. it2 = B.erase(it2);
  1328. }
  1329. else {
  1330. it2++;
  1331. }
  1332. }
  1333. //Imprime , mueve y borra las balas de nave2(mueve con flechitas)
  1334. for (it3 = B2.begin(); it3 != B2.end();) {
  1335. (*it3)->mover();
  1336. if ((*it3)->fuera()) {
  1337. Console::SetCursorPosition((*it3)->X(), (*it3)->Y());
  1338. cout << " ";
  1339. delete(*it3);
  1340. //da un valor de la lista al eliminado
  1341. it3 = B2.erase(it3);
  1342. }
  1343. else {
  1344. it3++;
  1345. }
  1346. }
  1347. //Imprime a los enemigos
  1348. for (itE2 = E2.begin(); itE2 != E2.end(); itE2++) {
  1349. (*itE2)->animar();
  1350. }
  1351. //Balas de nave 1 y nave 3 que eliminan enemigos
  1352. for (itE2 = E2.begin(); itE2 != E2.end(); itE2++) {
  1353. for (it2 = B.begin(); it2 != B.end();)
  1354. {
  1355. if ((*itE2)->X() == (*it2)->X() && ((*itE2)->Y() == (*it2)->Y() || (*itE2)->Y() + 1 == (*it2)->Y()) && !((*itE2)->colisiono())) {
  1356. Console::SetCursorPosition((*it2)->X(), (*it2)->Y());
  1357. cout << " ";
  1358. delete(*it2);
  1359. it2 = B.erase(it2);
  1360. Console::SetCursorPosition((*itE2)->X(), (*itE2)->Y());
  1361. cout << " ";
  1362. (*itE2)->marcar_colision();
  1363. puntosacumulados += 5;
  1364. contadornivel2 += 1;
  1365. }
  1366. else { it2++; }
  1367.  
  1368. }
  1369. }
  1370. //Balas de nave 2 que eliminan enemigos
  1371. for (itE2 = E2.begin(); itE2 != E2.end(); itE2++) {
  1372. for (it3 = B2.begin(); it3 != B2.end();)
  1373. {
  1374. if ((*itE2)->X() == (*it3)->X() && ((*itE2)->Y() == (*it3)->Y() || (*itE2)->Y() + 1 == (*it3)->Y()) && !((*itE2)->colisiono())) {
  1375. Console::SetCursorPosition((*it3)->X(), (*it3)->Y());
  1376. cout << " ";
  1377. delete(*it3);
  1378. it3 = B2.erase(it3);
  1379. Console::SetCursorPosition((*itE2)->X(), (*itE2)->Y());
  1380. cout << " ";
  1381. (*itE2)->marcar_colision();
  1382. puntosacumulados += 5;
  1383. contadornivel2 += 1;
  1384. }
  1385. else { it3++; }
  1386.  
  1387. }
  1388. }
  1389. _sleep(0);
  1390. if (contadornivel2 == cantidadEnemigos) {
  1391. gameover2 = true;
  1392. }
  1393. }
  1394. return puntosacumulados;
  1395. }
  1396.  
  1397. int jugar3(int players, int puntosacumulados) {
  1398. int contadornivel3 = 0;
  1399. bool gameover3 = false;
  1400. //BALAS de nave1
  1401. list<BALA*> B;
  1402. list<BALA*> ::iterator it2;
  1403. //BALAS de nave 2
  1404. list<BALA*>B2;
  1405. list<BALA*> ::iterator it3;
  1406. //CREA BOSS
  1407. Boss jefe = Boss(40, 10, -1, +1);
  1408. //CREA HEROES
  1409. Nave nave1 = Nave(40, 20);
  1410. Nave nave3 = Nave(30, 20);
  1411. Nave2 nave2 = Nave2(55, 20);
  1412. //JUEGO
  1413. while (!(gameover3)) {
  1414. //puntos
  1415. Console::SetCursorPosition(89, 3);
  1416. Console::ForegroundColor = ConsoleColor::Yellow;
  1417. cout << "Puntos: " << puntosacumulados;
  1418. //Lee la tecla presionada y genera valores en las listas
  1419. if (kbhit()) {
  1420. if (players == 1) {
  1421. char tecla = getch();
  1422. nave1.animar(tecla);
  1423. if (tecla == DISPARO)
  1424. B.push_back(new BALA(nave1.X(), nave1.Y() - 1));
  1425. }
  1426. else if (players == 2) {
  1427. char tecla = getch();
  1428. nave3.animar(tecla);
  1429. if (tecla == DISPARO)
  1430. B.push_back(new BALA(nave3.X(), nave3.Y() - 1));
  1431. nave2.animar(tecla);
  1432. if (tecla == DISPARO2)
  1433. B2.push_back(new BALA(nave2.X(), nave2.Y() - 1));
  1434. }
  1435. }
  1436. //Enemigo
  1437. jefe.animar();
  1438. //Imprime , mueve y borra las balas nave1 y nave 3(mueve con awsd)
  1439. for (it2 = B.begin(); it2 != B.end();) {
  1440. (*it2)->mover();
  1441. if ((*it2)->fuera()) {
  1442. Console::SetCursorPosition((*it2)->X(), (*it2)->Y());
  1443. cout << " ";
  1444. delete(*it2);
  1445. //da un valor de la lista al eliminado
  1446. it2 = B.erase(it2);
  1447. }
  1448. else {
  1449. it2++;
  1450. }
  1451. }
  1452. //Imprime , mueve y borra las balas de nave2(mueve con flechitas)
  1453. for (it3 = B2.begin(); it3 != B2.end();) {
  1454. (*it3)->mover();
  1455. if ((*it3)->fuera()) {
  1456. Console::SetCursorPosition((*it3)->X(), (*it3)->Y());
  1457. cout << " ";
  1458. delete(*it3);
  1459. //da un valor de la lista al eliminado
  1460. it3 = B2.erase(it3);
  1461. }
  1462. else {
  1463. it3++;
  1464. }
  1465. }
  1466. //Balas de nave 1 y nave 3 que eliminan enemigos
  1467. for (it2 = B.begin(); it2 != B.end();) {
  1468. //ala izquierda
  1469. if ((jefe._x-14==(*it2)->X()&&jefe._y-4==(*it2)->Y())||(jefe._x - 13 == (*it2)->X() && jefe._y -4 == (*it2)->Y())|| jefe._x - 12 == (*it2)->X() && jefe._y -3 == (*it2)->Y()|| jefe._x - 11 == (*it2)->X() && jefe._y - 3 == (*it2)->Y()|| jefe._x - 10 == (*it2)->X() && jefe._y -2 == (*it2)->Y()|| jefe._x - 9 == (*it2)->X() && jefe._y -2 == (*it2)->Y()|| jefe._x - 8 == (*it2)->X() && jefe._y -1 == (*it2)->Y()|| jefe._x - 7 == (*it2)->X() && jefe._y -1 == (*it2)->Y()|| jefe._x - 6 == (*it2)->X() && jefe._y== (*it2)->Y()|| jefe._x - 5 == (*it2)->X() && jefe._y== (*it2)->Y()) {
  1470. Console::SetCursorPosition((*it2)->X(), (*it2)->Y());
  1471. cout << " ";
  1472. delete(*it2);
  1473. it2 = B.erase(it2);
  1474. puntosacumulados += 5;
  1475. contadornivel3 += 1;
  1476. }
  1477. //centro
  1478. else if ((jefe._x - 4 == (*it2)->X() && jefe._y+1== (*it2)->Y()) || (jefe._x - 3 == (*it2)->X() && jefe._y+1== (*it2)->Y()) || (jefe._x - 2 == (*it2)->X() && jefe._y+1== (*it2)->Y()) || (jefe._x - 1 == (*it2)->X() && jefe._y+1== (*it2)->Y()) || (jefe._x == (*it2)->X() && jefe._y+1== (*it2)->Y()) || (jefe._x + 1 == (*it2)->X() && jefe._y+1== (*it2)->Y()) || (jefe._x + 2 == (*it2)->X() && jefe._y+1== (*it2)->Y()) || (jefe._x + 3 == (*it2)->X() && jefe._y+1== (*it2)->Y()) || (jefe._x + 4 == (*it2)->X() && jefe._y+1== (*it2)->Y()) || (jefe._x + 5 == (*it2)->X() && jefe._y+1== (*it2)->Y())) {
  1479. Console::SetCursorPosition((*it2)->X(), (*it2)->Y());
  1480. cout << " ";
  1481. delete(*it2);
  1482. it2 = B.erase(it2);
  1483. puntosacumulados += 5;
  1484. contadornivel3 += 1;
  1485. }
  1486. //ala derecha
  1487. else if ((jefe._x + 15 == (*it2)->X() && jefe._y -4 == (*it2)->Y()) || (jefe._x + 14 == (*it2)->X() && jefe._y-4 == (*it2)->Y()) || (jefe._x + 13 == (*it2)->X() && jefe._y-3 == (*it2)->Y()) || (jefe._x + 12 == (*it2)->X() && jefe._y-3== (*it2)->Y()) || (jefe._x + 11 == (*it2)->X() && jefe._y-2== (*it2)->Y()) || (jefe._x + 10 == (*it2)->X() && jefe._y-2== (*it2)->Y()) || (jefe._x + 9 == (*it2)->X() && jefe._y-1== (*it2)->Y()) || (jefe._x + 8 == (*it2)->X() && jefe._y-1== (*it2)->Y()) || (jefe._x + 7 == (*it2)->X() && jefe._y== (*it2)->Y()) || (jefe._x + 6 == (*it2)->X() && jefe._y== (*it2)->Y())) {
  1488. Console::SetCursorPosition((*it2)->X(), (*it2)->Y());
  1489. cout << " ";
  1490. delete(*it2);
  1491. it2 = B.erase(it2);
  1492. puntosacumulados += 5;
  1493. contadornivel3 += 1;
  1494. }
  1495. else { it2++; }
  1496. }
  1497. //Balas de nave 2 que eliminan enemigos
  1498. for (it3 = B2.begin(); it3 != B2.end();){
  1499. //ala izquierda
  1500. if ((jefe._x - 14 == (*it3)->X() && jefe._y - 4 == (*it3)->Y()) || (jefe._x - 13 == (*it3)->X() && jefe._y - 4 == (*it3)->Y()) || jefe._x - 12 == (*it3)->X() && jefe._y - 3 == (*it3)->Y() || jefe._x - 11 == (*it3)->X() && jefe._y - 3 == (*it3)->Y() || jefe._x - 10 == (*it3)->X() && jefe._y - 2 == (*it3)->Y() || jefe._x - 9 == (*it3)->X() && jefe._y - 2 == (*it3)->Y() || jefe._x - 8 == (*it3)->X() && jefe._y - 1 == (*it3)->Y() || jefe._x - 7 == (*it3)->X() && jefe._y - 1 == (*it3)->Y() || jefe._x - 6 == (*it3)->X() && jefe._y == (*it3)->Y() || jefe._x - 5 == (*it3)->X() && jefe._y == (*it3)->Y()) {
  1501. Console::SetCursorPosition((*it3)->X(), (*it3)->Y());
  1502. cout << " ";
  1503. delete(*it3);
  1504. it3 = B2.erase(it3);
  1505. puntosacumulados += 5;
  1506. contadornivel3 += 1;
  1507. }
  1508. //centro
  1509. else if ((jefe._x - 4 == (*it3)->X() && jefe._y + 1 == (*it3)->Y()) || (jefe._x - 3 == (*it3)->X() && jefe._y + 1 == (*it3)->Y()) || (jefe._x - 2 == (*it3)->X() && jefe._y + 1 == (*it3)->Y()) || (jefe._x - 1 == (*it3)->X() && jefe._y + 1 == (*it3)->Y()) || (jefe._x == (*it3)->X() && jefe._y + 1 == (*it3)->Y()) || (jefe._x + 1 == (*it3)->X() && jefe._y + 1 == (*it3)->Y()) || (jefe._x + 2 == (*it3)->X() && jefe._y + 1 == (*it3)->Y()) || (jefe._x + 3 == (*it3)->X() && jefe._y + 1 == (*it3)->Y()) || (jefe._x + 4 == (*it3)->X() && jefe._y + 1 == (*it3)->Y()) || (jefe._x + 5 == (*it3)->X() && jefe._y + 1 == (*it3)->Y())) {
  1510. Console::SetCursorPosition((*it3)->X(), (*it3)->Y());
  1511. cout << " ";
  1512. delete(*it3);
  1513. it3 = B2.erase(it3);
  1514. puntosacumulados += 5;
  1515. contadornivel3 += 1;
  1516. }
  1517. //ala derecha
  1518. else if ((jefe._x + 15 == (*it3)->X() && jefe._y - 4 == (*it3)->Y()) || (jefe._x + 14 == (*it3)->X() && jefe._y - 4 == (*it3)->Y()) || (jefe._x + 13 == (*it3)->X() && jefe._y - 3 == (*it3)->Y()) || (jefe._x + 12 == (*it3)->X() && jefe._y - 3 == (*it3)->Y()) || (jefe._x + 11 == (*it3)->X() && jefe._y - 2 == (*it3)->Y()) || (jefe._x + 10 == (*it3)->X() && jefe._y - 2 == (*it3)->Y()) || (jefe._x + 9 == (*it3)->X() && jefe._y - 1 == (*it3)->Y()) || (jefe._x + 8 == (*it3)->X() && jefe._y - 1 == (*it3)->Y()) || (jefe._x + 7 == (*it3)->X() && jefe._y == (*it3)->Y()) || (jefe._x + 6 == (*it3)->X() && jefe._y == (*it3)->Y())) {
  1519. Console::SetCursorPosition((*it3)->X(), (*it3)->Y());
  1520. cout << " ";
  1521. delete(*it3);
  1522. it3 = B2 .erase(it3);
  1523. puntosacumulados += 5;
  1524. contadornivel3 += 1;
  1525. }
  1526. else { it3++; }
  1527. }
  1528. //Velocidad de los enemigos
  1529. _sleep(10);
  1530. if (contadornivel3 == 500) {
  1531. gameover3 = true;
  1532. }
  1533. }
  1534. return puntosacumulados;
  1535. }
  1536.  
  1537. int main() {
  1538. srand(time(NULL));
  1539. int nivel;
  1540. int players;
  1541. int puntosacumulados = 0;
  1542. Console::CursorVisible = false;
  1543. copiasmatriz(nivel = 1);
  1544. imprimirmatriz(nivel = 1);
  1545. Console::SetCursorPosition(22, 27);
  1546. Console::ForegroundColor = ConsoleColor::White;
  1547. cout << "<<PRESIONE CUALQUIER TECLA PARA COMENZAR>>";
  1548. //Pedir jugador
  1549. if (getch()) {
  1550. do {
  1551. system("cls");
  1552. copiasmatriz(nivel = 2);
  1553. imprimirmatriz(nivel = 2);
  1554. Console::SetCursorPosition(16, 14);
  1555. Console::ForegroundColor = ConsoleColor::Green;
  1556. cout << "Seleccione una cantidad de jugadores entre 1 y 2: ";
  1557. Console::SetCursorPosition(66, 14);
  1558. cin >> players;
  1559. } while (!(players == 1 || players == 2));
  1560. //MOSTRAR NIVEL1
  1561. MatrizNivel1();
  1562. }
  1563. //JUEGO DEL NIVEL1
  1564. if (getch()) {
  1565. system("cls");
  1566. copiasmatriz(nivel = 2);
  1567. imprimirmatriz(nivel = 2);
  1568. puntosacumulados = jugar(players);
  1569. }
  1570. //Nivel2
  1571. MatrizNivel2();
  1572. //Juego del Nivel2
  1573. if (getch()) {
  1574. system("cls");
  1575. copiasmatriz(nivel = 2);
  1576. imprimirmatriz(nivel = 2);
  1577. puntosacumulados = jugar2(players, puntosacumulados);
  1578. }
  1579. //Nivel 3
  1580. MatrizNivel3();
  1581. //Juego del Nivel3
  1582. if (getch()) {
  1583. system("cls");
  1584. copiasmatriz(nivel = 2);
  1585. imprimirmatriz(nivel = 2);
  1586. jugar3(players, puntosacumulados);
  1587. }
  1588. return 0;
  1589. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement