Advertisement
GonzaloGuerreroP

Juego_Version3

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