正文
增加 1207 行删除 1183 行
20 行未改动21222324252627282953 行未改动838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615730 行未改动188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154020 行未改动+ 激光 (Z键):发射一道贯穿屏幕的激光,持续对敌人造成伤害。+ 狂暴模式 (X键):短时间内大幅提升攻击力,并进入狂暴状态。+ 追踪导弹 (H键):一次性发射 5 枚自动追踪敌人的导弹。+ 散射子弹 (G键):发射扇形扩散的子弹,覆盖更大范围。+ 动态难度与成长系统:随着得分增加,游戏等级提升,敌人变得更强大,同时玩家的基础攻击力也会增长。击杀敌人会获得技能能量,用于释放技能。53 行未改动enum { ENEMY_NORMAL, ENEMY_BOSS };enum { BULLET_NORMAL, BULLET_HOMING, BULLET_SPREAD };struct Bullet {int x, y;bool live;int shooterType;int direction;int type;int targetEnemyIndex;double angle;};struct Enemy {int x, y;bool live;int hp;int initialHp;int type;int width, height;int laserTimer;bool isFiringLaser;int targetX;int shootTimer;};struct Plane {int x, y;int hp;int maxHp;};struct PowerUp {int x, y;bool live;int type;};struct Explosion {int x, y;bool active;int frame;int maxFrame;};struct Particle {int x, y;double vx, vy;int life;int color;bool active;int type;double size;};struct SkillSystem {double bombEnergy;double laserEnergy;double rageEnergy;double homingMissileEnergy;double spreadShotEnergy;bool rageActive;int rageTimer;double originalDamage;};struct Achievement {const char* name;const char* desc;bool unlocked;function<bool()> checkCondition;};Plane p;Bullet b[MAX_BULLETS];30 行未改动char bossWarningText[100] = "";int bossWarningTimer = 0;vector<Achievement> achievements = {{"First Blood","Kill your first enemy",false,[]() { return sc >= 5; }},{"Combo Master","Achieve a 10x combo",false,[]() { return combo >= 10; }},{"Boss Slayer","Defeat a boss",false,[]() { return sc >= 1000; }}};int highScore = 0;vector<int> cityBuildingHeights;void InitGame() {p.x = W / 2 - 10;p.y = H - 80;p.hp = 10;p.maxHp = 10;for (int i = 0; i < MAX_BULLETS; i++) {b[i].live = false;b[i].shooterType = 0;b[i].direction = 0;b[i].type = BULLET_NORMAL;b[i].targetEnemyIndex = -1;b[i].angle = 0.0;}for (int i = 0; i < MAX_ENEMIES; i++) {e[i].live = false;e[i].type = ENEMY_NORMAL;e[i].width = 30;e[i].height = 30;e[i].laserTimer = 0;e[i].isFiringLaser = false;e[i].targetX = 0;e[i].shootTimer = 0;}for (int i = 0; i < MAX_POWERUPS; i++) pu[i].live = false;for (int i = 0; i < MAX_EXPLOSIONS; i++) pxe[i].active = false;for (int i = 0; i < MAX_PARTICLES; i++) {particles[i].active = false;particles[i].type = PARTICLE_EXPLOSION;particles[i].size = 2.0;}skills.bombEnergy = 0.0;skills.laserEnergy = 0.0;skills.rageEnergy = 0.0;skills.homingMissileEnergy = 0.0;skills.spreadShotEnergy = 0.0;skills.rageActive = false;skills.rageTimer = 0;skills.originalDamage = shanghai;laserActive = false;laserTimer = 0;bombShockwaveActive = false;shockwaveRadius = 0;shockwaveAge = 0;screenShakeTimer = 0;screenShakeOffsetX = 0;screenShakeOffsetY = 0;combo = 0;comboTimer = 0;lastKillTime = 0;bossSpawnedThisLevel = false;bossAttackPattern = 0;bossAttackTimer = 0;strcpy(bossWarningText, "");bossWarningTimer = 0;bc = ec = sc = lv = 1;srand((unsigned int)time(NULL));cityBuildingHeights.clear();int numBuildings = W / CITY_BUILDING_WIDTH;for (int i = 0; i < numBuildings; i++) {cityBuildingHeights.push_back(rand() % (CITY_BUILDING_HEIGHT_MAX - CITY_BUILDING_HEIGHT_MIN + 1) + CITY_BUILDING_HEIGHT_MIN);}}void DrawStart() {cleardevice();setfillcolor(BLACK);bar(0, 0, W, H);setcolor(YELLOW);settextstyle(30, 0, "Arial");outtextxy(W / 2 - 100, H / 3, "Aircraft Battle");setcolor(WHITE);settextstyle(16, 0, "Consolas");outtextxy(W / 2 - 60, H / 2, "Press SPACE to start");outtextxy(W / 2 - 60, H / 2 + 30, "Arrow keys: move");outtextxy(W / 2 - 60, H / 2 + 60, "SPACE: shoot");outtextxy(W / 2 - 60, H / 2 + 90, "F: use BOMB");outtextxy(W / 2 - 60, H / 2 + 120, "Z: use LASER");outtextxy(W / 2 - 60, H / 2 + 150, "X: use RAGE (10s +5 damage)");outtextxy(W / 2 - 60, H / 2 + 180, "H: use HOMING MISSILE (5 missiles)");outtextxy(W / 2 - 60, H / 2 + 210, "G: use SPREAD SHOT (7 bullets)");outtextxy(W / 2 - 60, H / 2 + 240, "P: pause");outtextxy(W / 2 - 60, H / 2 + 270, "ESC: quit");char hsStr[50];sprintf(hsStr, "High Score: %d", highScore);outtextxy(W / 2 - 60, H / 2 + 300, hsStr);}void DrawCity() {int offset_y = screenShakeOffsetY;setfillcolor(RGB(30, 30, 50));bar(0, H + offset_y, W, H + 20 + offset_y);setfillcolor(RGB(40, 40, 60));for (int i = 0; i < cityBuildingHeights.size(); i++) {int buildingX = i * CITY_BUILDING_WIDTH;int buildingHeight = cityBuildingHeights[i];bar(buildingX, H - buildingHeight + offset_y, buildingX + CITY_BUILDING_WIDTH, H + offset_y);}}void DrawPlayer() {int offset_x = screenShakeOffsetX;int offset_y = screenShakeOffsetY;int drawX = p.x + offset_x;int drawY = p.y + offset_y;POINT playerBody[] = {{drawX + 10, drawY},{drawX, drawY + 30},{drawX + 20, drawY + 30}};setfillcolor(RGB(30, 144, 255));fillpolygon(playerBody, 3);POINT core[] = {{drawX + 10, drawY + 5},{drawX + 5, drawY + 25},{drawX + 15, drawY + 25}};setfillcolor(WHITE);fillpolygon(core, 3);POINT leftWing[] = {{drawX - 10, drawY + 15},{drawX, drawY + 8},{drawX + 5, drawY + 15},{drawX, drawY + 23}};setfillcolor(RGB(100, 149, 237));fillpolygon(leftWing, 4);POINT rightWing[] = {{drawX + 20 + 10, drawY + 15},{drawX + 20, drawY + 8},{drawX + 20 - 5, drawY + 15},{drawX + 20, drawY + 23}};fillpolygon(rightWing, 4);setfillcolor(RED);bar(drawX + 3, drawY - 5, drawX + 6, drawY);bar(drawX + 14, drawY - 5, drawX + 17, drawY);bar(drawX + 8, drawY - 8, drawX + 12, drawY - 2);setfillcolor(YELLOW);fillcircle(drawX + 10, drawY + 10, 3);if (p.hp > 0) {setfillcolor(GREEN);int w = (int)((20.0 * p.hp) / 10);bar(drawX, drawY + 32, drawX + w, drawY + 36);setcolor(WHITE);rectangle(drawX, drawY + 32, drawX + 20, drawY + 36);}}void DrawBullets() {int offset_x = screenShakeOffsetX;int offset_y = screenShakeOffsetY;for (int i = 0; i < MAX_BULLETS; i++) {if (b[i].live) {if (b[i].shooterType == 0) {if (b[i].type == BULLET_NORMAL) {setfillcolor(BLUE);} else if (b[i].type == BULLET_HOMING) {setfillcolor(RGB(0, 255, 255));} else if (b[i].type == BULLET_SPREAD) {setfillcolor(RGB(255, 255, 0));}} else if (b[i].shooterType == 1) {setfillcolor(RED);} else {setfillcolor(YELLOW);}if (b[i].type == BULLET_HOMING) {POINT missile[] = {{b[i].x + offset_x, b[i].y - 3 + offset_y},{b[i].x - 3 + offset_x, b[i].y + offset_y},{b[i].x + offset_x, b[i].y + 3 + offset_y},{b[i].x + 3 + offset_x, b[i].y + offset_y}};fillpolygon(missile, 4);} else {bar(b[i].x + offset_x, b[i].y + offset_y, b[i].x + 4 + offset_x, b[i].y + 10 + offset_y);}}}}void DrawEnemies() {int offset_x = screenShakeOffsetX;int offset_y = screenShakeOffsetY;for (int i = 0; i < MAX_ENEMIES; i++) {if (e[i].live) {int drawX = e[i].x + offset_x;int drawY = e[i].y + offset_y;if (e[i].type == ENEMY_BOSS) {POINT bossBody[] = {{drawX + e[i].width / 2, drawY + e[i].height},{drawX, drawY},{drawX + e[i].width, drawY}};setfillcolor(RGB(40, 40, 40));fillpolygon(bossBody, 3);POINT core[] = {{drawX + e[i].width / 2, drawY + e[i].height - 5},{drawX + e[i].width / 4, drawY + 5},{drawX + 3 * e[i].width / 4, drawY + 5}};setfillcolor(RGB(139, 0, 0));fillpolygon(core, 3);POINT leftWing[] = {{drawX - 15, drawY + 3 * e[i].height / 4},{drawX, drawY + e[i].height / 2},{drawX - 10, drawY + e[i].height / 4},{drawX - 20, drawY + e[i].height / 2}};setfillcolor(RGB(60, 60, 60));fillpolygon(leftWing, 4);POINT rightWing[] = {{drawX + e[i].width + 15, drawY + 3 * e[i].height / 4},{drawX + e[i].width, drawY + e[i].height / 2},{drawX + e[i].width + 10, drawY + e[i].height / 4},{drawX + e[i].width + 20, drawY + e[i].height / 2}};fillpolygon(rightWing, 4);setfillcolor(RGB(0, 191, 255));bar(drawX + e[i].width / 2 - 2, drawY + 5, drawX + e[i].width / 2 + 2, drawY + e[i].height - 5);setfillcolor(RED);bar(drawX + 5, drawY + e[i].height, drawX + 15, drawY + e[i].height + 10);bar(drawX + e[i].width - 15, drawY + e[i].height, drawX + e[i].width - 5, drawY + e[i].height + 10);bar(drawX + e[i].width / 2 - 5, drawY + e[i].height, drawX + e[i].width / 2 + 5, drawY + e[i].height + 10);setfillcolor(BLACK);bar(drawX + e[i].width / 2 - 3, drawY - 5, drawX + e[i].width / 2 + 3, drawY);if (e[i].isFiringLaser) {setcolor(RGB(0, 191, 255));setlinestyle(PS_SOLID, 5);line(drawX + 10, drawY + e[i].height + 10, drawX + 10, H);line(drawX + e[i].width / 2, drawY + e[i].height + 10, drawX + e[i].width / 2, H);line(drawX + e[i].width - 10, drawY + e[i].height + 10, drawX + e[i].width - 10, H);setlinestyle(PS_SOLID, 1);}} else {POINT enemyBody[] = {{drawX + 15, drawY + 30},{drawX, drawY},{drawX + 30, drawY}};setfillcolor(RGB(255, 105, 180));fillpolygon(enemyBody, 3);POINT leftWing[] = {{drawX - 5, drawY + 20},{drawX, drawY + 10},{drawX + 5, drawY + 20},{drawX, drawY + 25}};setfillcolor(RGB(255, 20, 147));fillpolygon(leftWing, 4);POINT rightWing[] = {{drawX + 25, drawY + 20},{drawX + 30, drawY + 10},{drawX + 35, drawY + 20},{drawX + 30, drawY + 25}};fillpolygon(rightWing, 4);setfillcolor(RGB(220, 20, 60));bar(drawX + 13, drawY - 5, drawX + 17, drawY);setfillcolor(RED);bar(drawX + 14, drawY + 30, drawX + 16, drawY + 35);}if (e[i].hp > 0) {if (e[i].type == ENEMY_BOSS) {setfillcolor(RGB(0, 191, 255));} else {setfillcolor(RED);}int w = (int)((static_cast<double>(e[i].width) * e[i].hp) / e[i].initialHp);bar(drawX, drawY - 6, drawX + w, drawY - 2);setcolor(WHITE);rectangle(drawX, drawY - 6, drawX + e[i].width, drawY - 2);}}}}void DrawPowerUps() {int offset_x = screenShakeOffsetX;int offset_y = screenShakeOffsetY;for (int i = 0; i < MAX_POWERUPS; i++) {if (pu[i].live) {switch (pu[i].type) {case POWERUP_ATTACK:setfillcolor(RED);solidcircle(pu[i].x + offset_x, pu[i].y + offset_y, 6);setcolor(YELLOW);settextstyle(10, 0, "Arial");outtextxy(pu[i].x - 3 + offset_x, pu[i].y - 5 + offset_y, "A");break;case POWERUP_HP:setfillcolor(GREEN);solidcircle(pu[i].x + offset_x, pu[i].y + offset_y, 6);setcolor(WHITE);settextstyle(10, 0, "Arial");outtextxy(pu[i].x - 2 + offset_x, pu[i].y - 5 + offset_y, "+");break;case POWERUP_BOMB:setfillcolor(YELLOW);solidcircle(pu[i].x + offset_x, pu[i].y + offset_y, 6);setcolor(WHITE);settextstyle(10, 0, "Arial");outtextxy(pu[i].x - 3 + offset_x, pu[i].y - 5 + offset_y, "B");break;}}}}void DrawExplosions() {int offset_x = screenShakeOffsetX;int offset_y = screenShakeOffsetY;for (int i = 0; i < MAX_PARTICLES; i++) {if (particles[i].active) {int drawX = (int)particles[i].x + offset_x;int drawY = (int)particles[i].y + offset_y;if (particles[i].type == PARTICLE_EXPLOSION) {setfillcolor(particles[i].color);solidcircle(drawX, drawY, (int)particles[i].size);} else if (particles[i].type == PARTICLE_JET_TRAIL) {int gray = 255 - (int)((particles[i].life * 255.0) / 20.0);if (gray < 0) gray = 0;if (gray > 255) gray = 255;setfillcolor(RGB(gray, gray, gray));solidcircle(drawX, drawY, (int)particles[i].size);} else if (particles[i].type == PARTICLE_BLEED) {setfillcolor(RED);solidcircle(drawX, drawY, (int)particles[i].size);} else if (particles[i].type == PARTICLE_BOMB_WAVE) {setfillcolor(RGB(255, 255, 200));solidcircle(drawX, drawY, (int)particles[i].size);}}}for (int i = 0; i < MAX_EXPLOSIONS; i++) {if (pxe[i].active) {int drawX = pxe[i].x + offset_x;int drawY = pxe[i].y + offset_y;setcolor(RGB(255, 100, 0));circle(drawX, drawY, pxe[i].frame);}}}void CreateExplosion(int x, int y) {for (int i = 0; i < MAX_EXPLOSIONS; i++) {if (!pxe[i].active) {pxe[i].x = x;pxe[i].y = y;pxe[i].active = true;pxe[i].frame = 0;pxe[i].maxFrame = 10;break;}}for (int j = 0; j < 20; j++) {int idx = rand() % MAX_PARTICLES;if (!particles[idx].active) {particles[idx].x = x;particles[idx].y = y;particles[idx].vx = (rand() % 11) - 5;particles[idx].vy = (rand() % 11) - 5;particles[idx].life = 20 + rand() % 20;int hue = rand() % 40;particles[idx].color = RGB(255, 150 - (hue * 3), 0);particles[idx].active = true;particles[idx].type = PARTICLE_EXPLOSION;particles[idx].size = 2.0;}}}const double M_PI = 3.14159265358979323846;void CreateBombWaveParticles(int centerX, int centerY, int numParticles) {for (int j = 0; j < numParticles; j++) {int idx = rand() % MAX_PARTICLES;if (!particles[idx].active) {double angle = (rand() % 360) * M_PI / 180.0;double speed = 3.0 + (rand() % 5);particles[idx].x = centerX;particles[idx].y = centerY;particles[idx].vx = cos(angle) * speed;particles[idx].vy = sin(angle) * speed;particles[idx].life = 10 + rand() % 10;particles[idx].color = RGB(255, 255, 200);particles[idx].active = true;particles[idx].type = PARTICLE_BOMB_WAVE;particles[idx].size = 1.0 + (rand() % 3);}}}void CreateJetTrail(int x, int y, int direction) {int idx = rand() % MAX_PARTICLES;if (!particles[idx].active) {particles[idx].x = x + rand() % 6 - 3;particles[idx].y = y + (direction ? 5 : -5);particles[idx].vx = (rand() % 3) - 1;particles[idx].vy = (direction ? 1 : -1) * (rand() % 2 + 1);particles[idx].life = 15 + rand() % 10;particles[idx].color = RGB(200, 200, 200);particles[idx].active = true;particles[idx].type = PARTICLE_JET_TRAIL;particles[idx].size = 1.5;}}void CreateBleedingParticles(int x, int y, int count) {for (int j = 0; j < count; j++) {int idx = rand() % MAX_PARTICLES;if (!particles[idx].active) {particles[idx].x = x + rand() % 20 - 10;particles[idx].y = y + rand() % 20 - 10;particles[idx].vx = (rand() % 5) - 2;particles[idx].vy = (rand() % 5) - 2;particles[idx].life = 10 + rand() % 10;particles[idx].color = RGB(200, 0, 0);particles[idx].active = true;particles[idx].type = PARTICLE_BLEED;particles[idx].size = 1.0 + (rand() % 2);}}}void UpdateExplosions() {for (int i = 0; i < MAX_EXPLOSIONS; i++) {if (pxe[i].active) {pxe[i].frame++;if (pxe[i].frame >= pxe[i].maxFrame) {pxe[i].active = false;}}}for (int i = 0; i < MAX_PARTICLES; i++) {if (particles[i].active) {particles[i].x += particles[i].vx;particles[i].y += particles[i].vy;particles[i].life--;if (particles[i].life <= 0) {particles[i].active = false;}}}}void DrawGameOver() {setfillcolor(BLACK);bar(0, 0, W, H);setcolor(RED);settextstyle(40, 0, "Arial");outtextxy(W / 2 - 80, H / 3, "GAME OVER");setcolor(YELLOW);settextstyle(24, 0, "Arial");char s[50];sprintf(s, "END SCORE: %d", sc);outtextxy(W / 2 - 60, H / 2, s);if (sc > highScore) {highScore = sc;}sprintf(s, "HIGH SCORE: %d", highScore);outtextxy(W / 2 - 60, H / 2 + 30, s);setcolor(WHITE);settextstyle(16, 0, "Consolas");outtextxy(W / 2 - 70, H / 2 + 70, "Returning to menu...");outtextxy(W / 2 - 70, H / 2 + 110, "Achievements Unlocked:");int achCount = 0;for (const auto& ach : achievements) {if (ach.unlocked) {outtextxy(W / 2 - 70, H / 2 + 130 + achCount * 20, ach.name);achCount++;if (achCount >= 3) break;}}}void GameDraw() {BeginBatchDraw();cleardevice();setfillcolor(BLACK);bar(0, 0, W, H);DrawCity();DrawEnemies();DrawBullets();DrawPowerUps();DrawExplosions();DrawPlayer();if (laserActive) {setcolor(RGB(0, 255, 255));setlinestyle(PS_SOLID, 3);for (int i = 0; i < MAX_ENEMIES; i++) {if (e[i].live) {int px = p.x + 10 + screenShakeOffsetX;int py = p.y - 5 + screenShakeOffsetY;int ex = e[i].x + e[i].width / 2 + screenShakeOffsetX;int ey = e[i].y + e[i].height / 2 + screenShakeOffsetY;line(px, py, ex, ey);}}setlinestyle(PS_SOLID, 1);}setcolor(WHITE);settextstyle(16, 0, "Consolas");char s[30];sprintf(s, "score : %d", sc);outtextxy(10 + screenShakeOffsetX, 10 + screenShakeOffsetY, s);sprintf(s, "level : %d", lv);outtextxy(10 + screenShakeOffsetX, 30 + screenShakeOffsetY, s);sprintf(s, "attack: %.1f", shanghai);outtextxy(10 + screenShakeOffsetX, 50 + screenShakeOffsetY, s);sprintf(s, "HP: %d/%d", p.hp, p.maxHp);outtextxy(10 + screenShakeOffsetX, 70 + screenShakeOffsetY, s);if (combo > 1) {setcolor(YELLOW);settextstyle(20, 0, "Arial");sprintf(s, "%dx COMBO!", combo);int flashIntensity = (GetTickCount() / 100) % 2;if (flashIntensity) {outtextxy(W / 2 - textwidth(s) / 2 + screenShakeOffsetX, 10 + screenShakeOffsetY, s);}settextstyle(16, 0, "Consolas");setcolor(WHITE);}if (bossWarningTimer > 0) {setcolor(RED);settextstyle(24, 0, "Arial");int flashIntensity = (GetTickCount() / 100) % 2;if (flashIntensity) {outtextxy(W / 2 - textwidth(bossWarningText) / 2 + screenShakeOffsetX, H / 4 + screenShakeOffsetY, bossWarningText);}settextstyle(16, 0, "Consolas");setcolor(WHITE);}setcolor(WHITE);outtextxy(10 + screenShakeOffsetX, 90 + screenShakeOffsetY, "Skills:");setfillcolor(BLUE);int bombWidth = (int)((100.0 * skills.bombEnergy) / 100.0);bar(10 + screenShakeOffsetX, 110 + screenShakeOffsetY, 10 + bombWidth + screenShakeOffsetX, 120 + screenShakeOffsetY);setcolor(WHITE);rectangle(10 + screenShakeOffsetX, 110 + screenShakeOffsetY, 110 + screenShakeOffsetX, 120 + screenShakeOffsetY);outtextxy(115 + screenShakeOffsetX, 110 + screenShakeOffsetY, "Bomb(F)");setfillcolor(GREEN);int laserWidth = (int)((100.0 * skills.laserEnergy) / 100.0);bar(10 + screenShakeOffsetX, 130 + screenShakeOffsetY, 10 + laserWidth + screenShakeOffsetX, 140 + screenShakeOffsetY);setcolor(WHITE);rectangle(10 + screenShakeOffsetX, 130 + screenShakeOffsetY, 110 + screenShakeOffsetX, 140 + screenShakeOffsetY);outtextxy(115 + screenShakeOffsetX, 130 + screenShakeOffsetY, "Laser(Z)");setfillcolor(RED);int rageWidth = (int)((100.0 * skills.rageEnergy) / 100.0);bar(10 + screenShakeOffsetX, 150 + screenShakeOffsetY, 10 + rageWidth + screenShakeOffsetX, 160 + screenShakeOffsetY);setcolor(WHITE);rectangle(10 + screenShakeOffsetX, 150 + screenShakeOffsetY, 110 + screenShakeOffsetX, 160 + screenShakeOffsetY);outtextxy(115 + screenShakeOffsetX, 150 + screenShakeOffsetY, "Rage(X)");setfillcolor(RGB(0, 255, 255));int homingWidth = (int)((100.0 * skills.homingMissileEnergy) / 100.0);bar(10 + screenShakeOffsetX, 170 + screenShakeOffsetY, 10 + homingWidth + screenShakeOffsetX, 180 + screenShakeOffsetY);setcolor(WHITE);rectangle(10 + screenShakeOffsetX, 170 + screenShakeOffsetY, 110 + screenShakeOffsetX, 180 + screenShakeOffsetY);outtextxy(115 + screenShakeOffsetX, 170 + screenShakeOffsetY, "Homing(H)");setfillcolor(RGB(255, 255, 0));int spreadWidth = (int)((100.0 * skills.spreadShotEnergy) / 100.0);bar(10 + screenShakeOffsetX, 190 + screenShakeOffsetY, 10 + spreadWidth + screenShakeOffsetX, 200 + screenShakeOffsetY);setcolor(WHITE);rectangle(10 + screenShakeOffsetX, 190 + screenShakeOffsetY, 110 + screenShakeOffsetX, 200 + screenShakeOffsetY);outtextxy(115 + screenShakeOffsetX, 190 + screenShakeOffsetY, "Spread(G)");if (skills.rageActive) {setcolor(YELLOW);settextstyle(14, 0, "Arial");outtextxy(W / 2 - 50 + screenShakeOffsetX, H - 30 + screenShakeOffsetY, "RAGE MODE!");settextstyle(16, 0, "Consolas");setcolor(WHITE);}if (bombShockwaveActive) {int currentRadius = (shockwaveRadius * shockwaveAge) / BOMB_SHOCKWAVE_LIFETIME;int waveThickness = 10 - (shockwaveAge * 10 / BOMB_SHOCKWAVE_LIFETIME);if (waveThickness < 1) waveThickness = 1;setcolor(WHITE);setlinestyle(PS_SOLID, waveThickness);circle(shockwaveCenterX + screenShakeOffsetX, shockwaveCenterY + screenShakeOffsetY, currentRadius);setlinestyle(PS_SOLID, 1);}if (gs == OVER) {DrawGameOver();} else if (gs == PAUSE) {setcolor(WHITE);settextstyle(30, 0, "Arial");outtextxy(W / 2 - 60 + screenShakeOffsetX, H / 2 + screenShakeOffsetY, "PAUSED");settextstyle(16, 0, "Consolas");outtextxy(W / 2 - 80 + screenShakeOffsetX, H / 2 + 40 + screenShakeOffsetY, "Press P to resume");}EndBatchDraw();}bool Hit(int x1, int y1, int w1, int h1, int x2, int y2, int w2, int h2) {return x1 < x2 + w2 && x1 + w1 > x2 && y1 < y2 + h2 && y1 + h1 > y2;}void TriggerScreenShake(int duration, int intensity) {screenShakeTimer = duration;screenShakeOffsetX = (rand() % (intensity * 2 + 1)) - intensity;screenShakeOffsetY = (rand() % (intensity * 2 + 1)) - intensity;}void UseSkill(int skill) {if (skill == SKILL_BOMB && skills.bombEnergy >= 100.0) {bombShockwaveActive = true;shockwaveCenterX = p.x + 10;shockwaveCenterY = p.y + 15;shockwaveRadius = BOMB_SHOCKWAVE_MAX_RADIUS;shockwaveAge = 0;CreateBombWaveParticles(shockwaveCenterX, shockwaveCenterY, 50);TriggerScreenShake(SCREEN_SHAKE_DURATION, 3);skills.bombEnergy = 0.0;} else if (skill == SKILL_LASER && skills.laserEnergy >= 100.0) {laserActive = true;laserTimer = LASER_DURATION_FRAMES;skills.laserEnergy = 0.0;} else if (skill == SKILL_RAGE && skills.rageEnergy >= 100.0 && !skills.rageActive) {skills.rageActive = true;skills.rageTimer = 600;shanghai += 10.0;skills.rageEnergy = 0.0;} else if (skill == SKILL_HOMING_MISSILE && skills.homingMissileEnergy >= 100.0) {int missilesFired = 0;for (int i = 0; i < MAX_BULLETS && missilesFired < 5; i++) {if (!b[i].live) {b[i].x = p.x + 8;b[i].y = p.y;b[i].live = true;b[i].shooterType = 0;b[i].direction = 0;b[i].type = BULLET_HOMING;b[i].targetEnemyIndex = -1;b[i].angle = -M_PI / 2;double minDist = DBL_MAX;int closestEnemyIdx = -1;for (int j = 0; j < MAX_ENEMIES; j++) {if (e[j].live) {double dist = sqrt(pow(b[i].x - (e[j].x + e[j].width / 2), 2) + pow(b[i].y - (e[j].y + e[j].height / 2), 2));if (dist < minDist) {minDist = dist;closestEnemyIdx = j;}}}b[i].targetEnemyIndex = closestEnemyIdx;missilesFired++;}}skills.homingMissileEnergy = 0.0;} else if (skill == SKILL_SPREAD_SHOT && skills.spreadShotEnergy >= 100.0) {int centerBulletIdx = -1;for (int i = 0; i < MAX_BULLETS; i++) {if (!b[i].live) {centerBulletIdx = i;b[i].x = p.x + 8;b[i].y = p.y;b[i].live = true;b[i].shooterType = 0;b[i].direction = 0;b[i].type = BULLET_SPREAD;b[i].targetEnemyIndex = -1;b[i].angle = -M_PI / 2;break;}}if (centerBulletIdx != -1) {int shotsPerSide = NUM_SPREAD_SHOTS / 2;for (int side = -shotsPerSide; side <= shotsPerSide; side++) {if (side == 0) continue;for (int i = 0; i < MAX_BULLETS; i++) {if (!b[i].live) {b[i].x = p.x + 8;b[i].y = p.y;b[i].live = true;b[i].shooterType = 0;b[i].direction = 0;b[i].type = BULLET_SPREAD;b[i].targetEnemyIndex = -1;b[i].angle = -M_PI / 2 + (side * SPREAD_SHOT_ANGLE_INCREMENT * M_PI / 180.0);break;}}}}skills.spreadShotEnergy = 0.0;}}void Update() {if (GetAsyncKeyState(VK_LEFT) & 0x8000 && p.x > 5) p.x -= 5;if (GetAsyncKeyState(VK_RIGHT) & 0x8000 && p.x < W - 25) p.x += 5;if (GetAsyncKeyState(VK_UP) & 0x8000 && p.y > 5) p.y -= 5;if (GetAsyncKeyState(VK_DOWN) & 0x8000 && p.y < H - 30) p.y += 5;static bool pPressedLastFrame = false;bool pCurrentState = (GetAsyncKeyState('P') & 0x8000) != 0;if (pCurrentState && !pPressedLastFrame) {if (gs == PLAY) {gs = PAUSE;} else if (gs == PAUSE) {gs = PLAY;}}pPressedLastFrame = pCurrentState;if (gs == PLAY) {static bool fPressedLastFrame = false;static bool zPressedLastFrame = false;static bool xPressedLastFrame = false;static bool hPressedLastFrame = false;static bool gPressedLastFrame = false;bool fCurrentState = (GetAsyncKeyState('F') & 0x8000) != 0;bool zCurrentState = (GetAsyncKeyState('Z') & 0x8000) != 0;bool xCurrentState = (GetAsyncKeyState('X') & 0x8000) != 0;bool hCurrentState = (GetAsyncKeyState('H') & 0x8000) != 0;bool gCurrentState = (GetAsyncKeyState('G') & 0x8000) != 0;if (fCurrentState && !fPressedLastFrame && skills.bombEnergy >= 100.0 && !bombShockwaveActive) {UseSkill(SKILL_BOMB);}if (zCurrentState && !zPressedLastFrame && skills.laserEnergy >= 100.0 && !laserActive) {UseSkill(SKILL_LASER);}if (xCurrentState && !xPressedLastFrame && skills.rageEnergy >= 100.0 && !skills.rageActive) {UseSkill(SKILL_RAGE);}if (hCurrentState && !hPressedLastFrame && skills.homingMissileEnergy >= 100.0) {UseSkill(SKILL_HOMING_MISSILE);}if (gCurrentState && !gPressedLastFrame && skills.spreadShotEnergy >= 100.0) {UseSkill(SKILL_SPREAD_SHOT);}fPressedLastFrame = fCurrentState;zPressedLastFrame = zCurrentState;xPressedLastFrame = xCurrentState;hPressedLastFrame = hCurrentState;gPressedLastFrame = gCurrentState;}static DWORD lastShotTime = 0;if ((GetAsyncKeyState(VK_SPACE) & 0x8000) && GetTickCount() - lastShotTime > 150 && !laserActive && !bombShockwaveActive) {for (int i = 0; i < MAX_BULLETS; i++) {if (!b[i].live) {b[i].x = p.x + 8;b[i].y = p.y;b[i].live = true;b[i].shooterType = 0;b[i].direction = 0;b[i].type = BULLET_NORMAL;b[i].targetEnemyIndex = -1;b[i].angle = -M_PI / 2;break;}}lastShotTime = GetTickCount();}if (laserActive) {for (int i = 0; i < MAX_ENEMIES; i++) {if (e[i].live) {e[i].hp -= (int)(shanghai * 3.0);if (e[i].hp <= 0) {sc += 5 * lv * e[i].initialHp;combo++;comboTimer = COMBO_TIMEOUT_FRAMES;CreateExplosion(e[i].x + e[i].width / 2, e[i].y + e[i].height / 2);e[i].live = false;}}}laserTimer--;if (laserTimer <= 0) {laserActive = false;}}if (bombShockwaveActive) {shockwaveAge++;if (shockwaveAge >= BOMB_SHOCKWAVE_LIFETIME) {bombShockwaveActive = false;for (int id : enemiesHitByBomb) {if (e[id].live) {sc += 5 * lv * e[id].initialHp;combo++;comboTimer = COMBO_TIMEOUT_FRAMES;CreateExplosion(e[id].x + e[id].width / 2, e[id].y + e[id].height / 2);skills.bombEnergy += 10.0;skills.laserEnergy += 8.0;skills.rageEnergy += 5.0;if (skills.bombEnergy > 100.0) skills.bombEnergy = 100.0;if (skills.laserEnergy > 100.0) skills.laserEnergy = 100.0;if (skills.rageEnergy > 100.0) skills.rageEnergy = 100.0;e[id].live = false;if (e[id].type == ENEMY_BOSS) {achievements[2].unlocked = achievements[2].checkCondition();}}}enemiesHitByBomb.clear();} else {int currentRadius = (shockwaveRadius * shockwaveAge) / BOMB_SHOCKWAVE_LIFETIME;for (int i = 0; i < MAX_ENEMIES; i++) {if (e[i].live) {int dx = (e[i].x + e[i].width / 2) - shockwaveCenterX;int dy = (e[i].y + e[i].height / 2) - shockwaveCenterY;double distance = sqrt(dx * dx + dy * dy);if (distance <= currentRadius) {bool alreadyRecorded = false;for (int recordedId : enemiesHitByBomb) {if (recordedId == i) {alreadyRecorded = true;break;}}if (!alreadyRecorded) {enemiesHitByBomb.push_back(i);CreateExplosion(e[i].x + e[i].width / 2, e[i].y + e[i].height / 2);}}}}}}if (screenShakeTimer > 0) {screenShakeTimer--;if (screenShakeTimer > 0) {screenShakeOffsetX = (rand() % 7) - 3;screenShakeOffsetY = (rand() % 7) - 3;} else {screenShakeOffsetX = 0;screenShakeOffsetY = 0;}}if (comboTimer > 0) {comboTimer--;} else {if (combo > 1) {combo = 0;}}if (bossWarningTimer > 0) {bossWarningTimer--;}for (int i = 0; i < MAX_BULLETS; i++) {if (b[i].live) {if (b[i].type == BULLET_HOMING) {if (b[i].targetEnemyIndex != -1 && e[b[i].targetEnemyIndex].live) {int targetX = e[b[i].targetEnemyIndex].x + e[b[i].targetEnemyIndex].width / 2;int targetY = e[b[i].targetEnemyIndex].y + e[b[i].targetEnemyIndex].height / 2;double targetAngle = atan2(targetY - b[i].y, targetX - b[i].x);double angleDiff = targetAngle - b[i].angle;while (angleDiff > M_PI) angleDiff -= 2 * M_PI;while (angleDiff < -M_PI) angleDiff += 2 * M_PI;double maxTurn = 0.1;if (angleDiff > maxTurn) angleDiff = maxTurn;if (angleDiff < -maxTurn) angleDiff = -maxTurn;b[i].angle += angleDiff;}b[i].x += cos(b[i].angle) * HOMING_MISSILE_SPEED;b[i].y += sin(b[i].angle) * HOMING_MISSILE_SPEED;if (b[i].x < -10 || b[i].x > W + 10 || b[i].y < -10 || b[i].y > H + 10) {b[i].live = false;}} else if (b[i].type == BULLET_SPREAD) {b[i].x += cos(b[i].angle) * 8;b[i].y += sin(b[i].angle) * 8;if (b[i].x < -10 || b[i].x > W + 10 || b[i].y < -10 || b[i].y > H + 10) {b[i].live = false;}} else {if (b[i].direction == 0) {b[i].y -= 8;} else {b[i].y += 8;}if (b[i].y < -10 || b[i].y > H + 10) b[i].live = false;}}}const int ENEMY_SPAWN_RATE = 60;if (ec++ % ENEMY_SPAWN_RATE == 0) {for (int i = 0; i < MAX_ENEMIES; i++) {if (!e[i].live) {if (lv >= BOSS_LEVEL && !bossSpawnedThisLevel) {e[i].x = W / 2 - 50;e[i].y = -60;e[i].live = true;e[i].type = ENEMY_BOSS;e[i].hp = 200 + lv * 30;e[i].initialHp = e[i].hp;e[i].width = 100;e[i].height = 60;e[i].laserTimer = 0;e[i].isFiringLaser = false;e[i].targetX = rand() % (W - e[i].width);e[i].shootTimer = 0;bossSpawnedThisLevel = true;strcpy(bossWarningText, "BOSS APPEARS!");bossWarningTimer = 120;break;} else {e[i].x = rand() % (W - 30);e[i].y = -30;e[i].live = true;e[i].type = ENEMY_NORMAL;e[i].hp = rand() % 11 + 20 + lv;e[i].initialHp = e[i].hp;e[i].width = 30;e[i].height = 30;e[i].laserTimer = 0;e[i].isFiringLaser = false;e[i].targetX = 0;e[i].shootTimer = 0;break;}}}}if (bossSpawnedThisLevel) {for (int i = 0; i < MAX_ENEMIES; i++) {if (e[i].live && e[i].type == ENEMY_BOSS) {if (abs(e[i].x - e[i].targetX) < 2) {e[i].targetX = rand() % (W - e[i].width);} else {if (e[i].x < e[i].targetX) {e[i].x += 1;} else if (e[i].x > e[i].targetX) {e[i].x -= 1;}}e[i].y = 50;e[i].laserTimer++;if (e[i].laserTimer > BOSS_ATTACK_INTERVAL_FRAMES && !e[i].isFiringLaser) {e[i].isFiringLaser = true;e[i].laserTimer = 0;if (screenShakeTimer <= 0) {TriggerScreenShake(5, 1);}}if (e[i].isFiringLaser) {e[i].laserTimer++;if (e[i].laserTimer >= BOSS_LASER_DURATION_FRAMES) {e[i].isFiringLaser = false;}}break;}}}for (int i = 0; i < MAX_ENEMIES; i++) {if (e[i].live && e[i].type == ENEMY_NORMAL) {e[i].shootTimer++;if (e[i].shootTimer > ENEMY_SHOOT_INTERVAL_FRAMES) {e[i].shootTimer = 0;for (int j = 0; j < MAX_BULLETS; j++) {if (!b[j].live) {b[j].x = e[i].x + e[i].width / 2 - 2;b[j].y = e[i].y + e[i].height;b[j].live = true;b[j].shooterType = 1;b[j].direction = 1;b[j].type = BULLET_NORMAL;b[j].targetEnemyIndex = -1;b[j].angle = M_PI / 2;break;}}}}}for (int i = 0; i < MAX_ENEMIES; i++) {if (e[i].live) {if (e[i].type == ENEMY_BOSS) {} else {e[i].y += 2;}if (e[i].y > H) e[i].live = false;}}for (int i = 0; i < MAX_ENEMIES; i++) {if (e[i].live && e[i].type == ENEMY_BOSS && e[i].isFiringLaser) {int laserLeft = e[i].x + 5;int laserRight = e[i].x + e[i].width - 5;int laserTop = e[i].y + e[i].height;int playerCenterX = p.x + 10;int playerCenterY = p.y + 15;if (playerCenterX >= laserLeft && playerCenterX <= laserRight && playerCenterY >= laserTop) {p.hp -= 1;CreateBleedingParticles(p.x + 10, p.y + 15, 2);if (p.hp <= 0) {CreateExplosion(p.x + 10, p.y + 15);Sleep(1000);gs = OVER;gameOverTime = GetTickCount();}}}}if (!laserActive && !bombShockwaveActive) {for (int i = 0; i < MAX_BULLETS; i++) {if (b[i].live && b[i].shooterType == 0) {for (int j = 0; j < MAX_ENEMIES; j++) {if (e[j].live && Hit(b[i].x, b[i].y, 4, 10, e[j].x, e[j].y, e[j].width, e[j].height)) {b[i].live = false;e[j].hp -= (int)shanghai;if (e[j].hp > 0) {CreateBleedingParticles(e[j].x + e[j].width / 2, e[j].y + e[j].height / 2, 3);}if (e[j].hp <= 0) {e[j].live = false;sc += 5 * lv * e[j].initialHp;combo++;comboTimer = COMBO_TIMEOUT_FRAMES;skills.bombEnergy += 10.0;skills.laserEnergy += 8.0;skills.rageEnergy += 5.0;skills.homingMissileEnergy += 10.0;skills.spreadShotEnergy += 10.0;if (skills.bombEnergy > 100.0) skills.bombEnergy = 100.0;if (skills.laserEnergy > 100.0) skills.laserEnergy = 100.0;if (skills.rageEnergy > 100.0) skills.rageEnergy = 100.0;if (skills.homingMissileEnergy > 100.0) skills.homingMissileEnergy = 100.0;if (skills.spreadShotEnergy > 100.0) skills.spreadShotEnergy = 100.0;CreateExplosion(e[j].x + e[j].width / 2, e[j].y + e[j].height / 2);if (sc >= lv * 150) {lv++;shanghai += 1;shanghai = min(lv / 2 + 1, (int)shanghai);}achievements[0].unlocked = achievements[0].checkCondition();achievements[1].unlocked = achievements[1].checkCondition();if (e[j].type == ENEMY_BOSS) {achievements[2].unlocked = achievements[2].checkCondition();}}break;}}}}}if (!bombShockwaveActive) {for (int i = 0; i < MAX_BULLETS; i++) {if (b[i].live && (b[i].shooterType == 1 || b[i].shooterType == 2) && b[i].direction == 1) {if (Hit(p.x, p.y, 20, 30, b[i].x, b[i].y, 4, 10)) {b[i].live = false;p.hp -= 1;CreateBleedingParticles(p.x + 10, p.y + 15, 10);if (screenShakeTimer <= 0) {TriggerScreenShake(5, 1);}if (p.hp <= 0) {CreateExplosion(p.x + 10, p.y + 15);Sleep(1000);gs = OVER;gameOverTime = GetTickCount();}}}}}if (!bombShockwaveActive) {for (int i = 0; i < MAX_ENEMIES; i++) {if (e[i].live && Hit(p.x, p.y, 20, 30, e[i].x, e[i].y, e[i].width, e[i].height)) {e[i].live = false;p.hp -= 1;CreateBleedingParticles(p.x + 10, p.y + 15, 10);if (screenShakeTimer <= 0) {TriggerScreenShake(5, 1);}if (p.hp <= 0) {CreateExplosion(p.x + 10, p.y + 15);Sleep(1000);gs = OVER;gameOverTime = GetTickCount();}}}}if (rand() % 100 == 0) {for (int i = 0; i < MAX_POWERUPS; i++) {if (!pu[i].live) {pu[i].x = rand() % (W - 12) + 6;pu[i].y = -10;pu[i].live = true;pu[i].type = rand() % 3;break;}}}for (int i = 0; i < MAX_POWERUPS; i++) {if (pu[i].live) {pu[i].y += 3;if (pu[i].y > H + 10) pu[i].live = false;if (Hit(p.x, p.y, 20, 30, pu[i].x - 6, pu[i].y - 6, 12, 12)) {switch (pu[i].type) {case POWERUP_ATTACK:shanghai *= 1.05;break;case POWERUP_HP:p.hp += 2;if (p.hp > p.maxHp) p.hp = p.maxHp;break;case POWERUP_BOMB:skills.bombEnergy += 30.0;if (skills.bombEnergy > 100.0) skills.bombEnergy = 100.0;break;}pu[i].live = false;}}}if (skills.rageActive) {skills.rageTimer--;if (skills.rageTimer <= 0) {skills.rageActive = false;shanghai -= 10.0;}}if (gs == PLAY && !bombShockwaveActive) {if (rand() % 2 == 0) {CreateJetTrail(p.x + 5, p.y + 30, 1);}if (rand() % 2 == 0) {CreateJetTrail(p.x + 15, p.y + 30, 1);}for (int i = 0; i < MAX_ENEMIES; i++) {if (e[i].live && e[i].type != ENEMY_BOSS && rand() % 3 == 0) {CreateJetTrail(e[i].x + e[i].width / 4, e[i].y, 1);}if (e[i].live && e[i].type != ENEMY_BOSS && rand() % 3 == 0) {CreateJetTrail(e[i].x + 3 * e[i].width / 4, e[i].y, 1);}}}UpdateExplosions();}int main() {initgraph(W, H);DWORD lastTime = GetTickCount();while (true) {DWORD currentTime = GetTickCount();if (currentTime - lastTime >= MS_PER_FRAME) {if (gs == START) {if (GetAsyncKeyState(VK_SPACE) & 0x8000) {gs = PLAY;InitGame();}} else if (gs == OVER) {if (currentTime - gameOverTime >= 2000) {gs = START;}} else if (gs == PAUSE) {if (GetAsyncKeyState(VK_ESCAPE) & 0x8000) {break;}} else {if (GetAsyncKeyState(VK_ESCAPE) & 0x8000) {break;}}switch (gs) {case START:DrawStart();break;case PLAY:Update();GameDraw();break;case OVER:GameDraw();break;case PAUSE:GameDraw();break;}lastTime = currentTime;}Sleep(1);}closegraph();return 0;}```::::如果有建议请在评论区给出20 行未改动21222324252627282953 行未改动838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615730 行未改动188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156420 行未改动+ 激光 (Z键):发射一道贯穿屏幕的激光,持续对敌人造成伤害。+ 狂暴模式 (X键):短时间内大幅提升攻击力,并进入狂暴状态。+ 追踪导弹 (H键):发射 1 枚自动追踪敌人的导弹。+ 散射子弹 (G键):发射扇形扩散的子弹,覆盖更大范围。+ 动态难度与成长系统:随着得分增加,游戏等级提升,敌人变得更强大,同时玩家的基础攻击力也会增长。击杀敌人会获得技能能量,用于释放技能。53 行未改动enum { ENEMY_NORMAL, ENEMY_BOSS };enum { BULLET_NORMAL, BULLET_HOMING, BULLET_SPREAD };struct Bullet {int x, y;bool live;int shooterType;int direction;int type;int targetEnemyIndex;double angle;};struct Enemy {int x, y;bool live;int hp;int initialHp;int type;int width, height;int laserTimer;bool isFiringLaser;int targetX;int shootTimer;};struct Plane {int x, y;int hp;int maxHp;};struct PowerUp {int x, y;bool live;int type;};struct Explosion {int x, y;bool active;int frame;int maxFrame;};struct Particle {int x, y;double vx, vy;int life;int color;bool active;int type;double size;};struct SkillSystem {double bombEnergy;double laserEnergy;double rageEnergy;double homingMissileEnergy;double spreadShotEnergy;bool rageActive;int rageTimer;double originalDamage;};struct Achievement {const char* name;const char* desc;bool unlocked;function<bool()> checkCondition;};Plane p;Bullet b[MAX_BULLETS];30 行未改动char bossWarningText[100] = "";int bossWarningTimer = 0;vector<Achievement> achievements = {{"First Blood","Kill your first enemy",false,[]() {return sc >= 5;}},{"Combo Master","Achieve a 10x combo",false,[]() {return combo >= 10;}},{"Boss Slayer","Defeat a boss",false,[]() {return sc >= 1000;}}};int highScore = 0;vector<int> cityBuildingHeights;void InitGame() {p.x = W / 2 - 10;p.y = H - 80;p.hp = 10;p.maxHp = 10;for (int i = 0; i < MAX_BULLETS; i++) {b[i].live = false;b[i].shooterType = 0;b[i].direction = 0;b[i].type = BULLET_NORMAL;b[i].targetEnemyIndex = -1;b[i].angle = 0.0;}for (int i = 0; i < MAX_ENEMIES; i++) {e[i].live = false;e[i].type = ENEMY_NORMAL;e[i].width = 30;e[i].height = 30;e[i].laserTimer = 0;e[i].isFiringLaser = false;e[i].targetX = 0;e[i].shootTimer = 0;}for (int i = 0; i < MAX_POWERUPS; i++) pu[i].live = false;for (int i = 0; i < MAX_EXPLOSIONS; i++) pxe[i].active = false;for (int i = 0; i < MAX_PARTICLES; i++) {particles[i].active = false;particles[i].type = PARTICLE_EXPLOSION;particles[i].size = 2.0;}skills.bombEnergy = 0.0;skills.laserEnergy = 0.0;skills.rageEnergy = 0.0;skills.homingMissileEnergy = 0.0;skills.spreadShotEnergy = 0.0;skills.rageActive = false;skills.rageTimer = 0;skills.originalDamage = shanghai;laserActive = false;laserTimer = 0;bombShockwaveActive = false;shockwaveRadius = 0;shockwaveAge = 0;screenShakeTimer = 0;screenShakeOffsetX = 0;screenShakeOffsetY = 0;combo = 0;comboTimer = 0;lastKillTime = 0;bossSpawnedThisLevel = false;bossAttackPattern = 0;bossAttackTimer = 0;strcpy(bossWarningText, "");bossWarningTimer = 0;bc = ec = sc = lv = 1;srand((unsigned int)time(NULL));cityBuildingHeights.clear();int numBuildings = W / CITY_BUILDING_WIDTH;for (int i = 0; i < numBuildings; i++) {cityBuildingHeights.push_back(rand() % (CITY_BUILDING_HEIGHT_MAX - CITY_BUILDING_HEIGHT_MIN + 1) + CITY_BUILDING_HEIGHT_MIN);}}void DrawStart() {cleardevice();setfillcolor(BLACK);bar(0, 0, W, H);setcolor(YELLOW);settextstyle(30, 0, "Arial");outtextxy(W / 2 - 100, H / 3, "Aircraft Battle");setcolor(WHITE);settextstyle(16, 0, "Consolas");outtextxy(W / 2 - 60, H / 2, "Press SPACE to start");outtextxy(W / 2 - 60, H / 2 + 30, "Arrow keys: move");outtextxy(W / 2 - 60, H / 2 + 60, "SPACE: shoot");outtextxy(W / 2 - 60, H / 2 + 90, "F: use BOMB");outtextxy(W / 2 - 60, H / 2 + 120, "Z: use LASER");outtextxy(W / 2 - 60, H / 2 + 150, "X: use RAGE (10s +5 damage)");outtextxy(W / 2 - 60, H / 2 + 180, "H: use HOMING MISSILE (5 missiles)");outtextxy(W / 2 - 60, H / 2 + 210, "G: use SPREAD SHOT (7 bullets)");outtextxy(W / 2 - 60, H / 2 + 240, "P: pause");outtextxy(W / 2 - 60, H / 2 + 270, "ESC: quit");char hsStr[50];sprintf(hsStr, "High Score: %d", highScore);outtextxy(W / 2 - 60, H / 2 + 300, hsStr);}void DrawCity() {int offset_y = screenShakeOffsetY;setfillcolor(RGB(30, 30, 50));bar(0, H + offset_y, W, H + 20 + offset_y);setfillcolor(RGB(40, 40, 60));for (int i = 0; i < cityBuildingHeights.size(); i++) {int buildingX = i * CITY_BUILDING_WIDTH;int buildingHeight = cityBuildingHeights[i];bar(buildingX, H - buildingHeight + offset_y, buildingX + CITY_BUILDING_WIDTH, H + offset_y);}}void DrawPlayer() {int offset_x = screenShakeOffsetX;int offset_y = screenShakeOffsetY;int drawX = p.x + offset_x;int drawY = p.y + offset_y;POINT playerBody[] = {{drawX + 10, drawY},{drawX, drawY + 30},{drawX + 20, drawY + 30}};setfillcolor(RGB(30, 144, 255));fillpolygon(playerBody, 3);POINT core[] = {{drawX + 10, drawY + 5},{drawX + 5, drawY + 25},{drawX + 15, drawY + 25}};setfillcolor(WHITE);fillpolygon(core, 3);POINT leftWing[] = {{drawX - 10, drawY + 15},{drawX, drawY + 8},{drawX + 5, drawY + 15},{drawX, drawY + 23}};setfillcolor(RGB(100, 149, 237));fillpolygon(leftWing, 4);POINT rightWing[] = {{drawX + 20 + 10, drawY + 15},{drawX + 20, drawY + 8},{drawX + 20 - 5, drawY + 15},{drawX + 20, drawY + 23}};fillpolygon(rightWing, 4);setfillcolor(RED);bar(drawX + 3, drawY - 5, drawX + 6, drawY);bar(drawX + 14, drawY - 5, drawX + 17, drawY);bar(drawX + 8, drawY - 8, drawX + 12, drawY - 2);setfillcolor(YELLOW);fillcircle(drawX + 10, drawY + 10, 3);if (p.hp > 0) {setfillcolor(GREEN);int w = (int)((20.0 * p.hp) / 10);bar(drawX, drawY + 32, drawX + w, drawY + 36);setcolor(WHITE);rectangle(drawX, drawY + 32, drawX + 20, drawY + 36);}}void DrawBullets() {int offset_x = screenShakeOffsetX;int offset_y = screenShakeOffsetY;for (int i = 0; i < MAX_BULLETS; i++) {if (b[i].live) {if (b[i].shooterType == 0) {if (b[i].type == BULLET_NORMAL) {setfillcolor(BLUE);} else if (b[i].type == BULLET_HOMING) {setfillcolor(RGB(0, 255, 255));} else if (b[i].type == BULLET_SPREAD) {setfillcolor(RGB(255, 255, 0));}} else if (b[i].shooterType == 1) {setfillcolor(RED);} else {setfillcolor(YELLOW);}if (b[i].type == BULLET_HOMING) {POINT missile[] = {{b[i].x + offset_x, b[i].y - 3 + offset_y},{b[i].x - 3 + offset_x, b[i].y + offset_y},{b[i].x + offset_x, b[i].y + 3 + offset_y},{b[i].x + 3 + offset_x, b[i].y + offset_y}};fillpolygon(missile, 4);} else {bar(b[i].x + offset_x, b[i].y + offset_y, b[i].x + 4 + offset_x, b[i].y + 10 + offset_y);}}}}void DrawEnemies() {int offset_x = screenShakeOffsetX;int offset_y = screenShakeOffsetY;for (int i = 0; i < MAX_ENEMIES; i++) {if (e[i].live) {int drawX = e[i].x + offset_x;int drawY = e[i].y + offset_y;if (e[i].type == ENEMY_BOSS) {POINT bossBody[] = {{drawX + e[i].width / 2, drawY + e[i].height},{drawX, drawY},{drawX + e[i].width, drawY}};setfillcolor(RGB(40, 40, 40));fillpolygon(bossBody, 3);POINT core[] = {{drawX + e[i].width / 2, drawY + e[i].height - 5},{drawX + e[i].width / 4, drawY + 5},{drawX + 3 * e[i].width / 4, drawY + 5}};setfillcolor(RGB(139, 0, 0));fillpolygon(core, 3);POINT leftWing[] = {{drawX - 15, drawY + 3 * e[i].height / 4},{drawX, drawY + e[i].height / 2},{drawX - 10, drawY + e[i].height / 4},{drawX - 20, drawY + e[i].height / 2}};setfillcolor(RGB(60, 60, 60));fillpolygon(leftWing, 4);POINT rightWing[] = {{drawX + e[i].width + 15, drawY + 3 * e[i].height / 4},{drawX + e[i].width, drawY + e[i].height / 2},{drawX + e[i].width + 10, drawY + e[i].height / 4},{drawX + e[i].width + 20, drawY + e[i].height / 2}};fillpolygon(rightWing, 4);setfillcolor(RGB(0, 191, 255));bar(drawX + e[i].width / 2 - 2, drawY + 5, drawX + e[i].width / 2 + 2, drawY + e[i].height - 5);setfillcolor(RED);bar(drawX + 5, drawY + e[i].height, drawX + 15, drawY + e[i].height + 10);bar(drawX + e[i].width - 15, drawY + e[i].height, drawX + e[i].width - 5, drawY + e[i].height + 10);bar(drawX + e[i].width / 2 - 5, drawY + e[i].height, drawX + e[i].width / 2 + 5, drawY + e[i].height + 10);setfillcolor(BLACK);bar(drawX + e[i].width / 2 - 3, drawY - 5, drawX + e[i].width / 2 + 3, drawY);if (e[i].isFiringLaser) {setcolor(RGB(0, 191, 255));setlinestyle(PS_SOLID, 5);line(drawX + 10, drawY + e[i].height + 10, drawX + 10, H);line(drawX + e[i].width / 2, drawY + e[i].height + 10, drawX + e[i].width / 2, H);line(drawX + e[i].width - 10, drawY + e[i].height + 10, drawX + e[i].width - 10, H);setlinestyle(PS_SOLID, 1);}} else {POINT enemyBody[] = {{drawX + 15, drawY + 30},{drawX, drawY},{drawX + 30, drawY}};setfillcolor(RGB(255, 105, 180));fillpolygon(enemyBody, 3);POINT leftWing[] = {{drawX - 5, drawY + 20},{drawX, drawY + 10},{drawX + 5, drawY + 20},{drawX, drawY + 25}};setfillcolor(RGB(255, 20, 147));fillpolygon(leftWing, 4);POINT rightWing[] = {{drawX + 25, drawY + 20},{drawX + 30, drawY + 10},{drawX + 35, drawY + 20},{drawX + 30, drawY + 25}};fillpolygon(rightWing, 4);setfillcolor(RGB(220, 20, 60));bar(drawX + 13, drawY - 5, drawX + 17, drawY);setfillcolor(RED);bar(drawX + 14, drawY + 30, drawX + 16, drawY + 35);}if (e[i].hp > 0) {if (e[i].type == ENEMY_BOSS) {setfillcolor(RGB(0, 191, 255));} else {setfillcolor(RED);}int w = (int)((static_cast<double>(e[i].width) * e[i].hp) / e[i].initialHp);bar(drawX, drawY - 6, drawX + w, drawY - 2);setcolor(WHITE);rectangle(drawX, drawY - 6, drawX + e[i].width, drawY - 2);}}}}void DrawPowerUps() {int offset_x = screenShakeOffsetX;int offset_y = screenShakeOffsetY;for (int i = 0; i < MAX_POWERUPS; i++) {if (pu[i].live) {switch (pu[i].type) {case POWERUP_ATTACK:setfillcolor(RED);solidcircle(pu[i].x + offset_x, pu[i].y + offset_y, 6);setcolor(YELLOW);settextstyle(10, 0, "Arial");outtextxy(pu[i].x - 3 + offset_x, pu[i].y - 5 + offset_y, "A");break;case POWERUP_HP:setfillcolor(GREEN);solidcircle(pu[i].x + offset_x, pu[i].y + offset_y, 6);setcolor(WHITE);settextstyle(10, 0, "Arial");outtextxy(pu[i].x - 2 + offset_x, pu[i].y - 5 + offset_y, "+");break;case POWERUP_BOMB:setfillcolor(YELLOW);solidcircle(pu[i].x + offset_x, pu[i].y + offset_y, 6);setcolor(WHITE);settextstyle(10, 0, "Arial");outtextxy(pu[i].x - 3 + offset_x, pu[i].y - 5 + offset_y, "B");break;}}}}void DrawExplosions() {int offset_x = screenShakeOffsetX;int offset_y = screenShakeOffsetY;for (int i = 0; i < MAX_PARTICLES; i++) {if (particles[i].active) {int drawX = (int)particles[i].x + offset_x;int drawY = (int)particles[i].y + offset_y;if (particles[i].type == PARTICLE_EXPLOSION) {setfillcolor(particles[i].color);solidcircle(drawX, drawY, (int)particles[i].size);} else if (particles[i].type == PARTICLE_JET_TRAIL) {int gray = 255 - (int)((particles[i].life * 255.0) / 20.0);if (gray < 0) gray = 0;if (gray > 255) gray = 255;setfillcolor(RGB(gray, gray, gray));solidcircle(drawX, drawY, (int)particles[i].size);} else if (particles[i].type == PARTICLE_BLEED) {setfillcolor(RED);solidcircle(drawX, drawY, (int)particles[i].size);} else if (particles[i].type == PARTICLE_BOMB_WAVE) {setfillcolor(RGB(255, 255, 200));solidcircle(drawX, drawY, (int)particles[i].size);}}}for (int i = 0; i < MAX_EXPLOSIONS; i++) {if (pxe[i].active) {int drawX = pxe[i].x + offset_x;int drawY = pxe[i].y + offset_y;setcolor(RGB(255, 100, 0));circle(drawX, drawY, pxe[i].frame);}}}void CreateExplosion(int x, int y) {for (int i = 0; i < MAX_EXPLOSIONS; i++) {if (!pxe[i].active) {pxe[i].x = x;pxe[i].y = y;pxe[i].active = true;pxe[i].frame = 0;pxe[i].maxFrame = 10;break;}}for (int j = 0; j < 20; j++) {int idx = rand() % MAX_PARTICLES;if (!particles[idx].active) {particles[idx].x = x;particles[idx].y = y;particles[idx].vx = (rand() % 11) - 5;particles[idx].vy = (rand() % 11) - 5;particles[idx].life = 20 + rand() % 20;int hue = rand() % 40;particles[idx].color = RGB(255, 150 - (hue * 3), 0);particles[idx].active = true;particles[idx].type = PARTICLE_EXPLOSION;particles[idx].size = 2.0;}}}const double M_PI = 3.14159265358979323846;void CreateBombWaveParticles(int centerX, int centerY, int numParticles) {for (int j = 0; j < numParticles; j++) {int idx = rand() % MAX_PARTICLES;if (!particles[idx].active) {double angle = (rand() % 360) * M_PI / 180.0;double speed = 3.0 + (rand() % 5);particles[idx].x = centerX;particles[idx].y = centerY;particles[idx].vx = cos(angle) * speed;particles[idx].vy = sin(angle) * speed;particles[idx].life = 10 + rand() % 10;particles[idx].color = RGB(255, 255, 200);particles[idx].active = true;particles[idx].type = PARTICLE_BOMB_WAVE;particles[idx].size = 1.0 + (rand() % 3);}}}void CreateJetTrail(int x, int y, int direction) {int idx = rand() % MAX_PARTICLES;if (!particles[idx].active) {particles[idx].x = x + rand() % 6 - 3;particles[idx].y = y + (direction ? 5 : -5);particles[idx].vx = (rand() % 3) - 1;particles[idx].vy = (direction ? 1 : -1) * (rand() % 2 + 1);particles[idx].life = 15 + rand() % 10;particles[idx].color = RGB(200, 200, 200);particles[idx].active = true;particles[idx].type = PARTICLE_JET_TRAIL;particles[idx].size = 1.5;}}void CreateBleedingParticles(int x, int y, int count) {for (int j = 0; j < count; j++) {int idx = rand() % MAX_PARTICLES;if (!particles[idx].active) {particles[idx].x = x + rand() % 20 - 10;particles[idx].y = y + rand() % 20 - 10;particles[idx].vx = (rand() % 5) - 2;particles[idx].vy = (rand() % 5) - 2;particles[idx].life = 10 + rand() % 10;particles[idx].color = RGB(200, 0, 0);particles[idx].active = true;particles[idx].type = PARTICLE_BLEED;particles[idx].size = 1.0 + (rand() % 2);}}}void UpdateExplosions() {for (int i = 0; i < MAX_EXPLOSIONS; i++) {if (pxe[i].active) {pxe[i].frame++;if (pxe[i].frame >= pxe[i].maxFrame) {pxe[i].active = false;}}}for (int i = 0; i < MAX_PARTICLES; i++) {if (particles[i].active) {particles[i].x += particles[i].vx;particles[i].y += particles[i].vy;particles[i].life--;if (particles[i].life <= 0) {particles[i].active = false;}}}}void DrawGameOver() {setfillcolor(BLACK);bar(0, 0, W, H);setcolor(RED);settextstyle(40, 0, "Arial");outtextxy(W / 2 - 80, H / 3, "GAME OVER");setcolor(YELLOW);settextstyle(24, 0, "Arial");char s[50];sprintf(s, "END SCORE: %d", sc);outtextxy(W / 2 - 60, H / 2, s);if (sc > highScore) {highScore = sc;}sprintf(s, "HIGH SCORE: %d", highScore);outtextxy(W / 2 - 60, H / 2 + 30, s);setcolor(WHITE);settextstyle(16, 0, "Consolas");outtextxy(W / 2 - 70, H / 2 + 70, "Returning to menu...");outtextxy(W / 2 - 70, H / 2 + 110, "Achievements Unlocked:");int achCount = 0;for (const auto& ach : achievements) {if (ach.unlocked) {outtextxy(W / 2 - 70, H / 2 + 130 + achCount * 20, ach.name);achCount++;if (achCount >= 3) break;}}}void GameDraw() {BeginBatchDraw();cleardevice();setfillcolor(BLACK);bar(0, 0, W, H);DrawCity();DrawEnemies();DrawBullets();DrawPowerUps();DrawExplosions();DrawPlayer();if (laserActive) {setcolor(RGB(0, 255, 255));setlinestyle(PS_SOLID, 3);for (int i = 0; i < MAX_ENEMIES; i++) {if (e[i].live) {int px = p.x + 10 + screenShakeOffsetX;int py = p.y - 5 + screenShakeOffsetY;int ex = e[i].x + e[i].width / 2 + screenShakeOffsetX;int ey = e[i].y + e[i].height / 2 + screenShakeOffsetY;line(px, py, ex, ey);}}setlinestyle(PS_SOLID, 1);}setcolor(WHITE);settextstyle(16, 0, "Consolas");char s[30];sprintf(s, "score : %d", sc);outtextxy(10 + screenShakeOffsetX, 10 + screenShakeOffsetY, s);sprintf(s, "level : %d", lv);outtextxy(10 + screenShakeOffsetX, 30 + screenShakeOffsetY, s);sprintf(s, "attack: %.1f", shanghai);outtextxy(10 + screenShakeOffsetX, 50 + screenShakeOffsetY, s);sprintf(s, "HP: %d/%d", p.hp, p.maxHp);outtextxy(10 + screenShakeOffsetX, 70 + screenShakeOffsetY, s);if (combo > 1) {setcolor(YELLOW);settextstyle(20, 0, "Arial");sprintf(s, "%dx COMBO!", combo);int flashIntensity = (GetTickCount() / 100) % 2;if (flashIntensity) {outtextxy(W / 2 - textwidth(s) / 2 + screenShakeOffsetX, 10 + screenShakeOffsetY, s);}settextstyle(16, 0, "Consolas");setcolor(WHITE);}if (bossWarningTimer > 0) {setcolor(RED);settextstyle(24, 0, "Arial");int flashIntensity = (GetTickCount() / 100) % 2;if (flashIntensity) {outtextxy(W / 2 - textwidth(bossWarningText) / 2 + screenShakeOffsetX, H / 4 + screenShakeOffsetY, bossWarningText);}settextstyle(16, 0, "Consolas");setcolor(WHITE);}setcolor(WHITE);outtextxy(10 + screenShakeOffsetX, 90 + screenShakeOffsetY, "Skills:");setfillcolor(BLUE);int bombWidth = (int)((100.0 * skills.bombEnergy) / 100.0);bar(10 + screenShakeOffsetX, 110 + screenShakeOffsetY, 10 + bombWidth + screenShakeOffsetX, 120 + screenShakeOffsetY);setcolor(WHITE);rectangle(10 + screenShakeOffsetX, 110 + screenShakeOffsetY, 110 + screenShakeOffsetX, 120 + screenShakeOffsetY);outtextxy(115 + screenShakeOffsetX, 110 + screenShakeOffsetY, "Bomb(F)");setfillcolor(GREEN);int laserWidth = (int)((100.0 * skills.laserEnergy) / 100.0);bar(10 + screenShakeOffsetX, 130 + screenShakeOffsetY, 10 + laserWidth + screenShakeOffsetX, 140 + screenShakeOffsetY);setcolor(WHITE);rectangle(10 + screenShakeOffsetX, 130 + screenShakeOffsetY, 110 + screenShakeOffsetX, 140 + screenShakeOffsetY);outtextxy(115 + screenShakeOffsetX, 130 + screenShakeOffsetY, "Laser(Z)");setfillcolor(RED);int rageWidth = (int)((100.0 * skills.rageEnergy) / 100.0);bar(10 + screenShakeOffsetX, 150 + screenShakeOffsetY, 10 + rageWidth + screenShakeOffsetX, 160 + screenShakeOffsetY);setcolor(WHITE);rectangle(10 + screenShakeOffsetX, 150 + screenShakeOffsetY, 110 + screenShakeOffsetX, 160 + screenShakeOffsetY);outtextxy(115 + screenShakeOffsetX, 150 + screenShakeOffsetY, "Rage(X)");setfillcolor(RGB(0, 255, 255));int homingWidth = (int)((100.0 * skills.homingMissileEnergy) / 100.0);bar(10 + screenShakeOffsetX, 170 + screenShakeOffsetY, 10 + homingWidth + screenShakeOffsetX, 180 + screenShakeOffsetY);setcolor(WHITE);rectangle(10 + screenShakeOffsetX, 170 + screenShakeOffsetY, 110 + screenShakeOffsetX, 180 + screenShakeOffsetY);outtextxy(115 + screenShakeOffsetX, 170 + screenShakeOffsetY, "Homing(H)");setfillcolor(RGB(255, 255, 0));int spreadWidth = (int)((100.0 * skills.spreadShotEnergy) / 100.0);bar(10 + screenShakeOffsetX, 190 + screenShakeOffsetY, 10 + spreadWidth + screenShakeOffsetX, 200 + screenShakeOffsetY);setcolor(WHITE);rectangle(10 + screenShakeOffsetX, 190 + screenShakeOffsetY, 110 + screenShakeOffsetX, 200 + screenShakeOffsetY);outtextxy(115 + screenShakeOffsetX, 190 + screenShakeOffsetY, "Spread(G)");if (skills.rageActive) {setcolor(YELLOW);settextstyle(14, 0, "Arial");outtextxy(W / 2 - 50 + screenShakeOffsetX, H - 30 + screenShakeOffsetY, "RAGE MODE!");settextstyle(16, 0, "Consolas");setcolor(WHITE);}if (bombShockwaveActive) {int currentRadius = (shockwaveRadius * shockwaveAge) / BOMB_SHOCKWAVE_LIFETIME;int waveThickness = 10 - (shockwaveAge * 10 / BOMB_SHOCKWAVE_LIFETIME);if (waveThickness < 1) waveThickness = 1;setcolor(WHITE);setlinestyle(PS_SOLID, waveThickness);circle(shockwaveCenterX + screenShakeOffsetX, shockwaveCenterY + screenShakeOffsetY, currentRadius);setlinestyle(PS_SOLID, 1);}if (gs == OVER) {DrawGameOver();} else if (gs == PAUSE) {setcolor(WHITE);settextstyle(30, 0, "Arial");outtextxy(W / 2 - 60 + screenShakeOffsetX, H / 2 + screenShakeOffsetY, "PAUSED");settextstyle(16, 0, "Consolas");outtextxy(W / 2 - 80 + screenShakeOffsetX, H / 2 + 40 + screenShakeOffsetY, "Press P to resume");}EndBatchDraw();}bool Hit(int x1, int y1, int w1, int h1, int x2, int y2, int w2, int h2) {return x1 < x2 + w2 && x1 + w1 > x2 && y1 < y2 + h2 && y1 + h1 > y2;}void TriggerScreenShake(int duration, int intensity) {screenShakeTimer = duration;screenShakeOffsetX = (rand() % (intensity * 2 + 1)) - intensity;screenShakeOffsetY = (rand() % (intensity * 2 + 1)) - intensity;}void UseSkill(int skill) {if (skill == SKILL_BOMB && skills.bombEnergy >= 100.0) {bombShockwaveActive = true;shockwaveCenterX = p.x + 10;shockwaveCenterY = p.y + 15;shockwaveRadius = BOMB_SHOCKWAVE_MAX_RADIUS;shockwaveAge = 0;CreateBombWaveParticles(shockwaveCenterX, shockwaveCenterY, 50);TriggerScreenShake(SCREEN_SHAKE_DURATION, 3);skills.bombEnergy = 0.0;} else if (skill == SKILL_LASER && skills.laserEnergy >= 100.0) {laserActive = true;laserTimer = LASER_DURATION_FRAMES;skills.laserEnergy = 0.0;} else if (skill == SKILL_RAGE && skills.rageEnergy >= 100.0 && !skills.rageActive) {skills.rageActive = true;skills.rageTimer = 600;shanghai += 10.0;skills.rageEnergy = 0.0;} else if (skill == SKILL_HOMING_MISSILE && skills.homingMissileEnergy >= 100.0) {int missilesFired = 0;for (int i = 0; i < MAX_BULLETS && missilesFired < 5; i++) {if (!b[i].live) {b[i].x = p.x + 8;b[i].y = p.y;b[i].live = true;b[i].shooterType = 0;b[i].direction = 0;b[i].type = BULLET_HOMING;b[i].targetEnemyIndex = -1;b[i].angle = -M_PI / 2;double minDist = DBL_MAX;int closestEnemyIdx = -1;for (int j = 0; j < MAX_ENEMIES; j++) {if (e[j].live) {double dist = sqrt(pow(b[i].x - (e[j].x + e[j].width / 2), 2) + pow(b[i].y - (e[j].y + e[j].height / 2), 2));if (dist < minDist) {minDist = dist;closestEnemyIdx = j;}}}b[i].targetEnemyIndex = closestEnemyIdx;missilesFired++;}}skills.homingMissileEnergy = 0.0;} else if (skill == SKILL_SPREAD_SHOT && skills.spreadShotEnergy >= 100.0) {int centerBulletIdx = -1;for (int i = 0; i < MAX_BULLETS; i++) {if (!b[i].live) {centerBulletIdx = i;b[i].x = p.x + 8;b[i].y = p.y;b[i].live = true;b[i].shooterType = 0;b[i].direction = 0;b[i].type = BULLET_SPREAD;b[i].targetEnemyIndex = -1;b[i].angle = -M_PI / 2;break;}}if (centerBulletIdx != -1) {int shotsPerSide = NUM_SPREAD_SHOTS / 2;for (int side = -shotsPerSide; side <= shotsPerSide; side++) {if (side == 0) continue;for (int i = 0; i < MAX_BULLETS; i++) {if (!b[i].live) {b[i].x = p.x + 8;b[i].y = p.y;b[i].live = true;b[i].shooterType = 0;b[i].direction = 0;b[i].type = BULLET_SPREAD;b[i].targetEnemyIndex = -1;b[i].angle = -M_PI / 2 + (side * SPREAD_SHOT_ANGLE_INCREMENT * M_PI / 180.0);break;}}}}skills.spreadShotEnergy = 0.0;}}void Update() {if (GetAsyncKeyState(VK_LEFT) & 0x8000 && p.x > 5) p.x -= 5;if (GetAsyncKeyState(VK_RIGHT) & 0x8000 && p.x < W - 25) p.x += 5;if (GetAsyncKeyState(VK_UP) & 0x8000 && p.y > 5) p.y -= 5;if (GetAsyncKeyState(VK_DOWN) & 0x8000 && p.y < H - 30) p.y += 5;static bool pPressedLastFrame = false;bool pCurrentState = (GetAsyncKeyState('P') & 0x8000) != 0;if (pCurrentState && !pPressedLastFrame) {if (gs == PLAY) {gs = PAUSE;} else if (gs == PAUSE) {gs = PLAY;}}pPressedLastFrame = pCurrentState;if (gs == PLAY) {static bool fPressedLastFrame = false;static bool zPressedLastFrame = false;static bool xPressedLastFrame = false;static bool hPressedLastFrame = false;static bool gPressedLastFrame = false;bool fCurrentState = (GetAsyncKeyState('F') & 0x8000) != 0;bool zCurrentState = (GetAsyncKeyState('Z') & 0x8000) != 0;bool xCurrentState = (GetAsyncKeyState('X') & 0x8000) != 0;bool hCurrentState = (GetAsyncKeyState('H') & 0x8000) != 0;bool gCurrentState = (GetAsyncKeyState('G') & 0x8000) != 0;if (fCurrentState && !fPressedLastFrame && skills.bombEnergy >= 100.0 && !bombShockwaveActive) {UseSkill(SKILL_BOMB);}if (zCurrentState && !zPressedLastFrame && skills.laserEnergy >= 100.0 && !laserActive) {UseSkill(SKILL_LASER);}if (xCurrentState && !xPressedLastFrame && skills.rageEnergy >= 100.0 && !skills.rageActive) {UseSkill(SKILL_RAGE);}if (hCurrentState && !hPressedLastFrame && skills.homingMissileEnergy >= 100.0) {UseSkill(SKILL_HOMING_MISSILE);}if (gCurrentState && !gPressedLastFrame && skills.spreadShotEnergy >= 100.0) {UseSkill(SKILL_SPREAD_SHOT);}fPressedLastFrame = fCurrentState;zPressedLastFrame = zCurrentState;xPressedLastFrame = xCurrentState;hPressedLastFrame = hCurrentState;gPressedLastFrame = gCurrentState;}static DWORD lastShotTime = 0;if ((GetAsyncKeyState(VK_SPACE) & 0x8000) && GetTickCount() - lastShotTime > 150 && !laserActive && !bombShockwaveActive) {for (int i = 0; i < MAX_BULLETS; i++) {if (!b[i].live) {b[i].x = p.x + 8;b[i].y = p.y;b[i].live = true;b[i].shooterType = 0;b[i].direction = 0;b[i].type = BULLET_NORMAL;b[i].targetEnemyIndex = -1;b[i].angle = -M_PI / 2;break;}}lastShotTime = GetTickCount();}if (laserActive) {for (int i = 0; i < MAX_ENEMIES; i++) {if (e[i].live) {e[i].hp -= (int)(shanghai * 3.0);if (e[i].hp <= 0) {sc += 5 * lv * e[i].initialHp;combo++;comboTimer = COMBO_TIMEOUT_FRAMES;CreateExplosion(e[i].x + e[i].width / 2, e[i].y + e[i].height / 2);e[i].live = false;}}}laserTimer--;if (laserTimer <= 0) {laserActive = false;}}if (bombShockwaveActive) {shockwaveAge++;if (shockwaveAge >= BOMB_SHOCKWAVE_LIFETIME) {bombShockwaveActive = false;for (int id : enemiesHitByBomb) {if (e[id].live) {sc += 5 * lv * e[id].initialHp;combo++;comboTimer = COMBO_TIMEOUT_FRAMES;CreateExplosion(e[id].x + e[id].width / 2, e[id].y + e[id].height / 2);skills.bombEnergy += 10.0;skills.laserEnergy += 8.0;skills.rageEnergy += 5.0;if (skills.bombEnergy > 100.0) skills.bombEnergy = 100.0;if (skills.laserEnergy > 100.0) skills.laserEnergy = 100.0;if (skills.rageEnergy > 100.0) skills.rageEnergy = 100.0;e[id].live = false;if (e[id].type == ENEMY_BOSS) {achievements[2].unlocked = achievements[2].checkCondition();}}}enemiesHitByBomb.clear();} else {int currentRadius = (shockwaveRadius * shockwaveAge) / BOMB_SHOCKWAVE_LIFETIME;for (int i = 0; i < MAX_ENEMIES; i++) {if (e[i].live) {int dx = (e[i].x + e[i].width / 2) - shockwaveCenterX;int dy = (e[i].y + e[i].height / 2) - shockwaveCenterY;double distance = sqrt(dx * dx + dy * dy);if (distance <= currentRadius) {bool alreadyRecorded = false;for (int recordedId : enemiesHitByBomb) {if (recordedId == i) {alreadyRecorded = true;break;}}if (!alreadyRecorded) {enemiesHitByBomb.push_back(i);CreateExplosion(e[i].x + e[i].width / 2, e[i].y + e[i].height / 2);}}}}}}if (screenShakeTimer > 0) {screenShakeTimer--;if (screenShakeTimer > 0) {screenShakeOffsetX = (rand() % 7) - 3;screenShakeOffsetY = (rand() % 7) - 3;} else {screenShakeOffsetX = 0;screenShakeOffsetY = 0;}}if (comboTimer > 0) {comboTimer--;} else {if (combo > 1) {combo = 0;}}if (bossWarningTimer > 0) {bossWarningTimer--;}for (int i = 0; i < MAX_BULLETS; i++) {if (b[i].live) {if (b[i].type == BULLET_HOMING) {if (b[i].targetEnemyIndex != -1 && e[b[i].targetEnemyIndex].live) {int targetX = e[b[i].targetEnemyIndex].x + e[b[i].targetEnemyIndex].width / 2;int targetY = e[b[i].targetEnemyIndex].y + e[b[i].targetEnemyIndex].height / 2;double targetAngle = atan2(targetY - b[i].y, targetX - b[i].x);double angleDiff = targetAngle - b[i].angle;while (angleDiff > M_PI) angleDiff -= 2 * M_PI;while (angleDiff < -M_PI) angleDiff += 2 * M_PI;double maxTurn = 0.1;if (angleDiff > maxTurn) angleDiff = maxTurn;if (angleDiff < -maxTurn) angleDiff = -maxTurn;b[i].angle += angleDiff;}b[i].x += cos(b[i].angle) * HOMING_MISSILE_SPEED;b[i].y += sin(b[i].angle) * HOMING_MISSILE_SPEED;if (b[i].x < -10 || b[i].x > W + 10 || b[i].y < -10 || b[i].y > H + 10) {b[i].live = false;}} else if (b[i].type == BULLET_SPREAD) {b[i].x += cos(b[i].angle) * 8;b[i].y += sin(b[i].angle) * 8;if (b[i].x < -10 || b[i].x > W + 10 || b[i].y < -10 || b[i].y > H + 10) {b[i].live = false;}} else {if (b[i].direction == 0) {b[i].y -= 8;} else {b[i].y += 8;}if (b[i].y < -10 || b[i].y > H + 10) b[i].live = false;}}}const int ENEMY_SPAWN_RATE = 60;if (ec++ % ENEMY_SPAWN_RATE == 0) {for (int i = 0; i < MAX_ENEMIES; i++) {if (!e[i].live) {if (lv % BOSS_LEVEL == 0 && !bossSpawnedThisLevel) {e[i].x = W / 2 - 50;e[i].y = -60;e[i].live = true;e[i].type = ENEMY_BOSS;e[i].hp = 200 + lv * 30;e[i].initialHp = e[i].hp;e[i].width = 100;e[i].height = 60;e[i].laserTimer = 0;e[i].isFiringLaser = false;e[i].targetX = rand() % (W - e[i].width);e[i].shootTimer = 0;bossSpawnedThisLevel = true;strcpy(bossWarningText, "BOSS APPEARS!");bossWarningTimer = 120;break;} else {e[i].x = rand() % (W - 30);e[i].y = -30;e[i].live = true;e[i].type = ENEMY_NORMAL;e[i].hp = rand() % 11 + 20 + lv;e[i].initialHp = e[i].hp;e[i].width = 30;e[i].height = 30;e[i].laserTimer = 0;e[i].isFiringLaser = false;e[i].targetX = 0;e[i].shootTimer = 0;break;}}}}if (bossSpawnedThisLevel) {for (int i = 0; i < MAX_ENEMIES; i++) {if (e[i].live && e[i].type == ENEMY_BOSS) {if (abs(e[i].x - e[i].targetX) < 2) {e[i].targetX = rand() % (W - e[i].width);} else {if (e[i].x < e[i].targetX) {e[i].x += 1;} else if (e[i].x > e[i].targetX) {e[i].x -= 1;}}e[i].y = 50;e[i].laserTimer++;if (e[i].laserTimer > BOSS_ATTACK_INTERVAL_FRAMES && !e[i].isFiringLaser) {e[i].isFiringLaser = true;e[i].laserTimer = 0;if (screenShakeTimer <= 0) {TriggerScreenShake(5, 1);}}if (e[i].isFiringLaser) {e[i].laserTimer++;if (e[i].laserTimer >= BOSS_LASER_DURATION_FRAMES) {e[i].isFiringLaser = false;}}break;}}}for (int i = 0; i < MAX_ENEMIES; i++) {if (e[i].live && e[i].type == ENEMY_NORMAL) {e[i].shootTimer++;if (e[i].shootTimer > ENEMY_SHOOT_INTERVAL_FRAMES) {e[i].shootTimer = 0;for (int j = 0; j < MAX_BULLETS; j++) {if (!b[j].live) {b[j].x = e[i].x + e[i].width / 2 - 2;b[j].y = e[i].y + e[i].height;b[j].live = true;b[j].shooterType = 1;b[j].direction = 1;b[j].type = BULLET_NORMAL;b[j].targetEnemyIndex = -1;b[j].angle = M_PI / 2;break;}}}}}for (int i = 0; i < MAX_ENEMIES; i++) {if (e[i].live) {if (e[i].type == ENEMY_BOSS) {} else {e[i].y += 2;}if (e[i].y > H) e[i].live = false;}}for (int i = 0; i < MAX_ENEMIES; i++) {if (e[i].live && e[i].type == ENEMY_BOSS && e[i].isFiringLaser) {int laserLeft = e[i].x + 5;int laserRight = e[i].x + e[i].width - 5;int laserTop = e[i].y + e[i].height;int playerCenterX = p.x + 10;int playerCenterY = p.y + 15;if (playerCenterX >= laserLeft && playerCenterX <= laserRight && playerCenterY >= laserTop) {p.hp -= 1;CreateBleedingParticles(p.x + 10, p.y + 15, 2);if (p.hp <= 0) {CreateExplosion(p.x + 10, p.y + 15);Sleep(1000);gs = OVER;gameOverTime = GetTickCount();}}}}if (!laserActive && !bombShockwaveActive) {for (int i = 0; i < MAX_BULLETS; i++) {if (b[i].live && b[i].shooterType == 0) {for (int j = 0; j < MAX_ENEMIES; j++) {if (e[j].live && Hit(b[i].x, b[i].y, 4, 10, e[j].x, e[j].y, e[j].width, e[j].height)) {b[i].live = false;int damage = (int)shanghai;if (b[i].type == BULLET_SPREAD) {damage *= 2;}e[j].hp -= damage;if (e[j].hp > 0) {CreateBleedingParticles(e[j].x + e[j].width / 2, e[j].y + e[j].height / 2, 3);}if (e[j].hp <= 0) {e[j].live = false;sc += 3 * lv * e[j].initialHp;combo++;comboTimer = COMBO_TIMEOUT_FRAMES;skills.bombEnergy += 10.0;skills.laserEnergy += 8.0;skills.rageEnergy += 5.0;skills.homingMissileEnergy += 10.0;skills.spreadShotEnergy += 10.0;if (skills.bombEnergy > 100.0) skills.bombEnergy = 100.0;if (skills.laserEnergy > 100.0) skills.laserEnergy = 100.0;if (skills.rageEnergy > 100.0) skills.rageEnergy = 100.0;if (skills.homingMissileEnergy > 100.0) skills.homingMissileEnergy = 100.0;if (skills.spreadShotEnergy > 100.0) skills.spreadShotEnergy = 100.0;CreateExplosion(e[j].x + e[j].width / 2, e[j].y + e[j].height / 2);if (sc >= lv * 150) {lv++;shanghai += 1;shanghai = min(lv / 2 + 1, (int)shanghai);}achievements[0].unlocked = achievements[0].checkCondition();achievements[1].unlocked = achievements[1].checkCondition();if (e[j].type == ENEMY_BOSS) {achievements[2].unlocked = achievements[2].checkCondition();}}break;}}}}}if (!bombShockwaveActive) {for (int i = 0; i < MAX_BULLETS; i++) {if (b[i].live && (b[i].shooterType == 1 || b[i].shooterType == 2) && b[i].direction == 1) {if (Hit(p.x, p.y, 20, 30, b[i].x, b[i].y, 4, 10)) {b[i].live = false;p.hp -= 1;CreateBleedingParticles(p.x + 10, p.y + 15, 10);if (screenShakeTimer <= 0) {TriggerScreenShake(5, 1);}if (p.hp <= 0) {CreateExplosion(p.x + 10, p.y + 15);Sleep(1000);gs = OVER;gameOverTime = GetTickCount();}}}}}if (!bombShockwaveActive) {for (int i = 0; i < MAX_ENEMIES; i++) {if (e[i].live && Hit(p.x, p.y, 20, 30, e[i].x, e[i].y, e[i].width, e[i].height)) {e[i].live = false;p.hp -= 1;CreateBleedingParticles(p.x + 10, p.y + 15, 10);if (screenShakeTimer <= 0) {TriggerScreenShake(5, 1);}if (p.hp <= 0) {CreateExplosion(p.x + 10, p.y + 15);Sleep(1000);gs = OVER;gameOverTime = GetTickCount();}}}}if (rand() % 100 == 0) {for (int i = 0; i < MAX_POWERUPS; i++) {if (!pu[i].live) {pu[i].x = rand() % (W - 12) + 6;pu[i].y = -10;pu[i].live = true;pu[i].type = rand() % 3;break;}}}for (int i = 0; i < MAX_POWERUPS; i++) {if (pu[i].live) {pu[i].y += 3;if (pu[i].y > H + 10) pu[i].live = false;if (Hit(p.x, p.y, 20, 30, pu[i].x - 6, pu[i].y - 6, 12, 12)) {switch (pu[i].type) {case POWERUP_ATTACK:shanghai *= 1.05;break;case POWERUP_HP:p.hp += 2;if (p.hp > p.maxHp) p.hp = p.maxHp;break;case POWERUP_BOMB:skills.bombEnergy += 30.0;if (skills.bombEnergy > 100.0) skills.bombEnergy = 100.0;break;}pu[i].live = false;}}}if (skills.rageActive) {skills.rageTimer--;if (skills.rageTimer <= 0) {skills.rageActive = false;shanghai -= 10.0;}}if (gs == PLAY && !bombShockwaveActive) {if (rand() % 2 == 0) {CreateJetTrail(p.x + 5, p.y + 30, 1);}if (rand() % 2 == 0) {CreateJetTrail(p.x + 15, p.y + 30, 1);}for (int i = 0; i < MAX_ENEMIES; i++) {if (e[i].live && e[i].type != ENEMY_BOSS && rand() % 3 == 0) {CreateJetTrail(e[i].x + e[i].width / 4, e[i].y, 1);}if (e[i].live && e[i].type != ENEMY_BOSS && rand() % 3 == 0) {CreateJetTrail(e[i].x + 3 * e[i].width / 4, e[i].y, 1);}}}UpdateExplosions();}int main() {initgraph(W, H);DWORD lastTime = GetTickCount();while (true) {DWORD currentTime = GetTickCount();if (currentTime - lastTime >= MS_PER_FRAME) {if (gs == START) {if (GetAsyncKeyState(VK_SPACE) & 0x8000) {gs = PLAY;InitGame();}} else if (gs == OVER) {if (currentTime - gameOverTime >= 2000) {gs = START;}} else if (gs == PAUSE) {if (GetAsyncKeyState(VK_ESCAPE) & 0x8000) {break;}} else {if (GetAsyncKeyState(VK_ESCAPE) & 0x8000) {break;}}switch (gs) {case START:DrawStart();break;case PLAY:Update();GameDraw();break;case OVER:GameDraw();break;case PAUSE:GameDraw();break;}lastTime = currentTime;}Sleep(1);}closegraph();return 0;}```::::# 游戏界面概览## 开始## 游戏时## BOSS## 去世其它功能请自行安装尝试如果有建议请在评论区给出