GonzaloGuerreroP

Juego_Version2

Nov 15th, 2019
153
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 18.46 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 300
  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,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,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. public:
  134. Nave(int x, int y) {
  135. _x = x;
  136. _y = y;
  137. _vidas = 3;
  138. }
  139. void animar(short tecla) {
  140. borrar();
  141. mover(tecla);
  142. dibujar();
  143. }
  144. void borrar() {
  145. Console::SetCursorPosition(_x, _y);
  146. cout << " ";
  147. Console::SetCursorPosition(_x-1, _y+1);
  148. cout << " ";
  149. Console::SetCursorPosition(_x + 1, _y + 1);
  150. cout << " ";
  151. Console::SetCursorPosition(_x -1, _y + 1);
  152. cout << " ";
  153. Console::SetCursorPosition(_x, _y + 2);
  154. cout << " ";
  155. Console::SetCursorPosition(_x - 1, _y + 2);
  156. cout << " ";
  157. Console::SetCursorPosition(_x + 1 , _y + 2);
  158. cout << " ";
  159. Console::SetCursorPosition(_x + 2, _y + 2);
  160. cout << " ";
  161. Console::SetCursorPosition(_x - 2, _y + 2);
  162. cout << " ";
  163. Console::SetCursorPosition(_x - 2, _y + 3);
  164. cout << " ";
  165. Console::SetCursorPosition(_x + 2, _y + 3);
  166. cout << " ";
  167. }
  168. void mover(short tecla) {
  169. short direccion;
  170. direccion = toupper(tecla);
  171. switch (direccion) {
  172. case 'W': if (_y - 1 >= 1) _y--; break;
  173. case 'S': if (_y + 4 <= 27) _y++; break;
  174. case 'A': if (_x - 2 >= 2) _x--; break;
  175. case 'D': if (_x + 3 <= 83) _x++; break;
  176. }
  177. }
  178. void dibujar() {
  179. Console::SetCursorPosition(_x, _y);
  180. Console::ForegroundColor = ConsoleColor::Green;
  181. cout << char(219);
  182. Console::SetCursorPosition(_x, _y+1);
  183. Console::ForegroundColor = ConsoleColor::Blue;
  184. cout << char(219);
  185. Console::SetCursorPosition(_x + 1, _y + 1);
  186. Console::ForegroundColor = ConsoleColor::Green;
  187. cout << char(219);
  188. Console::SetCursorPosition(_x -1, _y + 1);
  189. Console::ForegroundColor = ConsoleColor::Green;
  190. cout << char(219);
  191. Console::SetCursorPosition(_x, _y + 2);
  192. Console::ForegroundColor = ConsoleColor::Blue;
  193. cout << char(223);
  194. Console::SetCursorPosition(_x - 1, _y + 2);
  195. Console::ForegroundColor = ConsoleColor::Blue;
  196. cout << char(219);
  197. Console::SetCursorPosition(_x +1 , _y + 2);
  198. Console::ForegroundColor = ConsoleColor::Blue;
  199. cout << char(219);
  200. Console::SetCursorPosition(_x+2, _y + 2);
  201. Console::ForegroundColor = ConsoleColor::Green;
  202. cout << char(219);
  203. Console::SetCursorPosition(_x -2, _y + 2);
  204. Console::ForegroundColor = ConsoleColor::Green;
  205. cout << char(219);
  206. Console::SetCursorPosition(_x - 2, _y + 3);
  207. Console::ForegroundColor = ConsoleColor::Green;
  208. cout << char(223);
  209. Console::SetCursorPosition(_x + 2, _y + 3);
  210. Console::ForegroundColor = ConsoleColor::Green;
  211. cout << char(223);
  212. }
  213. };
  214.  
  215. typedef struct NaveEnemiga {
  216. short _x, _y, _dx, _dy, _retraso;
  217. char _img;
  218. public:
  219. NaveEnemiga(short x, short y, short dx, short dy) {
  220. _x = x;
  221. _y = y;
  222. _dx = dx;
  223. _dy = dy;
  224. _retraso = 0;
  225. _img = (char)2;
  226. }
  227. void animar() {
  228. if (_retraso == LIMITER) {
  229. _sleep(10);
  230. borrar();
  231. mover();
  232. dibujar();
  233. _retraso = 0;
  234. }
  235. _retraso++;
  236. }
  237. void borrar() {
  238. Console::SetCursorPosition(_x, _y);
  239. cout << " ";
  240. }
  241. void mover() {
  242. if (_x + _dx < 1 || _x + _dx > 83) {
  243. _dx *= -1;
  244. _y++;
  245. }
  246. if (_y == 28) {
  247. _y = 1;
  248. }
  249. _x += _dx;
  250. }
  251. void dibujar() {
  252. Console::SetCursorPosition(_x, _y);
  253. Console::ForegroundColor = ConsoleColor::Green;
  254. cout << _img;
  255. }
  256. };
  257.  
  258. typedef struct Nave2 {
  259. int _x, _y, _vidas;
  260. public:
  261. Nave2(int x, int y) {
  262. _x = x;
  263. _y = y;
  264. _vidas = 3;
  265. }
  266. void animar(short tecla) {
  267. borrar();
  268. mover(tecla);
  269. dibujar();
  270. }
  271. void borrar() {
  272. Console::SetCursorPosition(_x, _y);
  273. cout << " ";
  274. Console::SetCursorPosition(_x - 1, _y + 1);
  275. cout << " ";
  276. Console::SetCursorPosition(_x + 1, _y + 1);
  277. cout << " ";
  278. Console::SetCursorPosition(_x - 1, _y + 1);
  279. cout << " ";
  280. Console::SetCursorPosition(_x, _y + 2);
  281. cout << " ";
  282. Console::SetCursorPosition(_x - 1, _y + 2);
  283. cout << " ";
  284. Console::SetCursorPosition(_x + 1, _y + 2);
  285. cout << " ";
  286. Console::SetCursorPosition(_x + 2, _y + 2);
  287. cout << " ";
  288. Console::SetCursorPosition(_x - 2, _y + 2);
  289. cout << " ";
  290. Console::SetCursorPosition(_x - 2, _y + 3);
  291. cout << " ";
  292. Console::SetCursorPosition(_x + 2, _y + 3);
  293. cout << " ";
  294. }
  295. void mover(short tecla) {
  296. switch (tecla) {
  297. case ARRIBA: if (_y - 1 >= 1) _y--; break;
  298. case ABAJO: if (_y + 4 <= 27) _y++; break;
  299. case IZQUIERDA: if (_x - 2 >= 2) _x--; break;
  300. case DERECHA: if (_x + 3 <= 83) _x++; break;
  301. }
  302. }
  303. void dibujar() {
  304. Console::SetCursorPosition(_x, _y);
  305. Console::ForegroundColor = ConsoleColor::White;
  306. cout << char(219);
  307. Console::SetCursorPosition(_x, _y + 1);
  308. Console::ForegroundColor = ConsoleColor::Red;
  309. cout << char(219);
  310. Console::SetCursorPosition(_x + 1, _y + 1);
  311. Console::ForegroundColor = ConsoleColor::White;
  312. cout << char(219);
  313. Console::SetCursorPosition(_x - 1, _y + 1);
  314. Console::ForegroundColor = ConsoleColor::White;
  315. cout << char(219);
  316. Console::SetCursorPosition(_x, _y + 2);
  317. Console::ForegroundColor = ConsoleColor::Red;
  318. cout << char(223);
  319. Console::SetCursorPosition(_x - 1, _y + 2);
  320. Console::ForegroundColor = ConsoleColor::Red;
  321. cout << char(219);
  322. Console::SetCursorPosition(_x + 1, _y + 2);
  323. Console::ForegroundColor = ConsoleColor::Red;
  324. cout << char(219);
  325. Console::SetCursorPosition(_x + 2, _y + 2);
  326. Console::ForegroundColor = ConsoleColor::White;
  327. cout << char(219);
  328. Console::SetCursorPosition(_x - 2, _y + 2);
  329. Console::ForegroundColor = ConsoleColor::White;
  330. cout << char(219);
  331. Console::SetCursorPosition(_x - 2, _y + 3);
  332. Console::ForegroundColor = ConsoleColor::White;
  333. cout << char(223);
  334. Console::SetCursorPosition(_x + 2, _y + 3);
  335. Console::ForegroundColor = ConsoleColor::White;
  336. cout << char(223);
  337. }
  338. };
  339.  
  340. void jugar(int players) {
  341. bool continuar = true;
  342. NaveEnemiga enemigo1 = NaveEnemiga(5, 2, -1, +1);
  343. NaveEnemiga enemigo2 = NaveEnemiga(2, 2, -1, +1);
  344. NaveEnemiga enemigo3 = NaveEnemiga(8, 2, -1, +1);
  345. NaveEnemiga enemigo4 = NaveEnemiga(11, 2, -1, +1);
  346. Nave nave1 = Nave(40, 20);
  347. Nave nave3 = Nave(30, 20);
  348. Nave2 nave2 = Nave2(55, 20);
  349. if (players == 1) {
  350. while (continuar) {
  351. if (kbhit()) {
  352. nave1.animar(getch());
  353. }
  354. enemigo1.animar();
  355. enemigo2.animar();
  356. enemigo3.animar();
  357. enemigo4.animar();
  358. }
  359. getch();
  360. }
  361. if (players == 2) {
  362. while (continuar) {
  363. if (kbhit()) {
  364. nave3.animar(getch());
  365. }
  366. if (kbhit()) {
  367. nave2.animar(getch());
  368. }
  369. enemigo1.animar();
  370. enemigo2.animar();
  371. enemigo3.animar();
  372. enemigo4.animar();
  373. }
  374. getch();
  375. }
  376. }
  377.  
  378. int main() {
  379. int nivel;
  380. int players;
  381. int dificultad;
  382. Console::CursorVisible = false;
  383. copiasmatriz(nivel = 1);
  384. imprimirmatriz(nivel = 1);
  385. Console::SetCursorPosition(27, 27);
  386. Console::ForegroundColor = ConsoleColor::White;
  387. cout << "<<PRESIONE ENTER PARA COMENZAR>>";
  388. if (getch()){
  389. system("cls");
  390. copiasmatriz(nivel = 2);
  391. imprimirmatriz(nivel = 2);
  392. Console::SetCursorPosition(16, 14);
  393. Console::ForegroundColor = ConsoleColor::Green;
  394. cout << "Seleccione una cantidad de jugadores entre 1 y 2: ";
  395. cin >> players;
  396. Console::SetCursorPosition(16, 16);
  397. cout << "Seleccione el nivel que desee jugar: ";
  398. cin >> dificultad;
  399. system("cls");
  400. copiasmatriz(nivel = 2);
  401. imprimirmatriz(nivel = 2);
  402. jugar( players);
  403. }
  404. return 0;
  405. }
Advertisement
Add Comment
Please, Sign In to add comment