1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417 1418 1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 1432 1433 1434 1435 1436 1437 1438 1439 1440 1441 1442 1443 1444 1445 1446 1447 1448 1449 1450 1451 1452 1453 1454 1455 1456 1457 1458 1459 1460 1461 1462 1463 1464 1465 1466 1467 1468 1469 1470 1471 1472 1473 1474 1475 1476 1477 1478 1479 1480 1481 1482 1483 1484 1485 1486 1487 1488 1489 1490 1491 1492 1493 1494 1495 1496 1497 1498 1499 1500 1501 1502 1503 1504 1505 1506 1507 1508 1509 1510 1511 1512 1513 1514 1515 1516 1517 1518 1519 1520 1521 1522 1523 1524 1525 1526 1527 1528 1529 1530 1531 1532 1533 1534 1535 1536 1537 1538 1539 1540 1541 1542 1543 1544 1545 1546 1547 1548 1549 1550 1551 1552 1553 1554 1555 1556 1557 1558 1559 1560 1561 1562 1563 1564 1565 1566 1567 1568 1569 1570 1571 1572 1573 1574 1575 1576 1577 1578 1579 1580 1581 1582 1583 1584 1585 1586 1587 1588 1589 1590 1591 1592 1593 1594 1595 1596 1597 1598 1599 1600 1601 1602 1603 1604 1605 1606 1607 1608 1609 1610 1611 1612 1613 1614 1615 1616 1617 1618 1619 1620 1621 1622 1623 1624 1625 1626 1627 1628 1629 1630 1631 1632 1633 1634 1635 1636 1637 1638 1639 1640 1641 1642 1643 1644 1645 1646 1647 1648 1649 1650 1651 1652 1653 1654 1655 1656 1657 1658 1659 1660 1661 1662 1663 1664 1665 1666 1667 1668 1669 1670 1671 1672 1673 1674 1675 1676 1677 1678 1679 1680 1681 1682 1683 1684 1685 1686 1687 1688 1689 1690 1691 1692 1693 1694 1695 1696 1697 1698 1699 1700 1701 1702 1703 1704 1705 1706 1707 1708 1709 1710 1711 1712 1713 1714 1715 1716 1717 1718 1719 1720 1721 1722 1723 1724 1725 1726 1727 1728 1729 1730 1731 1732 1733 1734 1735 1736 1737 1738 1739 1740 1741 1742 1743 1744 1745 1746 1747 1748 1749 1750 1751 1752 1753 1754 1755 1756 1757 1758 1759 1760 1761 1762 1763 1764 1765 1766 1767 1768 1769 1770 1771 1772 1773 1774 1775 1776 1777 1778 1779 1780 1781 1782 1783 1784 1785 1786 1787 1788 1789 1790 1791 1792 1793 1794 1795 1796 1797 1798 1799 1800 1801 1802 1803 1804 1805 1806 1807 1808 1809 1810 1811 1812 1813 1814 1815 1816 1817 1818 1819 1820 1821 1822 1823 1824 1825 1826 1827 1828 1829 1830 1831 1832 1833 1834 1835 1836 1837 1838 1839 1840 1841 1842 1843 1844 1845 1846 1847 1848 1849 1850 1851 1852 1853 1854 1855 1856 1857 1858 1859 1860 1861 1862 1863 1864 1865 1866 1867 1868 1869 1870 1871 1872 1873 1874 1875 1876 1877 1878 1879 1880 1881 1882 1883 1884 1885 1886 1887 1888 1889 1890 1891 1892 1893 1894 1895 1896 1897 1898 1899 1900 1901 1902 1903 1904 1905 1906 1907 1908 1909 1910 1911 1912 1913 1914 1915 1916 1917 1918 1919 1920 1921 1922 1923 1924 1925 1926 1927 1928 1929 1930 1931 1932 1933 1934 1935 1936 1937 1938 1939 1940 1941 1942 1943 1944 1945 1946 1947 1948 1949 1950 1951 1952 1953 1954 1955 1956 1957 1958 1959 1960 1961 1962 1963 1964 1965 1966 1967 1968 1969 1970 1971 1972 1973 1974 1975 1976 1977 1978 1979 1980 1981 1982 1983 1984 1985 1986 1987 1988 1989 1990 1991 1992 1993 1994 1995 1996 1997 1998 1999 2000 2001 2002 2003 2004 2005 2006 2007 2008 2009 2010 2011 2012 2013 2014 2015 2016 2017 2018 2019 2020 2021 2022 2023 2024 2025 2026 2027 2028 2029 2030 2031 2032 2033 2034 2035 2036 2037 2038 2039 2040 2041 2042 2043 2044 2045 2046 2047 2048
| #include<iostream> #include<windows.h> #include<conio.h> #include<time.h> #include<string> #include<ctime> #include<cstdlib> #include<ctime> using namespace std; int a,b=3,c=500,d=1200,e=10,f=20,g,o,h,u,t1=3,t2,t3,dd,guan,hz=0; typedef struct Frame { COORD position[2]; int flag; }Frame; void SetPos(COORD a) { HANDLE out=GetStdHandle(STD_OUTPUT_HANDLE); SetConsoleCursorPosition(out, a); } void SetPos(int i, int j) { COORD pos={i, j}; SetPos(pos); } void HideCursor() { CONSOLE_CURSOR_INFO cursor_info = {1, 0}; SetConsoleCursorInfo(GetStdHandle(STD_OUTPUT_HANDLE), &cursor_info); }
void drawRow(int y, int x1, int x2, char ch) { SetPos(x1,y); for(int i = 0; i <= (x2-x1); i++) cout<<ch; }
void drawRow(COORD a, COORD b, char ch) { if(a.Y == b.Y) drawRow(a.Y, a.X, b.X, ch); else { SetPos(0, 25); cout<<"error code 01:无法填充行,因为两个坐标的纵坐标(x)不相等"; system("pause"); } }
void drawCol(int x, int y1, int y2, char ch) { int y=y1; while(y!=y2+1) { SetPos(x, y); cout<<ch; y++; } }
void drawCol(COORD a, COORD b, char ch) { if(a.X == b.X) drawCol(a.X, a.Y, b.Y, ch); else { SetPos(0, 25); cout<<"error code 02:无法填充列,因为两个坐标的横坐标(y)不相等"; system("pause"); } }
void drawFrame(COORD a, COORD b, char row, char col) { drawRow(a.Y, a.X+1, b.X-1, row); drawRow(b.Y, a.X+1, b.X-1, row); drawCol(a.X, a.Y+1, b.Y-1, col); drawCol(b.X, a.Y+1, b.Y-1, col); } void drawFrame(int x1, int y1, int x2, int y2, char row, char col) { COORD a={x1, y1}; COORD b={x2, y2}; drawFrame(a, b, row, col); } void drawFrame(Frame frame, char row, char col) { COORD a = frame.position[0]; COORD b = frame.position[1]; drawFrame(a, b, row, col); } void drawPlaying() { drawFrame(0, 0, 48, 24, '=', '|'); drawFrame(49, 0, 79, 4, '-', '|'); drawFrame(49, 4, 79, 9, '-', '|'); drawFrame(49, 9, 79, 22, '-', '|'); drawFrame(49, 22, 79, 24, '-', '|'); SetPos(52, 6); cout<<"得分:"; SetPos(52, 7); cout<<"称号:"; SetPos(52,8); cout<<"生命值: "<<g; SetPos(52,10); cout<<"操作方式:"; SetPos(52,11); cout<<" a,s,d,w 控制战机移动"; SetPos(52,12); cout<<" p 暂停游戏"; SetPos(52,13); cout<<" e 退出游戏"; SetPos(52,14); cout<<" i 60mm口径机炮吊舱("<<c<<")"; SetPos(52,15); cout<<" j 地对空导弹支援("<<e<<")"; SetPos(52,16); cout<<" k 三挺25mm口径机炮("<<d<<")"; SetPos(52,21); cout<<" m 隐身模式"; SetPos(52,18); cout<<" h 高级激光束("<<h<<")"; SetPos(52,20); cout<<" n 增压飞行(需长按n)"; SetPos(52,19); cout<<" l 发射核弹,净空全屏("<<b<<")"; SetPos(52,17); cout<<" u 发射导弹("<<f<<")"; }
int random(int a, int b) { int c=(rand() % (a-b))+ a; return c; }
COORD random(COORD a, COORD b) { int x=random(a.X, b.X); int y=random(a.Y, b.Y); COORD c={x, y}; return c; } bool judgeCoordInFrame(Frame frame, COORD spot) { if(spot.X>=frame.position[0].X) if(spot.X<=frame.position[1].X) if(spot.Y>=frame.position[0].Y) if(spot.Y<=frame.position[0].Y) return true; return false; } void printCoord(COORD a) { cout <<"( "<<a.X<<" , "<<a.Y<<" )"; } void printFrameCoord(Frame a) { printCoord(a.position[0]); cout <<" - "; printCoord(a.position[1]); } int drawMenu() { SetPos(30, 1); cout<<"P l a n e W a r"; drawRow(3, 0, 79, '-'); drawRow(5, 0, 79, '-'); SetPos(28, 4); cout<<"w 和 s 选择, k 确定"; SetPos(15, 11); cout<<"1. 傻逼的敌人"; SetPos(15, 13); cout<<"2. 牛逼的敌人"; drawRow(20, 0, 79, '-'); drawRow(22, 0, 79, '-'); SetPos(47, 11); cout<<"傻逼的敌人:"; SetPos(51, 13); cout<<"傻逼敌人有着较慢的移动速度。"; SetPos(24, 21); cout<<"制作:LJF神犇 魔改:Proton"; int j=11; SetPos(12, j); cout<<">>"; drawFrame(45, 9, 79, 17, '=', '|'); while(1) { if( _kbhit() ) { char x=_getch(); switch (x) { case 'w' : { if( j == 13) { SetPos(12, j); cout<<" "; j = 11; SetPos(12, j); cout<<">>"; SetPos(51, 13); cout<<" "; SetPos(47, 11); cout<<"傻逼的敌人:"; SetPos(47, 13); cout<<"傻逼的敌人有着较慢的移动速度"; } break; } case 's' : { if( j == 11 ) { SetPos(12, j); cout<<" "; j = 13; SetPos(12, j); cout<<">>"; SetPos(51, 13); cout<<" "; SetPos(47, 11); cout<<"牛逼的敌人:"; SetPos(47, 13); cout<<"牛逼的敌人移动速度较快"; } break; } case 'k' : { if (j == 8) return 1; else return 2; } } } } } int drawMenu3() { SetPos(30, 1); cout<<"P l a n e W a r"; drawRow(3, 0, 79, '-'); drawRow(5, 0, 79, '-'); SetPos(28, 4); cout<<"w 和 s 选择, k 确定"; SetPos(15, 11); cout<<"1. 经典模式 "; SetPos(15, 13); cout<<"2. 剧情模式 "; drawRow(20, 0, 79, '-'); drawRow(22, 0, 79, '-'); SetPos(47, 11); cout<<"经典模式: "; SetPos(47, 13); cout<<"经典模式是飞机大战的最初游戏模式 "; SetPos(24, 21); cout<<"制作:LJF神犇 魔改:Proton"; int j=11; SetPos(12, j); cout<<">>"; drawFrame(45, 9, 79, 17, '=', '|'); while(1) { if( _kbhit() ) { char x=_getch(); switch (x) { case 'w' : { if( j == 13) { SetPos(12, j); cout<<" "; j = 11; SetPos(12, j); cout<<">>"; SetPos(51, 13); cout<<" "; SetPos(47, 11); cout<<"经典模式: "; SetPos(47, 13); cout<<"经典模式是飞机大战的最初游戏模式 "; } break; } case 's' : { if( j == 11 ) { SetPos(12, j); cout<<" "; j = 13; SetPos(12, j); cout<<">>"; SetPos(51, 13); cout<<" "; SetPos(47, 11); cout<<"剧情模式: "; SetPos(47, 13); cout<<"剧情模式拥有十分呲毛的剧情 "; } break; } case 'k' : { if (j == 11) return 1; else return 2; } } } } } void panduan1() { if(o==1) { b=5; c=350; d=1080; e=30; f=10; g=30; h=20; } else if(o==2) { b=3; c=250; d=750; e=15; f=8; g=25; h=15; } else if(o==3) { b=8; c=400; d=1200; e=5; f=12; g=35; h=25; } else if(o==4) { b=1; c=200; d=600; e=10; f=6; g=20; h=10; } else if(o==5) { b=3; c=300; d=900; e=10; f=8; g=25; h=15; } } int drawMenu2() { SetPos(30, 1); cout<<" 请选择机型 "; drawRow(3, 0, 79, '-'); drawRow(5, 0, 79, '-'); SetPos(28, 4); cout<<"w 和 s 选择, k 确定"; SetPos(15, 11); cout<<"1. 歼-20 "; SetPos(15, 12); cout<<"2. 苏-30 "; SetPos(15, 13); cout<<"3. F-35飞电 "; SetPos(15, 14); cout<<"4. 歼-15 "; SetPos(15, 15); cout<<"5. F-22猛禽 "; drawRow(20, 0, 79, '-'); drawRow(22, 0, 79, '-'); SetPos(47, 11); cout<<"歼-20: "; SetPos(51, 13); cout<<"歼-20是中国国产的第五代战斗机 "; SetPos(24, 21); cout<<"制作:LJF神犇 魔改:Proton"; int j=11; SetPos(12, j); cout<<">>"; drawFrame(45, 9, 79, 17, '=', '|'); while(1) { if( _kbhit() ) { char x=_getch(); switch (x) { case 'w' : { if( j == 15) { SetPos(12, j); cout<<" "; j = 14; SetPos(12, j); cout<<">>"; SetPos(51, 13); cout<<" "; SetPos(47, 11); cout<<"歼-15: "; SetPos(47, 13); cout<<"歼-15是中国大量装备的第三代战斗机 "; } else if( j == 13) { SetPos(12, j); cout<<" "; j = 12; SetPos(12, j); cout<<">>"; SetPos(51, 13); cout<<" "; SetPos(47, 11); cout<<"苏-30: "; SetPos(47, 13); cout<<"苏-30是俄罗斯先进的第四代战斗机 "; } else if( j == 14) { SetPos(12, j); cout<<" "; j = 13; SetPos(12, j); cout<<">>"; SetPos(51, 13); cout<<" "; SetPos(47, 11); cout<<"F-35飞电: "; SetPos(47, 13); cout<<"F-35飞电是美国的第五代战斗机 "; } else if( j == 12) { SetPos(12, j); cout<<" "; j = 11; SetPos(12, j); cout<<">>"; SetPos(51, 13); cout<<" "; SetPos(47, 11); cout<<"歼-20: "; SetPos(47, 13); cout<<"歼-20是中国国产的第五代隐身战斗机 "; } break; } case 's' : { if( j == 12) { SetPos(12, j); cout<<" "; j = 13; SetPos(12, j); cout<<">>"; SetPos(51, 13); cout<<" "; SetPos(47, 11); cout<<"F-35飞电: "; SetPos(47, 13); cout<<"F-35飞电是美国的第五代隐身战斗机 "; } else if( j == 11) { SetPos(12, j); cout<<" "; j = 12; SetPos(12, j); cout<<">>"; SetPos(51, 13); cout<<" "; SetPos(47, 11); cout<<"苏-30: "; SetPos(47, 13); cout<<"苏-30是俄罗斯先进的第四代战斗机 "; } else if( j == 14) { SetPos(12, j); cout<<" "; j = 15; SetPos(12, j); cout<<">>"; SetPos(51, 13); cout<<" "; SetPos(47, 11); cout<<"F-22猛禽: "; SetPos(47, 13); cout<<"F-22猛禽是美国量产的第四代战斗机 "; } else if( j == 13) { SetPos(12, j); cout<<" "; j = 14; SetPos(12, j); cout<<">>"; SetPos(51, 13); cout<<" "; SetPos(47, 11); cout<<"歼-15: "; SetPos(47, 13); cout<<"歼-15是中国大量装备的第三代战斗机 "; } else if( j == 12) { SetPos(12, j); cout<<" "; j = 13; SetPos(12, j); cout<<">>"; SetPos(51, 13); cout<<" "; SetPos(47, 11); cout<<"苏-30: "; SetPos(47, 13); cout<<"苏-30是俄罗斯先进的第四代战斗机 "; } break; } case 'k' : { if (j == 11) return 1; else if(j==12)return 2; else if(j==13)return 3; else if(j==14)return 4; else if(j==15)return 5; } } } } } void juqing1() { system("cls"); COORD p1={28,9}; COORD p2={53,15}; SetPos(31,9); string str="在2020年2月30日"; for(int i=0; i<str.size(); i++) { Sleep(80); cout<<str[i]; } Sleep(500); SetPos(19, 10); str="一队身份不明的无人机集群侵入了我国的南海上空"; for(int i=0; i<str.size(); i++) { Sleep(80); cout<<str[i]; } Sleep(500); SetPos(21, 11); str="中央军委要求第七航空兵团去拦截这群无人机"; for(int i=0; i<str.size(); i++) { Sleep(80); cout<<str[i]; } Sleep(500); SetPos(24, 12); str="你的任务是拦截东方的无人机集群"; for(int i=0; i<str.size(); i++) { Sleep(80); cout<<str[i]; } Sleep(500); SetPos(22, 13); str="兵团的其他同志主要负责撤离平民"; for(int i=0; i<str.size(); i++) { Sleep(80); cout<<str[i]; } Sleep(500); SetPos(22, 14); str="你的身后就是祖国,你已无处可退"; for(int i=0; i<str.size(); i++) { Sleep(80); cout<<str[i]; } Sleep(500); SetPos(24, 15); str="去完成你的光荣使命吧,同志!"; for(int i=0; i<str.size(); i++) { Sleep(80); cout<<str[i]; } Sleep(500); SetPos(31, 16); cout<<"单击回车键继续"; } void juqing2() { system("cls"); COORD p1={28,9}; COORD p2={53,15}; SetPos(15,9); string str="同志!恭喜你成功击退了南海上空无人机群的攻击"; for(int i=0; i<str.size(); i++) { Sleep(80); cout<<str[i]; } Sleep(500); SetPos(19, 10); str="但又有一队无人机集群侵入了我国的东南沿海"; for(int i=0; i<str.size(); i++) { Sleep(80); cout<<str[i]; } Sleep(500); SetPos(15, 11); str="中央军委要求第7航空兵团火速返航去拦截这群无人机"; for(int i=0; i<str.size(); i++) { Sleep(80); cout<<str[i]; } Sleep(500); SetPos(22, 12); str="但是兵团的可用兵力已经不多了"; for(int i=0; i<str.size(); i++) { Sleep(80); cout<<str[i]; } Sleep(500); SetPos(25, 13); str="所以你又被派往了前线"; for(int i=0; i<str.size(); i++) { Sleep(80); cout<<str[i]; } Sleep(500); SetPos(22, 14); str="你的身后就是祖国,你已无处可退"; for(int i=0; i<str.size(); i++) { Sleep(80); cout<<str[i]; } Sleep(500); SetPos(24, 15); str="去完成你的光荣使命吧,同志!"; for(int i=0; i<str.size(); i++) { Sleep(80); cout<<str[i]; } Sleep(500); SetPos(31, 16); cout<<"单击回车键继续"; } void juqing3() { system("cls"); COORD p1={28,9}; COORD p2={53,15}; SetPos(15,9); string str="同志!恭喜你成功击退了东南沿海无人机群的攻击"; for(int i=0; i<str.size(); i++) { Sleep(80); cout<<str[i]; } Sleep(500); SetPos(22, 10); str="但有一个很不幸的消息在等着你"; for(int i=0; i<str.size(); i++) { Sleep(80); cout<<str[i]; } Sleep(500); SetPos(20, 11); str="第七航空兵团驻地遭到了战略核打击"; for(int i=0; i<str.size(); i++) { Sleep(80); cout<<str[i]; } Sleep(500); SetPos(22, 12); str="你是兵团仅存的成员"; for(int i=0; i<str.size(); i++) { Sleep(80); cout<<str[i]; } Sleep(500); SetPos(18, 13); str="而现在正有一群无人机侵入了西藏地区"; for(int i=0; i<str.size(); i++) { Sleep(80); cout<<str[i]; } Sleep(500); SetPos(25, 14); str="你别无选择,只能再战"; for(int i=0; i<str.size(); i++) { Sleep(80); cout<<str[i]; } Sleep(500); SetPos(24, 15); str="去完成你的光荣使命吧,同志!"; for(int i=0; i<str.size(); i++) { Sleep(80); cout<<str[i]; } Sleep(500); SetPos(31, 16); cout<<"单击回车键继续"; } void juqing4() { system("cls"); COORD p1={28,9}; COORD p2={53,15}; SetPos(15,9); string str="同志!恭喜你成功击退了西藏地区无人机群的攻击"; for(int i=0; i<str.size(); i++) { Sleep(80); cout<<str[i]; } Sleep(500); SetPos(19, 10); str="但有一队无人机集群乘虚侵入了我国的华北地区"; for(int i=0; i<str.size(); i++) { Sleep(80); cout<<str[i]; } Sleep(500); SetPos(22, 11); str="华北地区已经遭到了严重的损失"; for(int i=0; i<str.size(); i++) { Sleep(80); cout<<str[i]; } Sleep(500); SetPos(15, 12); str="中央军委要求所有可用兵力去拦截这群无人机"; for(int i=0; i<str.size(); i++) { Sleep(80); cout<<str[i]; } Sleep(500); SetPos(25, 13); str="所以为了人民的幸福"; for(int i=0; i<str.size(); i++) { Sleep(80); cout<<str[i]; } Sleep(500); SetPos(23, 14); str="为了社会主义现代化建设"; for(int i=0; i<str.size(); i++) { Sleep(80); cout<<str[i]; } Sleep(500); SetPos(24, 15); str="去消灭这群无人机吧,同志!"; for(int i=0; i<str.size(); i++) { Sleep(80); cout<<str[i]; } Sleep(500); SetPos(31, 16); cout<<"单击回车键继续"; } void juqing5() { system("cls"); COORD p1={28,9}; COORD p2={53,15}; SetPos(18,9); string str="同志,我们已经查清了这次攻击的幕后黑手"; for(int i=0; i<str.size(); i++) { Sleep(80); cout<<str[i]; } Sleep(500); SetPos(22, 10); str="他就是人工智能阿尔法元"; for(int i=0; i<str.size(); i++) { Sleep(80); cout<<str[i]; } Sleep(500); SetPos(15, 11); str="现在阿尔法元正在操控无人机群进攻首都北京"; for(int i=0; i<str.size(); i++) { Sleep(80); cout<<str[i]; } Sleep(500); SetPos(15, 12); str="中央军委已经动员了全国的力量去防守北京"; for(int i=0; i<str.size(); i++) { Sleep(80); cout<<str[i]; } Sleep(500); SetPos(18, 13); str="你要协助他们,一起守住北京"; for(int i=0; i<str.size(); i++) { Sleep(80); cout<<str[i]; } Sleep(500); SetPos(17, 14); str="为了祖国和人民,我们绝不能后退"; for(int i=0; i<str.size(); i++) { Sleep(80); cout<<str[i]; } Sleep(500); SetPos(24, 15); str="去完成你的光荣使命吧,同志!"; for(int i=0; i<str.size(); i++) { Sleep(80); cout<<str[i]; } Sleep(500); SetPos(31, 16); cout<<"单击回车键继续"; } void juqing6() { system("cls"); COORD p1={28,9}; COORD p2={53,15}; SetPos(25,9); string str="同志,我们胜利了"; for(int i=0; i<str.size(); i++) { Sleep(80); cout<<str[i]; } Sleep(500); SetPos(25, 10); str="首都北京保住了"; for(int i=0; i<str.size(); i++) { Sleep(80); cout<<str[i]; } Sleep(500); SetPos(15, 11); str="现在阿尔法元正在操控无人机群防卫他的老巢筑波"; for(int i=0; i<str.size(); i++) { Sleep(80); cout<<str[i]; } Sleep(500); SetPos(21, 12); str="中央军委联合世界各国武装力量"; for(int i=0; i<str.size(); i++) { Sleep(80); cout<<str[i]; } Sleep(500); SetPos(23, 13); str="准备彻底剿灭阿尔法元"; for(int i=0; i<str.size(); i++) { Sleep(80); cout<<str[i]; } Sleep(500); SetPos(17, 14); str="为了祖国和人民,我们要战斗到底"; for(int i=0; i<str.size(); i++) { Sleep(80); cout<<str[i]; } Sleep(500); SetPos(24, 15); str="去完成你的光荣使命吧,同志!"; for(int i=0; i<str.size(); i++) { Sleep(80); cout<<str[i]; } Sleep(500); SetPos(31, 16); cout<<"单击回车键继续"; } void juqing7() { system("cls"); COORD p1={28,9}; COORD p2={53,15}; SetPos(22,9); string str="同志,我们终于获得了最终的胜利"; for(int i=0; i<str.size(); i++) { Sleep(80); cout<<str[i]; } Sleep(500); SetPos(25, 10); str="阿尔法元被消灭了"; for(int i=0; i<str.size(); i++) { Sleep(80); cout<<str[i]; } Sleep(500); SetPos(21, 11); str="你无疑是这一胜利的最大功臣"; for(int i=0; i<str.size(); i++) { Sleep(80); cout<<str[i]; } Sleep(500); SetPos(19, 12); str="中央军委颁发给你一颗特级战斗勋章"; for(int i=0; i<str.size(); i++) { Sleep(80); cout<<str[i]; } Sleep(500); SetPos(22, 13); str="你的事迹将名垂青史"; for(int i=0; i<str.size(); i++) { Sleep(80); cout<<str[i]; } Sleep(500); SetPos(21, 14); str="你终于完成了你光荣的使命"; for(int i=0; i<str.size(); i++) { Sleep(80); cout<<str[i]; } Sleep(500); SetPos(31, 15); cout<<"单击回车键继续"; } void qingchu() { SetPos(15,9); cout<<" "; SetPos(15,10); cout<<" "; SetPos(15,11); cout<<" "; SetPos(15,12); cout<<" "; SetPos(15,13); cout<<" "; SetPos(15,14); cout<<" "; SetPos(15,15); cout<<" "; SetPos(15,16); cout<<" "; }
class Game { public: COORD position[10]; COORD bullet[10]; Frame enemy[8]; int score; int rank; int rankf; string title; int flag_rank; Game (); void initPlane(); void initBullet(); void initEnemy(); void planeMove(char); void bulletMove(); void enemyMove(); void drawPlane(); void drawPlaneToNull(); void drawBullet(); void drawBulletToNull(); void drawEnemy(); void drawEnemyToNull(); void drawThisBulletToNull( COORD ); void drawThisdaodanToNull( COORD ); void drawThisEnemyToNull( Frame ); void Pause(); void Playing(); void judgePlane(); void judgeEnemy1(); void judgeEnemy2(); void Shoot1(); void Shoot2(); void Shoot3(); void daodan1(); void daodan2(); void hedan(); void yinshen(); void zhiyuan1(); void zhiyuan2(); void zhiyuan3(); void zhiyuan4(); void zhiyuan5(); void jipao(); void GameOver(); void printScore(); void drawPlane2(); void drawPlane3(); void drawPlane4(); void drawPlane5(); void panduan2(); void jiguang1(); void jiguang2(); void yaoban(); }; Game::Game() { initPlane(); initBullet(); initEnemy(); score = 0; rank = 25; rankf = 0; flag_rank = 0; }
void Game::initPlane() { COORD centren={39, 22}; position[0].X=position[5].X=position[7].X=position[9].X=centren.X; position[1].X=centren.X-2; position[2].X=position[6].X=centren.X-1; position[3].X=position[8].X=centren.X+1; position[4].X=centren.X+2; for(int i=0; i<=4; i++) position[i].Y=centren.Y; for(int i=6; i<=8; i++) position[i].Y=centren.Y+1; position[5].Y=centren.Y-1; position[9].Y=centren.Y-2; } void Game::drawPlane() { for(int i=0; i<9; i++) { SetPos(position[i]); if(i==1||i==2||i==6) cout<<"<"; if(i==3||i==4||i==8) cout<<">"; else if(i==5) cout<<"*"; else if(i==7) cout<<"#"; } } void Game::drawPlane2() { for(int i=0; i<9; i++) { SetPos(position[i]); if(i!=5) cout<<"@"; else if(i==5) cout<<"!"; } } void Game::drawPlane3() { for(int i=0; i<9; i++) { SetPos(position[i]); if(i!=5) cout<<"#"; else if(i==5) cout<<"|"; } } void Game::drawPlane4() { for(int i=0; i<9; i++) { SetPos(position[i]); if(i!=5) cout<<"^"; else if(i==5) cout<<"*"; } } void Game::drawPlane5() { for(int i=0; i<9; i++) { SetPos(position[i]); if(i!=5) cout<<"%"; else if(i==5) cout<<"+"; } } void Game::yaoban() { srand(time(0)); int yb=(rand()%(100-1+1))+1; if(yb>=90) { SetPos(56, 2); cout<<"检测到耀斑,强度:"<<hz<<" "; SetPos(56, 3); cout<<"可开启激光充能装置(F)"; hz=(rand()%(15-3+1))+3; } else if(hz<=0) { SetPos(56, 2); cout<<" "; SetPos(56, 3); cout<<" "; } } void Game::panduan2() { if(o==1) drawPlane(); else if(o==2) drawPlane2(); else if(o==3) drawPlane3(); else if(o==4) drawPlane4(); else if(o==5) drawPlane5(); } void Game::yinshen() { for(int i=0; i<9; i++) { SetPos(position[i]); if(i!=5) cout<<" "; else if(i==5) cout<<" "; } } void Game::drawPlaneToNull() { for(int i=0; i<9; i++) { SetPos(position[i]); cout<<" "; } } void Game::initBullet() { for(int i=0; i<10; i++) bullet[i].Y = 30; } void Game::drawBullet() { if(dd==0) {for(int i=0; i<10; i++) { if( bullet[i].Y != 30) { SetPos(bullet[i]); cout<<":"; } }} else if(dd==1) {for(int i=0; i<10; i++) { if( bullet[i].Y != 30) { SetPos(bullet[i]); cout<<"*"<<endl; } }} else if(dd==2) {for(int i=0; i<10; i++) { if( bullet[i].Y != 30) { SetPos(bullet[i]); cout<<"#"<<endl; } }} else if(dd==3) {for(int i=0; i<10; i++) { if( bullet[i].Y != 30) { SetPos(bullet[i]); cout<<"^"<<endl; } }} else if(dd==4) { for(int i=0; i<10; i++) { if( bullet[i].Y != 30) { SetPos(bullet[i]); cout<<"|"; } } } } void Game::drawBulletToNull() { for(int i=0; i<10; i++) if( bullet[i].Y != 30 ) { COORD pos={bullet[i].X, bullet[i].Y+1}; SetPos(pos); cout<<" "; } } void Game::initEnemy() { COORD a={1, 1}; COORD b={45, 15}; for(int i=0; i<8; i++) { enemy[i].position[0] = random(a, b); enemy[i].position[1].X = enemy[i].position[0].X + 3; enemy[i].position[1].Y = enemy[i].position[0].Y + 2; } } void Game::drawEnemy() { for(int i=0; i<8; i++) drawFrame(enemy[i].position[0], enemy[i].position[1], '-', '|'); } void Game::drawEnemyToNull() { for(int i=0; i<8; i++) { drawFrame(enemy[i].position[0], enemy[i].position[1], ' ', ' '); } } void Game::Pause() { SetPos(61,2); cout<<" "; SetPos(61,2); cout<<"暂停中..."; char c=_getch(); while(c!='p') c=_getch(); SetPos(61,2); cout<<" "; } void Game::planeMove(char x) { if(x == 'a') if(position[1].X != 1) for(int i=0; i<=9; i++) position[i].X -= 2; if(x == 's') if(position[7].Y != 23) for(int i=0; i<=9; i++) position[i].Y += 1; if(x == 'd') if(position[4].X != 47) for(int i=0; i<=9; i++) position[i].X += 2; if(x == 'w') if(position[5].Y != 3) for(int i=0; i<=9; i++) position[i].Y -= 1; } void Game::bulletMove() { for(int i=0; i<10; i++) { if( bullet[i].Y != 30) { bullet[i].Y -= 1; if( bullet[i].Y == 1 ) { COORD pos={bullet[i].X, bullet[i].Y+1}; drawThisBulletToNull( pos ); bullet[i].Y=30; } } } }
void Game::enemyMove() { for(int i=0; i<8; i++) { for(int j=0; j<2; j++) enemy[i].position[j].Y++; if(24 == enemy[i].position[1].Y) { COORD a={1, 1}; COORD b={45, 3}; enemy[i].position[0] = random(a, b); enemy[i].position[1].X = enemy[i].position[0].X + 3; enemy[i].position[1].Y = enemy[i].position[0].Y + 2; } } } void Game::judgePlane() { for(int i = 0; i < 8; i++) for(int j=0; j<9; j++) if(judgeCoordInFrame(enemy[i], position[j])) { if(g>0) { g--; SetPos(62, 1); cout<<"飞机受损"; drawPlaying(); } else if(g<=0) { SetPos(62, 1); cout<<"为国捐躯"; drawFrame(enemy[i], '+', '+'); Sleep(1000); GameOver(); break; } } } void Game::drawThisBulletToNull( COORD c) { SetPos(c); cout<<" "; } void Game::drawThisEnemyToNull( Frame f ) { drawFrame(f, ' ', ' '); } void Game::judgeEnemy1() { for(int i = 0; i < 8; i++) for(int j = 0; j < 10; j++) if( judgeCoordInFrame(enemy[i], bullet[j]) ) { switch(dd) { case 0:t1--;break; case 1:t1=0;break; case 2:t1=0;break; case 3:t1-=2;break; case 4:t1=0;break; } if(t1<=0) { score += 5; drawThisEnemyToNull( enemy[i] ); COORD a={1, 1}; COORD b={45, 3}; enemy[i].position[0] = random(a, b); enemy[i].position[1].X = enemy[i].position[0].X + 3; enemy[i].position[1].Y = enemy[i].position[0].Y + 2; if(dd==4) dd=dd; else { drawThisBulletToNull( bullet[j] ); bullet[j].Y = 30; } t2++; t3++; t1=3; } if(t2==5) { c+=5; d+=20; e+=1; f+=1; t2=0; } } } void Game::hedan() { for(int i = 0; i < 8; i++) for(int j = 0; j < 10; j++) { score += 5; drawThisEnemyToNull( enemy[i] ); COORD a={1, 1}; COORD b={45, 3}; enemy[i].position[0] = random(a, b); enemy[i].position[1].X = enemy[i].position[0].X + 3; enemy[i].position[1].Y = enemy[i].position[0].Y + 2; drawThisBulletToNull( bullet[j] ); bullet[j].Y = 30; } } void Game::daodan1() { for(int i=0; i<10; i++) if(bullet[i].Y == 30) { bullet[i].X = position[5].X+3; bullet[i].Y = position[5].Y-1; break; } } void Game::daodan2() { for(int i=0; i<10; i++) if(bullet[i].Y == 30) { bullet[i].X = position[5].X-3; bullet[i].Y = position[5].Y-1; break; } } void Game::jiguang1() { for(int i=0; i<10; i++) if(bullet[i].Y == 30) { bullet[i].X = position[5].X+2; bullet[i].Y = position[5].Y-1; break; } } void Game::jiguang2() { for(int i=0; i<10; i++) if(bullet[i].Y == 30) { bullet[i].X = position[5].X-2; bullet[i].Y = position[5].Y-1; break; } } void Game::Shoot1() { for(int i=0; i<10; i++) if(bullet[i].Y == 30) { bullet[i].X = position[5].X; bullet[i].Y = position[5].Y-1; break; } } void Game::Shoot2() { for(int i=0; i<10; i++) if(bullet[i].Y == 30) { bullet[i].X = position[5].X+3; bullet[i].Y = position[5].Y-1; break; } } void Game::Shoot3() { for(int i=0; i<10; i++) if(bullet[i].Y == 30) { bullet[i].X = position[5].X-3; bullet[i].Y = position[5].Y-1; break; } } void Game::zhiyuan1() { int c=rand()%7+9; for(int i=0; i<10; i++) if(bullet[i].Y == 30) { bullet[i].X = position[5].X+c; bullet[i].Y = position[5].Y-1; break; } } void Game::zhiyuan2() { int c=rand()%4+6; for(int i=0; i<10; i++) if(bullet[i].Y == 30) { bullet[i].X = position[5].X-c; bullet[i].Y = position[5].Y-1; break; } } void Game::zhiyuan3() { int c=rand()%1+3; for(int i=0; i<10; i++) if(bullet[i].Y == 30) { bullet[i].X = position[5].X+c; bullet[i].Y = position[5].Y-1; break; } } void Game::zhiyuan4() { int c=rand()%10+12; for(int i=0; i<10; i++) if(bullet[i].Y == 30) { bullet[i].X = position[5].X-c; bullet[i].Y = position[5].Y-1; break; } } void Game::zhiyuan5() { int c=rand()%12+14; for(int i=0; i<10; i++) if(bullet[i].Y == 30) { bullet[i].X = position[5].X+c; bullet[i].Y = position[5].Y-1; break; } } void Game::jipao() { for(int i=0; i<10; i++) if(bullet[i].Y == 30) { bullet[i].X = position[5].X; bullet[i].Y = position[5].Y-1; break; } } void Game::printScore() { if(score == 120 && flag_rank == 0) { rank -= 3; flag_rank = 1; } else if( score == 360 && flag_rank == 1) { rank -= 5; flag_rank = 2; } else if( score == 480 && flag_rank == 2) { rank -= 5; flag_rank = 3; } int x=rank/5; SetPos(60, 6); cout<<score; SetPos(60, 7); if( score<=200) title="实习飞行员"; else if( score<=500&&score>200) title="人民空军初级飞行员"; else if( score<=750&&score>500) title="人民空军中级飞行员"; else if( score<=1000&&score>750 ) title="人民空军高级飞行员"; else if( score<=1500&&score>1000 ) title="人民空军王牌飞行员 "; else if( score<=2000&&score>1500 ) title="人民空军总司令 "; else if( score>2000 ) title="陈独秀 "; cout<<title; rankf = rank; } void Game::Playing() { drawEnemy(); panduan2(); int flag_bullet = 0; int flag_enemy = 0; while(1) { Sleep(8); yaoban(); if(hz>0)hz--; if(_kbhit()) { char x = _getch(); if ('a' == x || 's' == x || 'd' == x || 'w' == x) { drawPlaneToNull(); planeMove(x); panduan2(); judgePlane(); } else if ('p' == x) Pause(); else if( 'k' == x) { if(d>0) { dd=0; Shoot1(); Shoot2(); Shoot3(); d-=3; drawPlaying(); } else d=d; } else if ('j' == x) { if(e>0) { dd=2; zhiyuan1(); zhiyuan2(); zhiyuan3(); zhiyuan4(); zhiyuan5(); e--; drawPlaying(); } else e=e; } else if ('m' == x) yinshen(); else if('n'==x) { flag_enemy=0; } else if('l'==x) { if(b>0) { b--; hedan(); drawPlaying();} else b=b; } else if('i'==x) { if(c>0) { dd=3; jipao(); c--; drawPlaying();} else c=c; } else if('u'==x) { if(f>0) { dd=1; daodan1(); daodan2(); f--; drawPlaying(); } else f=f; } else if('h'==x) { if(h>0) { dd=4; jiguang1(); jiguang2(); h--; drawPlaying(); } else h=h; } else if('f'==x&&hz>0) { h++; hz--; if(hz>0) { SetPos(56, 2); cout<<"检测到耀斑,强度:"<<hz; SetPos(56, 3); cout<<"可开启激光充能装置(F)"; } drawPlaying(); } else if( 'e' == x) { GameOver(); break; } } if( 0 == flag_bullet ) { bulletMove(); drawBulletToNull(); drawBullet(); judgeEnemy1(); } flag_bullet++; if( 1 == flag_bullet ) flag_bullet = 0; if( 0 == flag_enemy ) { drawEnemyToNull(); enemyMove(); drawEnemy(); judgePlane(); } flag_enemy++; if( flag_enemy >= rank ) flag_enemy = 0; printScore(); if(u==2) { if(t3>=75&&guan==1) { t3=0; guan++; juqing2(); char r=getchar(); qingchu(); system("cls"); Game game; int a = drawMenu(); if(a == 2) game.rank = 20; o = drawMenu2(); panduan1(); system("cls"); drawPlaying(); game.Playing(); } if(t3>=100&&guan==2) { t3=0; guan++; juqing3(); char r=getchar(); qingchu(); system("cls"); Game game; int a = drawMenu(); if(a == 2) game.rank = 20; o = drawMenu2(); panduan1(); system("cls"); drawPlaying(); game.Playing(); } if(t3>=125&&guan==3) { t3=0; guan++; juqing4(); char r=getchar(); qingchu(); system("cls"); Game game; int a = drawMenu(); if(a == 2) game.rank = 20; o = drawMenu2(); panduan1(); system("cls"); drawPlaying(); game.Playing(); } if(t3>=150&&guan==4) { t3=0; guan++; juqing5(); char r=getchar(); qingchu(); system("cls"); Game game; int a = drawMenu(); if(a == 2) game.rank = 20; o = drawMenu2(); panduan1(); system("cls"); drawPlaying(); game.Playing(); } if(t3>=175&&guan==5) { t3=0; guan++; juqing6(); char r=getchar(); qingchu(); system("cls"); Game game; int a = drawMenu(); if(a == 2) game.rank = 20; o = drawMenu2(); panduan1(); system("cls"); drawPlaying(); game.Playing(); } if(t3>=200&&guan==6) { t3=0; guan++; juqing7(); char r=getchar(); GameOver(); }} } } void Game::GameOver() { system("cls"); COORD p1={28,9}; COORD p2={53,15}; drawFrame(p1, p2, '=', '|'); SetPos(36,12); string str="Game Over!"; for(int i=0; i<str.size(); i++) { Sleep(80); cout<<str[i]; } Sleep(1000); system("cls"); drawFrame(p1, p2, '=', '|'); SetPos(31, 11); cout<<"击落敌机:"<<score/5<<" 架"; SetPos(31, 12); cout<<"得 分:"<<score; SetPos(31, 13); cout<<"获得称号:"<<title; SetPos(30, 16); Sleep(1000); cout<<"继续? 是(y)| 否(n)"; SetPos(30, 17); cout<<"制作:最牛的LJF"; SetPos(30, 18); cout<<"魔改:Proton"; as: char x=_getch(); if (x == 'n') exit(0); else if (x == 'y') { system("cls"); Game game; int a = drawMenu(); if(a == 2) game.rank = 20; int u=drawMenu3(); if(u==1) { o = drawMenu2(); panduan1(); system("cls"); drawPlaying(); game.Playing(); } else if(u==2) { juqing1(); char r=getchar(); qingchu(); guan=1; o = drawMenu2(); panduan1(); system("cls"); drawPlaying(); game.Playing(); } } else goto as; } int main() { srand((int)time(0)); HideCursor(); Game game; int a = drawMenu(); if(a == 2) game.rank = 20; u=drawMenu3(); if(u==1) { o = drawMenu2(); panduan1(); system("cls"); drawPlaying(); game.Playing(); } else if(u==2) { juqing1(); char r=getchar(); qingchu(); guan=1; o = drawMenu2(); panduan1(); system("cls"); drawPlaying(); game.Playing(); } }
|