Advertisement
Guest User

Untitled

a guest
May 21st, 2018
139
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 48.55 KB | None | 0 0
  1. #include <SFML/Graphics.hpp>
  2.  
  3. #include <SFML/Audio.hpp>
  4.  
  5. #include <iostream>
  6.  
  7. #include <fstream>
  8.  
  9. #include <string>
  10.  
  11. #include <windows.h>
  12.  
  13. #include <list>
  14.  
  15. #include "Player.h"
  16.  
  17. #include "Bullet.h"
  18.  
  19. #include "view.h"
  20.  
  21.  
  22.  
  23. using namespace sf;
  24.  
  25.  
  26.  
  27. bool pause(RenderWindow & window, int *playerscount) {
  28.  
  29. Texture menuTexture1, menuTexture2, menuTexture3, menuBackground;
  30.  
  31. menuTexture1.loadFromFile("images/111.png");
  32.  
  33. menuTexture2.loadFromFile("images/222.png");
  34.  
  35. menuTexture3.loadFromFile("images/333.png");
  36.  
  37. menuBackground.loadFromFile("images/Penguins.jpg");
  38.  
  39. Sprite menu1(menuTexture1), menu2(menuTexture2), menu3(menuTexture3), menuBg(menuBackground);
  40.  
  41. bool isMenu = 1;
  42.  
  43. int menuNum = 0;
  44.  
  45. menu1.setPosition(100, 30);
  46.  
  47. menu2.setPosition(100, 90);
  48.  
  49. menu3.setPosition(100, 150);
  50.  
  51. menuBg.setPosition(345, 0);
  52.  
  53.  
  54.  
  55. //////////////////////////////МЕНЮ///////////////////
  56.  
  57. while (isMenu)
  58.  
  59. {
  60.  
  61. menu1.setColor(Color::White);
  62.  
  63. menu2.setColor(Color::White);
  64.  
  65. menu3.setColor(Color::White);
  66.  
  67. menuNum = 0;
  68.  
  69. window.clear(Color(129, 181, 221));
  70.  
  71.  
  72.  
  73. if (IntRect(100, 30, 300, 50).contains(Mouse::getPosition(window))) { menu1.setColor(Color::Blue); menuNum = 1; }
  74.  
  75. if (IntRect(100, 90, 300, 50).contains(Mouse::getPosition(window))) { menu2.setColor(Color::Blue); menuNum = 2; }
  76.  
  77. if (IntRect(100, 150, 300, 50).contains(Mouse::getPosition(window))) { menu3.setColor(Color::Blue); menuNum = 3; }
  78.  
  79.  
  80.  
  81. if (Mouse::isButtonPressed(Mouse::Left))
  82.  
  83. {
  84.  
  85. if (menuNum == 1) { *playerscount = 2; return true; }
  86.  
  87. if (menuNum == 2) { *playerscount = 3; return true; }
  88.  
  89. if (menuNum == 3) { window.close(); return false; }
  90.  
  91.  
  92.  
  93. }
  94.  
  95.  
  96.  
  97. window.draw(menuBg);
  98.  
  99. window.draw(menu1);
  100.  
  101. window.draw(menu2);
  102.  
  103. window.draw(menu3);
  104.  
  105.  
  106.  
  107. window.display();
  108.  
  109. }
  110.  
  111. }
  112.  
  113. bool StartGame(RenderWindow &window, int *playercount, bool *firststart) {
  114.  
  115. int tempj = 0, tempi = 0;
  116.  
  117. int snd = 0;
  118.  
  119. String camera = "y";
  120.  
  121. bool cameradone = true;
  122.  
  123. float nt = 0;
  124.  
  125. float endround = 0;
  126.  
  127. //if (menu(playercount) == true) return false;
  128.  
  129. int playerscount = *playercount;
  130.  
  131. int scrwidth = 1800, scrheight = 800;
  132.  
  133. //menu(window, &playerscount);
  134.  
  135. bool soundover = false;
  136.  
  137. bool soundover1 = false;
  138.  
  139. bool soundover2 = false;
  140.  
  141. bool soundover3 = false;
  142.  
  143. Texture tileSet;
  144.  
  145. tileSet.loadFromFile("Mario_Tileset.png");
  146.  
  147. //Загрузка звуков
  148.  
  149. SoundBuffer buffer;
  150.  
  151. buffer.loadFromFile("sfx/4.ogg");
  152.  
  153. Sound kill(buffer);
  154.  
  155.  
  156.  
  157. SoundBuffer buffer1;
  158.  
  159. buffer1.loadFromFile("sfx/akshot.ogg");
  160.  
  161. Sound damage(buffer1);
  162.  
  163.  
  164.  
  165. SoundBuffer buffer2;
  166.  
  167. buffer2.loadFromFile("sfx/pistolshot.ogg");
  168.  
  169. Sound revolversn(buffer2);
  170.  
  171.  
  172.  
  173. SoundBuffer buffer3;
  174.  
  175. buffer3.loadFromFile("sfx/bazookashot.ogg");
  176.  
  177. Sound bazookasn(buffer3);
  178.  
  179.  
  180.  
  181. SoundBuffer buffer4;
  182.  
  183. buffer4.loadFromFile("sfx/explotion.ogg");
  184.  
  185. Sound exploz(buffer4);
  186.  
  187.  
  188.  
  189. Music music;
  190.  
  191. music.openFromFile("sfx/li.ogg");
  192.  
  193.  
  194.  
  195. Music gamem;
  196.  
  197. gamem.openFromFile("sfx/ramsing.ogg");
  198.  
  199. gamem.setVolume(25);// громкость фоновой музыки
  200.  
  201. gamem.play();
  202.  
  203.  
  204.  
  205. //Загрузка текстур
  206.  
  207. Texture t;
  208.  
  209. t.loadFromFile("fang.png");
  210.  
  211.  
  212.  
  213. Texture bg;
  214.  
  215. bg.loadFromFile("bg.png");
  216.  
  217.  
  218.  
  219. Texture bul;
  220.  
  221. bul.loadFromFile("bullet.png");
  222.  
  223.  
  224.  
  225. Texture revolver;
  226.  
  227. revolver.loadFromFile("revolver.png");
  228.  
  229.  
  230.  
  231. Texture bazooka;
  232.  
  233. bazooka.loadFromFile("bazooka.png");
  234.  
  235. //Фон
  236.  
  237. Sprite background(bg);
  238.  
  239. background.setOrigin(bg.getSize().x / 3, bg.getSize().y / 3);
  240.  
  241. background.setScale(2.1f, 2.1f); //размер карты
  242.  
  243.  
  244.  
  245. float currentFrame = 0;
  246.  
  247. PLAYER p(t, 30 * 32, 20 * 32);
  248.  
  249. PLAYER p2(t, 15 * 32, 5 * 32);
  250.  
  251. PLAYER p3(t, 26 * 32, 5 * 32);
  252.  
  253. if (playerscount <= 2) {
  254.  
  255. p3.life = -1;
  256.  
  257. }
  258.  
  259. std::list<Bullet*> bullets;
  260.  
  261. std::list<Bullet*>::iterator it;
  262.  
  263.  
  264.  
  265. Sprite tile(tileSet);
  266.  
  267. //tile.setScale(1.1f, 1.1f);
  268.  
  269.  
  270.  
  271. Clock clock;
  272.  
  273. RectangleShape rectangle(Vector2f(32, 32));
  274.  
  275. while (window.isOpen())
  276.  
  277. {
  278.  
  279. float time = clock.getElapsedTime().asMicroseconds();
  280.  
  281. clock.restart();
  282.  
  283. time = time / 700;
  284.  
  285. if (time > 20) time = 20;
  286.  
  287. Event event;
  288.  
  289. while (window.pollEvent(event))
  290.  
  291. {
  292.  
  293. if (event.type == Event::Closed)
  294.  
  295. window.close();
  296.  
  297. }
  298.  
  299. if (p.life>0) {
  300.  
  301. if (Keyboard::isKeyPressed(Keyboard::Space)) {
  302.  
  303. if ((p.weapon == "ak-47") && (p.ammo>0) && (p.reload>0.6) && (p.onStairs == false)) {
  304.  
  305. if (p.ammoin > 0) {
  306.  
  307. bullets.push_back(new Bullet(bul, p.rect.left, p.rect.top + 25, p.dir, p.weapon, "p1"));
  308.  
  309. damage.play();
  310.  
  311. p.reload = 0;
  312.  
  313. p.ammo -= 1;
  314.  
  315. p.ammoin -= 1;
  316.  
  317. p.readyshoot = 0;
  318.  
  319. p.shootanim = "ak-47_shoot";
  320.  
  321. //p.dy = -0.1;отдача
  322.  
  323. //p.dx = -50;
  324.  
  325.  
  326.  
  327. }
  328.  
  329. }
  330.  
  331. else if ((p.weapon == "revolver") && (p.ammo>0) && (p.reload>0.9)) {
  332.  
  333. if (p.ammoin > 0) {
  334.  
  335. bullets.push_back(new Bullet(revolver, p.rect.left, p.rect.top + 30, p.dir, p.weapon, "p1"));
  336.  
  337. revolversn.play();
  338.  
  339. p.reload = 0;
  340.  
  341. p.ammo -= 1;
  342.  
  343. p.ammoin -= 1;
  344.  
  345. p.readyshoot = 0;
  346.  
  347. p.shootanim = "revolver_shoot";
  348.  
  349. //p.dy = -0.1;отдача
  350.  
  351. //p.dx = -50;
  352.  
  353. }
  354.  
  355. }
  356.  
  357. else if ((p.weapon == "bazooka") && (p.ammo>0) && (p.reload>0.9)) {
  358.  
  359. if (p.ammoin > 0) {
  360.  
  361. bullets.push_back(new Bullet(bazooka, p.rect.left, p.rect.top + 20, p.dir, p.weapon, "p1"));
  362.  
  363. bazookasn.play();
  364.  
  365. p.reload = 0;
  366.  
  367. p.ammo -= 1;
  368.  
  369. p.ammoin -= 1;
  370.  
  371. p.readyshoot = 0;
  372.  
  373. p.shootanim = "bazooka_shoot";
  374.  
  375. //p.dy = -0.1;отдача
  376.  
  377. //p.dx = -50;
  378.  
  379. }
  380.  
  381. }
  382.  
  383.  
  384.  
  385. }
  386.  
  387.  
  388.  
  389. }
  390.  
  391. //Camera
  392.  
  393. float maxX, maxY, minX, minY;
  394.  
  395. if ((p.life > 0) && (p2.life > 0)) {
  396.  
  397. //Right top corner coords X:
  398.  
  399. if ((p.rect.left) >= (p2.rect.left)) maxX = p.rect.left;
  400.  
  401. if ((p2.rect.left) >= (p.rect.left)) maxX = p2.rect.left;
  402.  
  403. //Y:
  404.  
  405. if ((p.rect.top) >= (p2.rect.top)) maxY = p.rect.top;
  406.  
  407. if ((p2.rect.top) >= (p.rect.top)) maxY = p2.rect.top;
  408.  
  409. //Left bottom corner X:
  410.  
  411. if ((p.rect.left) <= (p2.rect.left)) minX = p.rect.left;
  412.  
  413. if ((p2.rect.left) <= (p.rect.left)) minX = p2.rect.left;
  414.  
  415. //Y:
  416.  
  417. if ((p.rect.top) <= (p2.rect.top)) minY = p.rect.top;
  418.  
  419. if ((p2.rect.top) <= (p.rect.top)) minY = p2.rect.top;
  420.  
  421. view.reset(FloatRect(0, 0, 1800, 800));
  422.  
  423. view.setCenter((maxX - (maxX - minX) / 2 + 11), (maxY - (maxY - minY) / 2 + 18));
  424.  
  425.  
  426.  
  427. //Обзор
  428.  
  429. //По иксу, левый, правый края
  430.  
  431. if (((maxX - minX) > 300) && ((maxY - minY) < 300)) {
  432.  
  433. if (camera != "x") {
  434.  
  435. camera = "x";
  436.  
  437. cameradone = false;
  438.  
  439. }
  440.  
  441. if (cameradone == false) {
  442.  
  443. if ((((maxX - minX) / 1200) > nt)) {
  444.  
  445. if ((maxX - minX) / 1200 - nt > 0.08) { nt += 0.001 / 2 * time; }
  446.  
  447. else {
  448.  
  449. nt += 0.001 / 6 * time;
  450.  
  451. }
  452.  
  453.  
  454.  
  455. }
  456.  
  457. else if (((maxX - minX) / 1200) < nt) {
  458.  
  459. if ((nt - maxX - minX) / 1200 > 0.08) { nt -= 0.001 / 2 * time; }
  460.  
  461. else {
  462.  
  463. nt -= 0.001 / 6 * time;
  464.  
  465. }
  466.  
  467. }
  468.  
  469. if (((maxX - minX) / 1200 - 0.002 < nt) && ((maxX - minX) / 1200 + 0.002 > nt)) {
  470.  
  471. cameradone = true;
  472.  
  473. }
  474.  
  475. }
  476.  
  477. else {
  478.  
  479. nt = (maxX - minX) / 1200;
  480.  
  481. }
  482.  
  483. view.zoom(nt);
  484.  
  485. }
  486.  
  487. //По игрику, верхяя, нижняя полоса
  488.  
  489. else if (((maxY - minY) > 160) && ((maxX - minX) < 300)) {
  490.  
  491. if (camera != "y") {
  492.  
  493. camera = "y";
  494.  
  495. cameradone = false;
  496.  
  497. }
  498.  
  499. if (cameradone == false) {
  500.  
  501. if (((maxY - minY) / 600) > nt) {
  502.  
  503. if ((maxY - minY) / 600 - nt > 0.05) {
  504.  
  505. nt += 0.001*time;
  506.  
  507. }
  508.  
  509. else
  510.  
  511. {
  512.  
  513. nt += 0.001 / 4 * time;
  514.  
  515. }
  516.  
  517. }
  518.  
  519. else if (((maxY - minY) / 600) < nt) {
  520.  
  521. if (nt - (maxY - minY) / 600 > 0.05) {
  522.  
  523. nt -= 0.001*time;
  524.  
  525. }
  526.  
  527. else
  528.  
  529. {
  530.  
  531. nt -= 0.001 / 4 * time;
  532.  
  533. }
  534.  
  535. }
  536.  
  537. if (((maxY - minY) / 600 - 0.002 < nt) && ((maxY - minY) / 600 + 0.002 > nt)) {
  538.  
  539. cameradone = true;
  540.  
  541. }
  542.  
  543. }
  544.  
  545. else
  546.  
  547. {
  548.  
  549. nt = (maxY - minY) / 600;
  550.  
  551. }
  552.  
  553. view.zoom(nt);
  554.  
  555. }
  556.  
  557. //Минимальная камера
  558.  
  559. else if (((maxY - minY) < 200) && ((maxX - minX) < 300)) {
  560.  
  561. if (camera != "none") {
  562.  
  563. camera = "none";
  564.  
  565. cameradone = false;
  566.  
  567. }
  568.  
  569. if (cameradone == false) {
  570.  
  571. if ((nt < 0.25 + 0.002) && (nt > 0.25 - 0.002)) {
  572.  
  573. cameradone = true;
  574.  
  575. }
  576.  
  577. if (nt > 0.25) {
  578.  
  579. nt -= 0.001 / 2 * time;
  580.  
  581. }
  582.  
  583. else if (nt < 0.25) {
  584.  
  585. nt += 0.001 / 2 * time;
  586.  
  587. }
  588.  
  589. }
  590.  
  591. else
  592.  
  593. {
  594.  
  595. nt = 0.25;
  596.  
  597. }
  598.  
  599. view.zoom(nt);
  600.  
  601. }
  602.  
  603. //Края карты
  604.  
  605. else {
  606.  
  607. if (camera == "x") {
  608.  
  609. if (((maxX - minX) < 850) || ((maxY - minY) > 600)) {
  610.  
  611. camera = "y";
  612.  
  613. cameradone = false;
  614.  
  615. }
  616.  
  617. if ((cameradone == false) && (camera == "x")) {
  618.  
  619. if (((maxX - minX) / 1200 + 0.002 > nt) && ((maxX - minX) / 1200 - 0.002 < nt)) {
  620.  
  621. cameradone = true;
  622.  
  623. }
  624.  
  625. if ((maxX - minX) / 1200 < nt) {
  626.  
  627. if (nt - (maxX - minX) / 1200>0.09) {
  628.  
  629. nt -= 0.001 / 3 * time;
  630.  
  631. }
  632.  
  633. else
  634.  
  635. {
  636.  
  637. nt -= 0.0002*time;
  638.  
  639. }
  640.  
  641. }
  642.  
  643. else if ((maxX - minX) / 1200 > nt) {
  644.  
  645. if ((maxX - minX) / 1200 - nt>0.09) {
  646.  
  647. nt += 0.001 / 3 * time;
  648.  
  649. }
  650.  
  651. else
  652.  
  653. {
  654.  
  655. nt += 0.0002*time;
  656.  
  657. }
  658.  
  659. }
  660.  
  661. }
  662.  
  663. else {
  664.  
  665. nt = (maxX - minX) / 1200;
  666.  
  667. }
  668.  
  669. view.zoom(nt);
  670.  
  671. }
  672.  
  673. else if (camera == "y") {
  674.  
  675. if (((maxY - minY)<200) || ((maxX - minX)>850) && ((maxY - minY)<600)) {
  676.  
  677. camera = "x";
  678.  
  679. cameradone = false;
  680.  
  681. }
  682.  
  683. if ((cameradone == false) && (camera == "y")) {
  684.  
  685. if (((maxY - minY) / 600 + 0.002 > nt) && ((maxY - minY) / 600 - 0.002 < nt)) {
  686.  
  687. cameradone = true;
  688.  
  689. if (camera == "y") {
  690.  
  691. }
  692.  
  693. }
  694.  
  695. if ((maxY - minY) / 600 < nt) {
  696.  
  697. if (nt - (maxY - minY) / 600>0.9) {
  698.  
  699. nt -= 0.001 / 4 * time;
  700.  
  701. }
  702.  
  703. else
  704.  
  705. {
  706.  
  707. nt -= 0.0006*time;
  708.  
  709. }
  710.  
  711. }
  712.  
  713. else if ((maxY - minY) / 600 > nt) {
  714.  
  715. if ((maxY - minY) / 600 - nt > 0.9) {
  716.  
  717. nt += 0.001 / 4 * time;
  718.  
  719. }
  720.  
  721. else {
  722.  
  723. nt += 0.0006*time;
  724.  
  725. }
  726.  
  727. }
  728.  
  729. }
  730.  
  731. else {
  732.  
  733. nt = (maxY - minY) / 600;
  734.  
  735. }
  736.  
  737. view.zoom(nt);
  738.  
  739. }
  740.  
  741. }
  742.  
  743. }
  744.  
  745. else {
  746.  
  747. if (p2.life > 0) {
  748.  
  749. view.reset(FloatRect(0, 0, 1800, 800));
  750.  
  751. view.setCenter(p2.rect.left, p2.rect.top);
  752.  
  753. view.zoom(0.25f);
  754.  
  755. }
  756.  
  757. if (p.life > 0) {
  758.  
  759. view.reset(FloatRect(0, 0, 1800, 800));
  760.  
  761. view.setCenter(p.rect.left, p.rect.top);
  762.  
  763. view.zoom(0.25f);
  764.  
  765. }
  766.  
  767. }
  768.  
  769. //Camera end
  770.  
  771. if (p2.life>0) {
  772.  
  773. if (Keyboard::isKeyPressed(Keyboard::B)) {
  774.  
  775. if ((p2.weapon == "ak-47") && (p2.ammo>0) && (p2.reload>0.6) && (p2.onStairs == false)) {
  776.  
  777. if (p2.ammoin > 0) {
  778.  
  779. bullets.push_back(new Bullet(bul, p2.rect.left, p2.rect.top + 25, p2.dir, p2.weapon, "p2"));
  780.  
  781. damage.play();
  782.  
  783. p2.reload = 0;
  784.  
  785. p2.ammo -= 1;
  786.  
  787. p2.ammoin -= 1;
  788.  
  789. p2.readyshoot = 0;
  790.  
  791. p2.shootanim = "ak-47_shoot";
  792.  
  793. //p2.dy = -0.1;отдача
  794.  
  795. //p2.dx = -50;
  796.  
  797. }
  798.  
  799.  
  800.  
  801. }
  802.  
  803. else if ((p2.weapon == "revolver") && (p2.ammo>0) && (p2.reload>0.9)) {
  804.  
  805. if (p2.ammoin > 0) {
  806.  
  807. bullets.push_back(new Bullet(revolver, p2.rect.left, p2.rect.top + 30, p2.dir, p2.weapon, "p2"));
  808.  
  809. revolversn.play();
  810.  
  811. p2.reload = 0;
  812.  
  813. p2.ammo -= 1;
  814.  
  815. p2.ammoin -= 1;
  816.  
  817. p2.readyshoot = 0;
  818.  
  819. p2.shootanim = "revolver_shoot";
  820.  
  821. //p2.dy = -0.1;отдача
  822.  
  823. //p2.dx = -50;
  824.  
  825. }
  826.  
  827. }
  828.  
  829. else if ((p2.weapon == "bazooka") && (p2.ammo>0) && (p2.reload>2)) {
  830.  
  831. if (p2.ammoin > 0) {
  832.  
  833. bullets.push_back(new Bullet(bazooka, p2.rect.left, p2.rect.top + 20, p2.dir, p2.weapon, "p2"));
  834.  
  835. bazookasn.play();
  836.  
  837. p2.reload = 0;
  838.  
  839. p2.ammo -= 1;
  840.  
  841. p2.ammoin -= 1;
  842.  
  843. p2.readyshoot = 0;
  844.  
  845. p2.shootanim = "bazooka_shoot";
  846.  
  847. //p2.dy = -0.1;отдача
  848.  
  849. //p2.dx = -50;
  850.  
  851. }
  852.  
  853. }
  854.  
  855. }
  856.  
  857. }
  858.  
  859. if (p3.life>0) {
  860.  
  861. if (Keyboard::isKeyPressed(Keyboard::B)) {
  862.  
  863. if ((p3.weapon == "ak-47") && (p3.ammo>0) && (p3.reload>0.6)) {
  864.  
  865. if (p3.ammoin > 0) {
  866.  
  867. bullets.push_back(new Bullet(bul, p3.rect.left, p3.rect.top + 25, p3.dir, p3.weapon, "p3"));
  868.  
  869. damage.play();
  870.  
  871. p3.reload = 0;
  872.  
  873. p3.ammo -= 1;
  874.  
  875. p3.ammoin -= 1;
  876.  
  877. p3.readyshoot = 0;
  878.  
  879. p3.shootanim = "ak-47_shoot";
  880.  
  881. //p3.dy = -0.1;отдача
  882.  
  883. //p3.dx = -50;
  884.  
  885. }
  886.  
  887.  
  888.  
  889. }
  890.  
  891. else if ((p3.weapon == "revolver") && (p3.ammo>0) && (p3.reload>0.9)) {
  892.  
  893. if (p3.ammoin > 0) {
  894.  
  895. bullets.push_back(new Bullet(revolver, p3.rect.left, p3.rect.top + 30, p3.dir, p3.weapon, "p3"));
  896.  
  897. revolversn.play();
  898.  
  899. p3.reload = 0;
  900.  
  901. p3.ammo -= 1;
  902.  
  903. p3.ammoin -= 1;
  904.  
  905. p3.readyshoot = 0;
  906.  
  907. p3.shootanim = "revolver_shoot";
  908.  
  909. //p3.dy = -0.1;отдача
  910.  
  911. //p3.dx = -50;
  912.  
  913. }
  914.  
  915. }
  916.  
  917. else if ((p3.weapon == "bazooka") && (p3.ammo>0) && (p3.reload>2)) {
  918.  
  919. if (p3.ammoin > 0) {
  920.  
  921. bullets.push_back(new Bullet(bazooka, p3.rect.left, p3.rect.top + 20, p3.dir, p3.weapon, "p3"));
  922.  
  923. bazookasn.play();
  924.  
  925. p3.reload = 0;
  926.  
  927. p3.ammo -= 1;
  928.  
  929. p3.ammoin -= 1;
  930.  
  931. p3.readyshoot = 0;
  932.  
  933. p3.shootanim = "bazooka_shoot";
  934.  
  935. //p3.dy = -0.1;отдача
  936.  
  937. //p3.dx = -50;
  938.  
  939. }
  940.  
  941. }
  942.  
  943. }
  944.  
  945. }
  946.  
  947. if ((tempi != 0) && (tempj != 0)) {
  948.  
  949. TileMap[tempi][tempj] = ' ';
  950.  
  951. TileMap[tempi][tempj - 1] = ' ';
  952.  
  953. TileMap[tempi - 1][tempj] = ' ';
  954.  
  955. TileMap[tempi][tempj + 1] = ' ';
  956.  
  957. TileMap[tempi + 1][tempj] = ' ';
  958.  
  959. TileMap[tempi + 1][tempj + 1] = ' ';
  960.  
  961. TileMap[tempi - 1][tempj - 1] = ' ';
  962.  
  963. TileMap[tempi - 1][tempj + 1] = ' ';
  964.  
  965. TileMap[tempi + 1][tempj - 1] = ' ';
  966.  
  967. }
  968.  
  969. if ((p2.life <= 0) && (p3.life <= 0)) {
  970.  
  971. if (soundover == false) { gamem.stop(); music.play(); soundover = true; std::cout << "Console: Player 1 wins! Congrats!\n"; }
  972.  
  973. if (endround<185) {
  974.  
  975. endround += 0.01*time;
  976.  
  977. }
  978.  
  979. else {
  980.  
  981. return true;
  982.  
  983. }
  984.  
  985.  
  986.  
  987. }
  988.  
  989. if ((p.life <= 0) && (p3.life <= 0)) {
  990.  
  991. if (soundover == false) { gamem.stop(); music.play(); soundover = true; std::cout << "Console: Player 2 wins! Congrats!\n"; }
  992.  
  993. if (endround<185) {
  994.  
  995. endround += 0.01*time;
  996.  
  997. }
  998.  
  999. else {
  1000.  
  1001. return true;
  1002.  
  1003. }
  1004.  
  1005. }
  1006.  
  1007. if ((p.life <= 0) && (p2.life <= 0)) {
  1008.  
  1009. if (soundover == false) { gamem.stop(); music.play(); soundover = true; std::cout << "Console: Player 3 wins! Congrats!\n"; }
  1010.  
  1011. if (endround>185) {
  1012.  
  1013. endround += 0.01*time;
  1014.  
  1015. }
  1016.  
  1017. else {
  1018.  
  1019. return true;
  1020.  
  1021. }
  1022.  
  1023. }
  1024.  
  1025. if ((p.life <= 0) && (soundover1 == false)) {
  1026.  
  1027. kill.play();
  1028.  
  1029. soundover1 = true;
  1030.  
  1031. }
  1032.  
  1033. if ((p2.life <= 0) && (soundover2 == false)) {
  1034.  
  1035. kill.play();
  1036.  
  1037. soundover2 = true;
  1038.  
  1039. }
  1040.  
  1041. if ((p3.life <= 0) && (soundover3 == false) && (*playercount>2)) {
  1042.  
  1043. kill.play();
  1044.  
  1045. soundover3 = true;
  1046.  
  1047. }
  1048.  
  1049. for (it = bullets.begin(); it != bullets.end(); it++) {
  1050.  
  1051. (*it)->update(time, &tempi, &tempj, &snd);
  1052.  
  1053. }
  1054.  
  1055. for (it = bullets.begin(); it != bullets.end(); it++) {
  1056.  
  1057. (*it)->Attack(time, p2.rect.left, p2.rect.top, &p2.life, "p2");
  1058.  
  1059. }
  1060.  
  1061. for (it = bullets.begin(); it != bullets.end(); it++) {
  1062.  
  1063. (*it)->Attack(time, p.rect.left, p.rect.top, &p.life, "p1");
  1064.  
  1065. }
  1066.  
  1067. for (it = bullets.begin(); it != bullets.end(); it++) {
  1068.  
  1069. (*it)->Attack(time, p3.rect.left, p3.rect.top, &p3.life, "p3");
  1070.  
  1071. }
  1072.  
  1073. if (p.life>0) {
  1074.  
  1075. if (Keyboard::isKeyPressed(Keyboard::Up))
  1076.  
  1077. {
  1078.  
  1079. if ((p.onGround) && (p.onStairs == false)) {
  1080.  
  1081. p.dy = -0.35; p.onGround = false;
  1082.  
  1083. }
  1084.  
  1085. if (p.onStairs == true) {
  1086.  
  1087. p.dy = -0.1;
  1088.  
  1089. }
  1090.  
  1091.  
  1092.  
  1093. }
  1094.  
  1095. if (Keyboard::isKeyPressed(Keyboard::Left))
  1096.  
  1097. {
  1098.  
  1099. if (p.onGround) {
  1100.  
  1101. p.dx = -0.1;
  1102.  
  1103. p.dir = -1;
  1104.  
  1105. }
  1106.  
  1107. else {
  1108.  
  1109. p.dx = -0.2;
  1110.  
  1111. p.dir = -1;
  1112.  
  1113. }
  1114.  
  1115.  
  1116.  
  1117. }
  1118.  
  1119. if (Keyboard::isKeyPressed(Keyboard::Right))
  1120.  
  1121. {
  1122.  
  1123. if (p.onGround) {
  1124.  
  1125. p.dx = 0.1;
  1126.  
  1127. p.dir = 1;
  1128.  
  1129. }
  1130.  
  1131. else {
  1132.  
  1133. p.dx = 0.2;
  1134.  
  1135. p.dir = 1;
  1136.  
  1137. }
  1138.  
  1139. }
  1140.  
  1141. }
  1142.  
  1143.  
  1144.  
  1145. //2nd player
  1146.  
  1147. if (p2.life>0) {
  1148.  
  1149. if (Keyboard::isKeyPressed(Keyboard::A))
  1150.  
  1151. {
  1152.  
  1153. if (p2.onGround) {
  1154.  
  1155. p2.dx = -0.1;
  1156.  
  1157. p2.dir = -1;
  1158.  
  1159. }
  1160.  
  1161. else {
  1162.  
  1163. p2.dx = -0.2;
  1164.  
  1165. p2.dir = -1;
  1166.  
  1167. }
  1168.  
  1169.  
  1170.  
  1171. }
  1172.  
  1173. if (Keyboard::isKeyPressed(Keyboard::D))
  1174.  
  1175. {
  1176.  
  1177. if (p2.onGround) {
  1178.  
  1179. p2.dx = 0.1;
  1180.  
  1181. p2.dir = 1;
  1182.  
  1183. }
  1184.  
  1185. else {
  1186.  
  1187. p2.dx = 0.2;
  1188.  
  1189. p2.dir = 1;
  1190.  
  1191. }
  1192.  
  1193. }
  1194.  
  1195.  
  1196.  
  1197. if (Keyboard::isKeyPressed(Keyboard::W))
  1198.  
  1199. {
  1200.  
  1201. if ((p2.onGround) && (p2.onStairs == false) && (p2.equip != "jetpack")) {
  1202.  
  1203. p2.dy = -0.35; p2.onGround = false;
  1204.  
  1205. }
  1206.  
  1207. if (p2.onStairs == true) {
  1208.  
  1209. p2.dy = -0.1;
  1210.  
  1211. }
  1212.  
  1213. if (p2.equip == "jetpack") {
  1214.  
  1215. p2.dy = -0.1;
  1216.  
  1217. }
  1218.  
  1219.  
  1220.  
  1221. }
  1222.  
  1223. }
  1224.  
  1225. //Звуки
  1226.  
  1227. if (snd != 0) {
  1228.  
  1229. if (snd == 1) {
  1230.  
  1231. exploz.play();
  1232.  
  1233. snd = 0;
  1234.  
  1235. }
  1236.  
  1237. }
  1238.  
  1239. //Перезарядка
  1240.  
  1241. if ((p.readyshoot > 4) && (p.ammo>0))
  1242.  
  1243. {
  1244.  
  1245. if (p.weapon == "ak-47") {
  1246.  
  1247. p.ammoin = 3;
  1248.  
  1249. }
  1250.  
  1251. else if (p.weapon == "revolver") {
  1252.  
  1253. p.ammoin = 2;
  1254.  
  1255. }
  1256.  
  1257. else if (p.weapon == "bazooka") {
  1258.  
  1259. p.ammoin = 1;
  1260.  
  1261. }
  1262.  
  1263. }
  1264.  
  1265. if ((p2.readyshoot > 4) && (p2.ammo>0))
  1266.  
  1267. {
  1268.  
  1269. if (p2.weapon == "ak-47") {
  1270.  
  1271. p2.ammoin = 3;
  1272.  
  1273. }
  1274.  
  1275. else if (p2.weapon == "revolver") {
  1276.  
  1277. p2.ammoin = 2;
  1278.  
  1279. }
  1280.  
  1281. else if (p2.weapon == "bazooka") {
  1282.  
  1283. p2.ammoin = 1;
  1284.  
  1285. }
  1286.  
  1287. }
  1288.  
  1289. //Удаление пули
  1290.  
  1291. for (it = bullets.begin(); it != bullets.end();)
  1292.  
  1293. {
  1294.  
  1295. Bullet *b = *it;
  1296.  
  1297. if (b->life == false)
  1298.  
  1299. {
  1300.  
  1301. it = bullets.erase(it);
  1302.  
  1303. delete b;
  1304.  
  1305. }
  1306.  
  1307. else it++;
  1308.  
  1309. }
  1310.  
  1311. if (Keyboard::isKeyPressed(Keyboard::Escape)) { *firststart = true; return true; }
  1312.  
  1313. p.update(time);
  1314.  
  1315. p2.update(time);
  1316.  
  1317. p3.update(time);
  1318.  
  1319. window.clear(Color(107, 140, 255));
  1320.  
  1321.  
  1322.  
  1323. background.setPosition(scrwidth / 2, scrheight / 2);
  1324.  
  1325.  
  1326.  
  1327. window.draw(background);
  1328.  
  1329. for (int i = 0; i < H; i++)
  1330.  
  1331. for (int j = 0; j < W - 1; j++)
  1332.  
  1333. {
  1334.  
  1335. if (TileMap[i][j] == 'P') tile.setTextureRect(IntRect(0, 884, 16, 16));
  1336.  
  1337.  
  1338.  
  1339. if (TileMap[i][j] == 'T') tile.setTextureRect(IntRect(16, 884, 16, 16));
  1340.  
  1341.  
  1342.  
  1343. if (TileMap[i][j] == 'O') tile.setTextureRect(IntRect(32, 884, 16, 16));
  1344.  
  1345.  
  1346.  
  1347. if (TileMap[i][j] == 'V') tile.setTextureRect(IntRect(48, 884, 16, 16));
  1348.  
  1349.  
  1350.  
  1351. if (TileMap[i][j] == 'U') tile.setTextureRect(IntRect(64, 884, 16, 16));
  1352.  
  1353.  
  1354.  
  1355. if (TileMap[i][j] == 'Z') tile.setTextureRect(IntRect(0, 836, 90, 48));
  1356.  
  1357.  
  1358.  
  1359. if (TileMap[i][j] == 'S') tile.setTextureRect(IntRect(96, 884, 16, 16));
  1360.  
  1361.  
  1362.  
  1363. if (TileMap[i][j] == 'B') tile.setTextureRect(IntRect(80, 884, 16, 16));
  1364.  
  1365.  
  1366.  
  1367. if (TileMap[i][j] == 'X') tile.setTextureRect(IntRect(112, 884, 16, 16));
  1368.  
  1369.  
  1370.  
  1371. if (TileMap[i][j] == 'N') tile.setTextureRect(IntRect(128, 851, 16, 48));
  1372.  
  1373.  
  1374.  
  1375. if (TileMap[i][j] == 'H') tile.setTextureRect(IntRect(143, 851, 9, 48));
  1376.  
  1377.  
  1378.  
  1379. if (TileMap[i][j] == 'D') tile.setTextureRect(IntRect(0, 0, 1344, 228));
  1380.  
  1381.  
  1382.  
  1383. if (TileMap[i][j] == 'J') tile.setTextureRect(IntRect(152, 865, 24, 35));
  1384.  
  1385.  
  1386.  
  1387. if ((TileMap[i][j] == ' ') || (TileMap[i][j] == '0') || (TileMap[i][j] == '\0') || (TileMap[i][j] == 'E')) continue;
  1388.  
  1389.  
  1390.  
  1391. tile.setPosition(j * 16, i * 16);
  1392.  
  1393. window.draw(tile);
  1394.  
  1395. }
  1396.  
  1397. for (it = bullets.begin(); it != bullets.end(); it++)
  1398.  
  1399. (*it)->draw(window, bul);
  1400.  
  1401.  
  1402.  
  1403. window.setView(view);
  1404.  
  1405.  
  1406.  
  1407. window.draw(p.sprite);
  1408.  
  1409. window.draw(p2.sprite);
  1410.  
  1411. window.draw(p3.sprite);
  1412.  
  1413. window.display();
  1414.  
  1415. }
  1416.  
  1417. }
  1418.  
  1419. void gameRun(RenderWindow &window, int *playerscount, int lvlnum, bool *firststart) {
  1420.  
  1421. if (*firststart == true) {
  1422.  
  1423. *firststart = false;
  1424.  
  1425. if (((pause(window, playerscount)) == true)) {
  1426.  
  1427. if (lvlnum == 1) {
  1428.  
  1429. String TileMapNum1[H] = {
  1430.  
  1431. "00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
  1432.  
  1433. "00 00",
  1434.  
  1435. "00 00",
  1436.  
  1437. "00 00",
  1438.  
  1439. "00 00",
  1440.  
  1441. "00 00",
  1442.  
  1443. "00 00",
  1444.  
  1445. "00 00",
  1446.  
  1447. "00 00",
  1448.  
  1449. "00 00",
  1450.  
  1451. "00 00",
  1452.  
  1453. "00 00",
  1454.  
  1455. "00 J P 00",
  1456.  
  1457. "00 SSS B PXXX 00",
  1458.  
  1459. "00 SSS XXX B 00",
  1460.  
  1461. "00PSSSPPPPPPPPPPPPPPPPPPPP B 00",
  1462.  
  1463. "00 SSS P B 00",
  1464.  
  1465. "00 SSS P 00",
  1466.  
  1467. "00 SSS PPPPPPPPPPPPPPPPPPPPP 00",
  1468.  
  1469. "00 SSS P P 00",
  1470.  
  1471. "00 SSS P P 00",
  1472.  
  1473. "00 SSS P Z0000 00",
  1474.  
  1475. "00 SSS P 0 0TTTTTTTTTO 00",
  1476.  
  1477. "00 SSS H 00000 V 00",
  1478.  
  1479. "00 SSS 0 P V 00",
  1480.  
  1481. "00 SSS 0 P V 00",
  1482.  
  1483. "00 SSS PPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPP V 00",
  1484.  
  1485. "00 SSS P V 00",
  1486.  
  1487. "00 SSS P UTTTO PPPPP 00",
  1488.  
  1489. "00 SSS P V XX PPPPP 00",
  1490.  
  1491. "00 SSS P V B XX PPPPP 00",
  1492.  
  1493. "00 SSS P V XX 00",
  1494.  
  1495. "00 SSS P PPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPP0",
  1496.  
  1497. "00 SSS P P0",
  1498.  
  1499. "00 SSS P P0",
  1500.  
  1501. "00 SSS P XX P0",
  1502.  
  1503. "00 SSS P B XXX B P0",
  1504.  
  1505. "00 SSS P XXX P0",
  1506.  
  1507. "00 SSS P DPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPP P0",
  1508.  
  1509. "00 SSS P P PP0",
  1510.  
  1511. "00 SSS P P P P0",
  1512.  
  1513. "00 SSS P P P P0",
  1514.  
  1515. "00 SSS H H P P0",
  1516.  
  1517. "00 SSS 0 B 0 B P P0",
  1518.  
  1519. "00 SSS 0 0 P P0",
  1520.  
  1521. "00PPPPPP PPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPP PPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPP00",
  1522.  
  1523. "00 00",
  1524.  
  1525. "00 00",
  1526.  
  1527. "00 00",
  1528.  
  1529. "00 00",
  1530.  
  1531. "00 00",
  1532.  
  1533. "00 00",
  1534.  
  1535. "00 00",
  1536.  
  1537. "EEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEE",
  1538.  
  1539. "00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
  1540.  
  1541. };
  1542.  
  1543. for (int n = 0; n <= H - 1; n++) {
  1544.  
  1545. String *temp = &TileMapNum1[n];
  1546.  
  1547. String *ptr = &TileMap[n];
  1548.  
  1549. *ptr = *temp;
  1550.  
  1551. }
  1552.  
  1553. }
  1554.  
  1555. if (lvlnum >= 2) {
  1556.  
  1557. String TileMapNum1[H] = {
  1558.  
  1559. "00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
  1560.  
  1561. "00 00",
  1562.  
  1563. "00 00",
  1564.  
  1565. "00 00",
  1566.  
  1567. "00 00",
  1568.  
  1569. "00 00",
  1570.  
  1571. "00 00",
  1572.  
  1573. "00 00",
  1574.  
  1575. "00 00",
  1576.  
  1577. "00 00",
  1578.  
  1579. "00 00",
  1580.  
  1581. "00 00",
  1582.  
  1583. "00 00",
  1584.  
  1585. "00 SSS B 00",
  1586.  
  1587. "00 SSS B 00",
  1588.  
  1589. "00PSSSPPPPPPPPPPPPPPPPPPPP B 00",
  1590.  
  1591. "00 SSS P B 00",
  1592.  
  1593. "00 SSS P 00",
  1594.  
  1595. "00 SSS PPPPPPPPPPPPPPPPPPPPP 00",
  1596.  
  1597. "00 SSS P P 00",
  1598.  
  1599. "00 SSS P P 00",
  1600.  
  1601. "00 SSS P Z0000 00",
  1602.  
  1603. "00 SSS P 0 0TTTTTTTTTO 00",
  1604.  
  1605. "00 SSS H 00000 V 00",
  1606.  
  1607. "00 SSS 0 P V 00",
  1608.  
  1609. "00 SSS 0 P V 00",
  1610.  
  1611. "00 SSS PPPPPPPPPPPPPPPPPPPPP V 00",
  1612.  
  1613. "00 SSS P V 00",
  1614.  
  1615. "00 SSS P UTTTO PPPPP 00",
  1616.  
  1617. "00 SSS P V PPPPP 00",
  1618.  
  1619. "00 SSS P V B PPPPP 00",
  1620.  
  1621. "00 SSS P V 00",
  1622.  
  1623. "00 SSS P PPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPP00",
  1624.  
  1625. "00 SSS P 00",
  1626.  
  1627. "00 SSS P 00",
  1628.  
  1629. "00 SSS P 00",
  1630.  
  1631. "00 SSS P B B 00",
  1632.  
  1633. "00 SSS P 00",
  1634.  
  1635. "00 SSS P DPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPP 00",
  1636.  
  1637. "00 SSS P P P00",
  1638.  
  1639. "00 SSS P P P 00",
  1640.  
  1641. "00 SSS P P P 00",
  1642.  
  1643. "00 SSS H P 00",
  1644.  
  1645. "00 SSS 0 B B P 00",
  1646.  
  1647. "00 SSS 0 P 00",
  1648.  
  1649. "00PPPPPP PPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPP PPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPP00",
  1650.  
  1651. "00 00",
  1652.  
  1653. "00 00",
  1654.  
  1655. "00 00",
  1656.  
  1657. "00 00",
  1658.  
  1659. "00 00",
  1660.  
  1661. "00 00",
  1662.  
  1663. "00 00",
  1664.  
  1665. "EEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEE",
  1666.  
  1667. "00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
  1668.  
  1669. };
  1670.  
  1671. for (int n = 0; n <= H - 1; n++) {
  1672.  
  1673. String *temp = &TileMapNum1[n];
  1674.  
  1675. String *ptr = &TileMap[n];
  1676.  
  1677. *ptr = *temp;
  1678.  
  1679. }
  1680.  
  1681. }
  1682.  
  1683. lvlnum++;
  1684.  
  1685. StartGame(window, playerscount, firststart); gameRun(window, playerscount, lvlnum, firststart);
  1686.  
  1687. }
  1688.  
  1689. else { window.close(); }
  1690.  
  1691. }
  1692.  
  1693. else {
  1694.  
  1695. if (lvlnum == 1) {
  1696.  
  1697. String TileMapNum1[H] = {
  1698.  
  1699. "00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
  1700.  
  1701. "00 00",
  1702.  
  1703. "00 00",
  1704.  
  1705. "00 00",
  1706.  
  1707. "00 00",
  1708.  
  1709. "00 00",
  1710.  
  1711. "00 00",
  1712.  
  1713. "00 00",
  1714.  
  1715. "00 00",
  1716.  
  1717. "00 00",
  1718.  
  1719. "00 00",
  1720.  
  1721. "00 00",
  1722.  
  1723. "00 00",
  1724.  
  1725. "00 SSS B 00",
  1726.  
  1727. "00 SSS B 00",
  1728.  
  1729. "00PSSSPPPPPPPPPPPPPPPPPPPP B 00",
  1730.  
  1731. "00 SSS P B 00",
  1732.  
  1733. "00 SSS P 00",
  1734.  
  1735. "00 SSS PPPPPPPPPPPPPPPPPPPPP 00",
  1736.  
  1737. "00 SSS P P 00",
  1738.  
  1739. "00 SSS P P 00",
  1740.  
  1741. "00 SSS P Z0000 00",
  1742.  
  1743. "00 SSS P 0 0TTTTTTTTTO 00",
  1744.  
  1745. "00 SSS H 00000 V 00",
  1746.  
  1747. "00 SSS 0 P V 00",
  1748.  
  1749. "00 SSS 0 P V 00",
  1750.  
  1751. "00 SSS PPPPPPPPPPPPPPPPPPPPP V 00",
  1752.  
  1753. "00 SSS P V 00",
  1754.  
  1755. "00 SSS P UTTTO PPPPP 00",
  1756.  
  1757. "00 SSS P V PPPPP 00",
  1758.  
  1759. "00 SSS P V B PPPPP 00",
  1760.  
  1761. "00 SSS P V 00",
  1762.  
  1763. "00 SSS P PPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPP00",
  1764.  
  1765. "00 SSS P 00",
  1766.  
  1767. "00 SSS P 00",
  1768.  
  1769. "00 SSS P 00",
  1770.  
  1771. "00 SSS P B B 00",
  1772.  
  1773. "00 SSS P 00",
  1774.  
  1775. "00 SSS P DPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPP 00",
  1776.  
  1777. "00 SSS P P P00",
  1778.  
  1779. "00 SSS P P P 00",
  1780.  
  1781. "00 SSS P P P 00",
  1782.  
  1783. "00 SSS H P 00",
  1784.  
  1785. "00 SSS 0 B B P 00",
  1786.  
  1787. "00 SSS 0 P 00",
  1788.  
  1789. "00PPPPPP PPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPP PPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPP00",
  1790.  
  1791. "00 00",
  1792.  
  1793. "00 00",
  1794.  
  1795. "00 00",
  1796.  
  1797. "00 00",
  1798.  
  1799. "00 00",
  1800.  
  1801. "00 00",
  1802.  
  1803. "00 00",
  1804.  
  1805. "EEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEE",
  1806.  
  1807. "00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
  1808.  
  1809. };
  1810.  
  1811. for (int n = 0; n <= H - 1; n++) {
  1812.  
  1813. String *temp = &TileMapNum1[n];
  1814.  
  1815. String *ptr = &TileMap[n];
  1816.  
  1817. *ptr = *temp;
  1818.  
  1819. }
  1820.  
  1821. }
  1822.  
  1823. if (lvlnum >= 2) {
  1824.  
  1825. String TileMapNum1[H] = {
  1826.  
  1827. "00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
  1828.  
  1829. "00 00",
  1830.  
  1831. "00 00",
  1832.  
  1833. "00 00",
  1834.  
  1835. "00 00",
  1836.  
  1837. "00 00",
  1838.  
  1839. "00 00",
  1840.  
  1841. "00 00",
  1842.  
  1843. "00 00",
  1844.  
  1845. "00 00",
  1846.  
  1847. "00 00",
  1848.  
  1849. "00 00",
  1850.  
  1851. "00 00",
  1852.  
  1853. "00 SSS B 00",
  1854.  
  1855. "00 SSS B 00",
  1856.  
  1857. "00PSSSPPPPPPPPPPPPPPPPPPPP B 00",
  1858.  
  1859. "00 SSS P B 00",
  1860.  
  1861. "00 SSS P 00",
  1862.  
  1863. "00 SSS PPPPPPPPPPPPPPPPPPPPP 00",
  1864.  
  1865. "00 SSS P P 00",
  1866.  
  1867. "00 SSS P P 00",
  1868.  
  1869. "00 SSS P Z0000 00",
  1870.  
  1871. "00 SSS P 0 0TTTTTTTTTO 00",
  1872.  
  1873. "00 SSS H 00000 V 00",
  1874.  
  1875. "00 SSS 0 P V 00",
  1876.  
  1877. "00 SSS 0 P V 00",
  1878.  
  1879. "00 SSS PPPPPPPPPPPPPPPPPPPPP V 00",
  1880.  
  1881. "00 SSS P V 00",
  1882.  
  1883. "00 SSS P UTTTO PPPPP 00",
  1884.  
  1885. "00 SSS P V PPPPP 00",
  1886.  
  1887. "00 SSS P V B PPPPP 00",
  1888.  
  1889. "00 SSS P V 00",
  1890.  
  1891. "00 SSS P PPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPP0",
  1892.  
  1893. "00 SSS P P0",
  1894.  
  1895. "00 SSS P P0",
  1896.  
  1897. "00 SSS P P0",
  1898.  
  1899. "00 SSS P B B P0",
  1900.  
  1901. "00 SSS P P0",
  1902.  
  1903. "00 SSS P DPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPP P0",
  1904.  
  1905. "00 SSS P P PP0",
  1906.  
  1907. "00 SSS P P P P0",
  1908.  
  1909. "00 SSS P P P P0",
  1910.  
  1911. "00 SSS H H P P0",
  1912.  
  1913. "00 SSS 0 B 0 B P P0",
  1914.  
  1915. "00 SSS 0 0 P P0",
  1916.  
  1917. "00PPPPPP PPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPP PPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPP00",
  1918.  
  1919. "00 00",
  1920.  
  1921. "00 00",
  1922.  
  1923. "00 00",
  1924.  
  1925. "00 00",
  1926.  
  1927. "00 00",
  1928.  
  1929. "00 00",
  1930.  
  1931. "00 00",
  1932.  
  1933. "EEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEE",
  1934.  
  1935. "00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
  1936.  
  1937. };
  1938.  
  1939. for (int n = 0; n <= H - 1; n++) {
  1940.  
  1941. String *temp = &TileMapNum1[n];
  1942.  
  1943. String *ptr = &TileMap[n];
  1944.  
  1945. *ptr = *temp;
  1946.  
  1947. }
  1948.  
  1949. }
  1950.  
  1951. lvlnum++;
  1952.  
  1953. StartGame(window, playerscount, firststart); gameRun(window, playerscount, lvlnum, firststart);
  1954.  
  1955. }
  1956.  
  1957. }
  1958.  
  1959. int main() {
  1960.  
  1961. //RenderWindow window(VideoMode(1800, 900, 32), "SFML Graphics");
  1962.  
  1963. sf::VideoMode desktop = sf::VideoMode().getDesktopMode();
  1964.  
  1965. sf::RenderWindow window(desktop, "Kill_real_15!", sf::Style::None);
  1966.  
  1967. bool firststart = true;
  1968.  
  1969. int playerscount = 2;
  1970.  
  1971. int lvlnum = 1;
  1972.  
  1973. gameRun(window, &playerscount, lvlnum, &firststart);
  1974.  
  1975. return 0;
  1976.  
  1977. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement