Advertisement
GonzaloGuerreroP

Juego_Version6

Nov 17th, 2019
158
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 21.40 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. int X() { return _x; }
  244. int Y() { return _y; }
  245. void animar() {
  246. if (_retraso == LIMITER) {
  247.  
  248. borrar();
  249. mover();
  250. dibujar();
  251. _retraso = 0;
  252. }
  253. _retraso++;
  254. }
  255. void borrar() {
  256. Console::SetCursorPosition(_x, _y);
  257. cout << " ";
  258. }
  259. void mover() {
  260. if (_x + _dx < 1 || _x + _dx > 83) {
  261. _dx *= -1;
  262. _y++;
  263. }
  264. if (_y == 28) {
  265. _y = 1;
  266. }
  267. _x += _dx;
  268. }
  269. void dibujar() {
  270. Console::SetCursorPosition(_x, _y);
  271. Console::ForegroundColor = ConsoleColor::Green;
  272. cout << _img;
  273. }
  274. };
  275.  
  276. typedef struct Nave2 {
  277. int _x, _y, _vidas;
  278. public:
  279. Nave2(int x, int y) {
  280. _x = x;
  281. _y = y;
  282. _vidas = 3;
  283. }
  284. int X() { return _x; }
  285. int Y() { return _y; }
  286. void animar(short tecla) {
  287. borrar();
  288. mover(tecla);
  289. dibujar();
  290. }
  291. void borrar() {
  292. Console::SetCursorPosition(_x, _y);
  293. cout << " ";
  294. Console::SetCursorPosition(_x - 1, _y + 1);
  295. cout << " ";
  296. Console::SetCursorPosition(_x + 1, _y + 1);
  297. cout << " ";
  298. Console::SetCursorPosition(_x - 1, _y + 1);
  299. cout << " ";
  300. Console::SetCursorPosition(_x, _y + 2);
  301. cout << " ";
  302. Console::SetCursorPosition(_x - 1, _y + 2);
  303. cout << " ";
  304. Console::SetCursorPosition(_x + 1, _y + 2);
  305. cout << " ";
  306. Console::SetCursorPosition(_x + 2, _y + 2);
  307. cout << " ";
  308. Console::SetCursorPosition(_x - 2, _y + 2);
  309. cout << " ";
  310. Console::SetCursorPosition(_x - 2, _y + 3);
  311. cout << " ";
  312. Console::SetCursorPosition(_x + 2, _y + 3);
  313. cout << " ";
  314. }
  315. void mover(short tecla) {
  316. switch (tecla) {
  317. case ARRIBA: if (_y - 1 >= 1) _y--; break;
  318. case ABAJO: if (_y + 4 <= 27) _y++; break;
  319. case IZQUIERDA: if (_x - 2 >= 2) _x--; break;
  320. case DERECHA: if (_x + 3 <= 83) _x++; break;
  321. }
  322. }
  323. void dibujar() {
  324. Console::SetCursorPosition(_x, _y);
  325. Console::ForegroundColor = ConsoleColor::White;
  326. cout << char(219);
  327. Console::SetCursorPosition(_x, _y + 1);
  328. Console::ForegroundColor = ConsoleColor::Red;
  329. cout << char(219);
  330. Console::SetCursorPosition(_x + 1, _y + 1);
  331. Console::ForegroundColor = ConsoleColor::White;
  332. cout << char(219);
  333. Console::SetCursorPosition(_x - 1, _y + 1);
  334. Console::ForegroundColor = ConsoleColor::White;
  335. cout << char(219);
  336. Console::SetCursorPosition(_x, _y + 2);
  337. Console::ForegroundColor = ConsoleColor::Red;
  338. cout << char(223);
  339. Console::SetCursorPosition(_x - 1, _y + 2);
  340. Console::ForegroundColor = ConsoleColor::Red;
  341. cout << char(219);
  342. Console::SetCursorPosition(_x + 1, _y + 2);
  343. Console::ForegroundColor = ConsoleColor::Red;
  344. cout << char(219);
  345. Console::SetCursorPosition(_x + 2, _y + 2);
  346. Console::ForegroundColor = ConsoleColor::White;
  347. cout << char(219);
  348. Console::SetCursorPosition(_x - 2, _y + 2);
  349. Console::ForegroundColor = ConsoleColor::White;
  350. cout << char(219);
  351. Console::SetCursorPosition(_x - 2, _y + 3);
  352. Console::ForegroundColor = ConsoleColor::White;
  353. cout << char(223);
  354. Console::SetCursorPosition(_x + 2, _y + 3);
  355. Console::ForegroundColor = ConsoleColor::White;
  356. cout << char(223);
  357. }
  358. };
  359.  
  360. typedef struct BALA {
  361. int _x, _y;
  362. public:
  363. BALA(int x, int y) {
  364. _x = x;
  365. _y = y;
  366. }
  367. int X() { return _x;}
  368. int Y() {return _y;}
  369. void mover() {
  370. Console::SetCursorPosition(_x, _y);
  371. cout << " ";
  372. _y--;
  373. Console::SetCursorPosition(_x, _y);
  374. Console::ForegroundColor = ConsoleColor::Blue;
  375. cout << "*";
  376. }
  377.  
  378. bool fuera() {
  379. if (_y == 1) return true;
  380. return false;
  381. }
  382. };
  383.  
  384. void jugar(int players) {
  385. int puntos = 0;
  386. bool gameover = false;
  387. //BALAS de nave1 y nave3
  388. list<BALA*> B;
  389. list<BALA*> ::iterator it2;
  390. //BALAS de nave 2
  391. list<BALA*>B2;
  392. list<BALA*> ::iterator it3;
  393. //ENEMIGOS
  394. list<NaveEnemiga*> E;
  395. list<NaveEnemiga*>::iterator it;
  396. //CREA ENEMIGOS
  397. for (int i = 0; i < 20; i++)
  398. {
  399. E.push_back(new NaveEnemiga(2 + (i * 3), 2, -1, +1));
  400. }
  401. //CREA HEROES
  402. Nave nave1 = Nave(40, 20);
  403. Nave nave3 = Nave(30, 20);
  404. Nave2 nave2 = Nave2(55, 20);
  405. //JUEGO
  406. while (!(gameover)) {
  407. //puntos
  408. Console::SetCursorPosition(89,3);
  409. Console::ForegroundColor = ConsoleColor::Yellow;
  410. cout << "Puntos: " << puntos;
  411. //Lee la tecla presionada y genera valores en las listas
  412. if (kbhit()) {
  413. if (players == 1) {
  414. char tecla = getch();
  415. nave1.animar(tecla);
  416. if (tecla == DISPARO)
  417. B.push_back(new BALA(nave1.X(), nave1.Y()-1));
  418. }
  419. else if (players == 2) {
  420. char tecla = getch();
  421. nave3.animar(tecla);
  422. if (tecla == DISPARO)
  423. B.push_back(new BALA(nave3.X(), nave3.Y() - 1));
  424. nave2.animar(tecla);
  425. if (tecla == DISPARO2)
  426. B2.push_back(new BALA(nave2.X(), nave2.Y() - 1));
  427. }
  428. }
  429. //Imprime , mueve y borra las balas nave1 y nave3 (mueve con awsd)
  430. for (it2 = B.begin(); it2 != B.end();) {
  431. (*it2)->mover();
  432. if ((*it2)->fuera()) {
  433. Console::SetCursorPosition((*it2)->X(), (*it2)->Y());
  434. cout << " ";
  435. delete(*it2);
  436. //da un valor de la lista al eliminado
  437. it2 = B.erase(it2);
  438. }
  439. else {
  440. it2++;
  441. }
  442. }
  443. //Imprime , mueve y borra las balas de nave2(mueve con flechitas)
  444. for (it3 = B2.begin(); it3 != B2.end();) {
  445. (*it3)->mover();
  446. if ((*it3)->fuera()) {
  447. Console::SetCursorPosition((*it3)->X(), (*it3)->Y());
  448. cout << " ";
  449. delete(*it3);
  450. //da un valor de la lista al eliminado
  451. it3 = B2.erase(it3);
  452. }
  453. else {
  454. it3++;
  455. }
  456. }
  457. //Imprime a los enemigos
  458. for (it = E.begin(); it != E.end(); it++) {
  459. (*it)->animar();
  460. }
  461. //Balas de nave 1 y nave 3 que eliminan enemigos
  462. for (it = E.begin(); it != E.end(); it++) {
  463. for ( it2 = B.begin(); it2 != B.end();)
  464. {
  465. if ((*it)->X() == (*it2)->X() && ((*it)->Y() == (*it2)->Y() || (*it)->Y() + 1 == (*it2)->Y())) {
  466. Console::SetCursorPosition((*it2)->X(), (*it2)->Y());
  467. cout << " ";
  468. delete(*it2);
  469. it2 = B.erase(it2);
  470. Console::SetCursorPosition((*it)->X(), (*it)->Y());
  471. cout << " ";
  472. delete(*it);
  473. it = E.erase(it);
  474. puntos += 5;
  475. }
  476. else { it2++; }
  477.  
  478. }
  479. }
  480. //Balas de nave 2 que eliminan enemigos
  481. for (it = E.begin(); it != E.end(); it++) {
  482. for (it3 = B2.begin(); it3 != B2.end();)
  483. {
  484. if ((*it)->X() == (*it3)->X() && ((*it)->Y() == (*it3)->Y() || (*it)->Y() + 1 == (*it3)->Y())) {
  485. Console::SetCursorPosition((*it3)->X(), (*it3)->Y());
  486. cout << " ";
  487. delete(*it3);
  488. it3 = B2.erase(it3);
  489. Console::SetCursorPosition((*it)->X(), (*it)->Y());
  490. cout << " ";
  491. delete(*it);
  492. it = E.erase(it);
  493. puntos += 5;
  494. }
  495. else { it3++; }
  496. }
  497. }
  498. _sleep(10);
  499. }
  500.  
  501. }
  502.  
  503. int main() {
  504. int nivel;
  505. int players;
  506. Console::CursorVisible = false;
  507. copiasmatriz(nivel = 1);
  508. imprimirmatriz(nivel = 1);
  509. Console::SetCursorPosition(27, 27);
  510. Console::ForegroundColor = ConsoleColor::White;
  511. cout << "<<PRESIONE CUALQUIER TECLA PARA COMENZAR>>";
  512. if (getch()) {
  513. do {
  514. system("cls");
  515. copiasmatriz(nivel = 2);
  516. imprimirmatriz(nivel = 2);
  517. Console::SetCursorPosition(16, 14);
  518. Console::ForegroundColor = ConsoleColor::Green;
  519. cout << "Seleccione una cantidad de jugadores entre 1 y 2: ";
  520. cin >> players;
  521. } while (!(players == 1 || players == 2));
  522. system("cls");
  523. copiasmatriz(nivel = 2);
  524. imprimirmatriz(nivel = 2);
  525. jugar(players);
  526. }
  527. return 0;
  528. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement