//--------------------------------------------------------------------------- #include #pragma hdrstop #include "Unit1.h" #include //--------------------------------------------------------------------------- #pragma package(smart_init) #pragma link "perfgrap" #pragma resource "*.dfm" TForm1 *Form1; //--------------------------------------------------------------------------- __fastcall TForm1::TForm1(TComponent* Owner) : TForm(Owner) { ShotTimer = new TTimer(this); ShotTimer->Enabled = true; ShotTimer->Name = "ShotTimer"; ShotTimer->Interval = 1; ShotTimer->OnTimer = this->ShotTimerTimer; PlayShots->FileName = "Sounds/shot2.wav"; PlayShots->Open(); EnemySpawn->FileName = "Sounds/spawn_enemy2.wav"; EnemySpawn->Open(); SoundEffects->FileName = "Sounds/come_to_life2.wav"; SoundEffects->Open(); SoundEffects->Play(); EnemyDeaths->FileName = "Sounds/enemy_die2.wav"; EnemyDeaths->Open(); BgMusic->FileName = "Sounds/portal content 00300.mp3"; BgMusic->Open(); BgMusic->Play(); //system("copy ZeroHour.ttf C:\WINDOWS\FONTS\ZeroHour.ttf"); //system("copy ZeroHour.ttf ZeroHour2.ttf"); CopyFile("ZeroHour.ttf","C:/WINDOWS/Fonts/ZeroHour.ttf",0); AddFontResource("C:/WINDOWS/Fonts/ZeroHour.ttf"); SendMessage(HWND_BROADCAST,WM_FONTCHANGE, 0, 0); memBMP=new Graphics::TBitmap(); memBMP->Width=ClientWidth; memBMP->Height=ClientHeight; memBMP->Canvas->Font->Name = "ZeroHour"; for (int pp = 0; pp < 14; pp++){ Planets[pp] = new TImage(this); Planets[pp]->AutoSize = true; } for (int psc = 0; psc < 100; psc++){ PixelStars1[psc][0] = random(ClientWidth); PixelStars1[psc][1] = random(ClientHeight); PixelStars2[psc][0] = random(ClientWidth); PixelStars2[psc][1] = random(ClientHeight); } Planets[0]->Picture = bg01->Picture; Planets[1]->Picture = bg02->Picture; Planets[2]->Picture = bg03->Picture; Planets[3]->Picture = bg04->Picture; Planets[4]->Picture = bg05->Picture; Planets[5]->Picture = bg06->Picture; Planets[6]->Picture = bg07->Picture; Planets[7]->Picture = bg08->Picture; Planets[8]->Picture = bg09->Picture; Planets[9]->Picture = bg10->Picture; Planets[10]->Picture = bg11->Picture; Planets[11]->Picture = bg12->Picture; Planets[12]->Picture = bg13->Picture; Planets[13]->Picture = bg14->Picture; MovePlanetsAgain: for (int p = 0; p < 14; p++){ Planets[p]->Left = random(2 * ClientWidth) - ClientWidth; Planets[p]->Top = random(2 * ClientHeight) - ClientHeight; } int MovingPlanets = 1, PlanetIterations = 0; while (MovingPlanets == 1){ PlanetIterations++; for (int c = 0; c < 14; c++) { for (int cc = 0; cc < 14; cc++) { if (((Planets[c]->Left + Planets[c]->Width > Planets[cc]->Left) && (Planets[c]->Left + Planets[c]->Width < Planets[cc]->Left + Planets[cc]->Width) && (Planets[c]->Top > Planets[cc]->Top) && (Planets[c]->Top < Planets[cc]->Top + Planets[cc]->Height)) || ((Planets[c]->Left + Planets[c]->Width > Planets[cc]->Left) && (Planets[c]->Left + Planets[c]->Width < Planets[cc]->Left + Planets[cc]->Width) && (Planets[c]->Top + Planets[c]->Height > Planets[cc]->Top) && (Planets[c]->Top + Planets[c]->Height < Planets[cc]->Top + Planets[cc]->Height))) { Planets[c]->Left = random(2 * ClientWidth) - ClientWidth; Planets[c]->Top = random(2 * ClientHeight) - ClientHeight; c = 0; cc = 0; } else if (cc == 13 && c == 13) { MovingPlanets = 0; } } } if (PlanetIterations == 100) goto MovePlanetsAgain; } } //--------------------------------------------------------------------------- void __fastcall TForm1::FormOnMouseMove(TObject *Sender, TShiftState Shift, int X, int Y) { PrevShift = Shift; PrevX = X; PrevY = Y; radius = (Shape1->Height/2); MidY = Shape1->Top + radius; MidX = Shape1->Left + radius; SmallCircRadius = Shape2->Height/2; YLen = Y - MidY; XLen = X - MidX; TheRatio = sqrt(YLen*YLen + XLen*XLen) / radius; if (TheRatio != 0) { TopPos = MidY + (YLen / TheRatio) - SmallCircRadius; LeftPos = MidX + (XLen / TheRatio)- SmallCircRadius; } Shape2->Top = TopPos; Shape2->Left = LeftPos; } //--------------------------------------------------------------------------- void __fastcall TForm1::Timer1Timer(TObject *Sender) { FormOnMouseMove(Sender,PrevShift,PrevX,PrevY); if (Shape1->Left < shpWall->Left){ Shape1->Left += 5; } else if (Shape1->Left + Shape1->Width > shpWall->Left + shpWall->Width){ Shape1->Left += -5; } else{ Shape1->Left += LeftMovement; /*for (int mwpl = 0; mwpl < 14; mwpl++) Planets[mwpl]->Left += LeftMovement / 5; for (int mwsl = 0; mwsl < 100; mwsl++){ PixelStars1[mwsl][0] += 3 * LeftMovement / 5; PixelStars2[mwsl][0] += 2 * LeftMovement / 5; }*/ } if (Shape1->Top < shpWall->Top){ Shape1->Top += 5; } else if (Shape1->Top + Shape1->Height > shpWall->Top + shpWall->Height){ Shape1->Top += -5; } else{ Shape1->Top += TopMovement; /*for (int mwpt = 0; mwpt < 14; mwpt++) Planets[mwpt]->Top -= 2 * TopMovement / 5; for (int mwst = 0; mwst < 100; mwst++){ PixelStars1[mwst][1] -= 6 * TopMovement / 5; PixelStars2[mwst][1] -= 4 * TopMovement / 5; }*/ } } //--------------------------------------------------------------------------- void __fastcall TForm1::FormOnKeyDown(TObject *Sender, WORD &Key, TShiftState Shift) { if (Key == 87 || Key == 38) TopMovement = -5; // 81 q 87 w 69 e if (Key == 68 || Key == 39) // 65 a 83 s 68 d LeftMovement = 5; // 90 z 88 x 67 c if (Key == 83 || Key == 40) // SpaceBar 32 TopMovement = 5; if (Key == 65 || Key == 37) LeftMovement = -5; if (Key == 32 && Bombs > 0) { Bombs--; memBMP->Canvas->Brush->Style = bsSolid; memBMP->Canvas->Pen->Color=clWhite; memBMP->Canvas->Brush->Color=clWhite; memBMP->Canvas->Rectangle(0,0,ClientWidth,ClientHeight); Canvas->Draw(0, 0, memBMP); SoundEffects->Close(); SoundEffects->FileName = "Sounds/bomb2.wav"; SoundEffects->Open(); SoundEffects->Play(); for(int ke = deadnme; ke < alivenme; ke++) delete Enemy[ke]; NumberEnemy = 0; deadnme = 0; alivenme = 0; } if (GameOver == 1 && Key == 13) { Lives = 3; GameOver = 0; Fading = 1; TotalEnemiesKilled = 0; Score = 0; Multiplier = 1; alive = 0; dead = 0; alive2 = 0; dead2 = 0; alivenme = 0; deadnme = 0; FlameNum = 0; NumberShot = 0; NoKillsSoFar = 0; Achievement = 0; NumberEnemy = 0; ShotTimer->Enabled = true; Timer1->Enabled = true; MakeEnemy->Enabled = true; CollisionTest->Enabled = true; EnemyMove->Enabled = true; GraveDigger->Enabled = true; Flames->Enabled = true; NoKillTimer->Enabled = true; ComeToLife->Enabled = true; SoundEffects->FileName = "Sounds/come_to_life2.wav"; SoundEffects->Open(); SoundEffects->Play(); BgMusic->Play(); } } //--------------------------------------------------------------------------- void __fastcall TForm1::FormKeyUp(TObject *Sender, WORD &Key, TShiftState Shift) { if (Key == 87 || Key == 83 || Key == 38 || Key == 40) TopMovement = 0; if (Key == 68 || Key == 65 || Key == 37 || Key == 39) LeftMovement = 0; } //--------------------------------------------------------------------------- void __fastcall TForm1::ShotTimerTimer(TObject *Sender) { for(int i = dead; i < alive;i++){ Shot[i]->Left += MovmentAdd[i][0]; Shot[i]->Top += MovmentAdd[i][1]; Life[i]++; if (Life[i] >= 100){ delete Shot[i]; Life[i] = 0; dead++; } } if (dead == 100) { alive = 0; dead = 0; } for(int ii = dead2; ii < alive2;ii++){ Shot2[ii]->Left += MovmentAdd[ii+100][0]; Shot2[ii]->Top += MovmentAdd[ii+100][1]; Life2[ii]++; if (Life2[ii] >= 100){ delete Shot2[ii]; Life2[ii] = 0; dead2++; } } if (dead2 == 100) { alive2 = 0; dead2 = 0; } } //--------------------------------------------------------------------------- void __fastcall TForm1::ShotFCNMaker(TShape *&ShotVar, int &alivevar) { PlayShots->Rewind(); PlayShots->Play(); ShotVar = new TShape(Form1); ShotVar->Visible = false; ShotVar->Parent = Form1; ShotVar->Width = 5; ShotVar->Height = 5; ShotVar->Shape = stCircle; ShotVar->Left = LeftPos+SmallCircRadius - 2.5; ShotVar->Top = TopPos+SmallCircRadius - 2.5; MovmentAdd[NumberShot][0] = (XLen / TheRatio)/1.5; //X MovmentAdd[NumberShot][1] = (YLen / TheRatio)/1.5; //Y alivevar++; } //--------------------------------------------------------------------------- void __fastcall TForm1::MakeShots(TObject *Sender) { if (NumberShot >= 0 && NumberShot < 100) ShotFCNMaker(Shot[NumberShot], alive); else ShotFCNMaker(Shot2[NumberShot - 100], alive2); NumberShot++; if (NumberShot == 200) NumberShot = 0; } //--------------------------------------------------------------------------- void __fastcall TForm1::FormOnMouseUp(TObject *Sender, TMouseButton Button, TShiftState Shift, int X, int Y) { if (Lives >= 0) TimerShotMaker->Enabled = false; } //--------------------------------------------------------------------------- void __fastcall TForm1::FormOnMouseDown(TObject *Sender, TMouseButton Button, TShiftState Shift, int X, int Y) { if (Lives >= 0) TimerShotMaker->Enabled = true; } //--------------------------------------------------------------------------- void __fastcall TForm1::MakeNewEnemy(TObject *Sender) { if (NumberEnemy < 1000000) { EnemySpawn->Rewind(); EnemySpawn->Play(); Enemy[NumberEnemy] = new TShape(this); Enemy[NumberEnemy]->Visible = false; Enemy[NumberEnemy]->Parent = this; Enemy[NumberEnemy]->Width = 16; Enemy[NumberEnemy]->Height = 16; Enemy[NumberEnemy]->Pen->Width = 3; Enemy[NumberEnemy]->Pen->Color = clAqua; Enemy[NumberEnemy]->Brush->Color = clNone; Enemy[NumberEnemy]->Shape = stRoundRect; int RandomEdge = Random(4); if (RandomEdge == 0) { //left Enemy[NumberEnemy]->Top = shpWall->Top + random(shpWall->Height); Enemy[NumberEnemy]->Left = shpWall->Left + 5; } else if (RandomEdge == 1){ // right Enemy[NumberEnemy]->Top = shpWall->Top + random(shpWall->Height); Enemy[NumberEnemy]->Left = shpWall->Left + shpWall->Width - 5; } else if (RandomEdge == 2){ // top Enemy[NumberEnemy]->Left = random(shpWall->Width); Enemy[NumberEnemy]->Top = shpWall->Top + 5; } else if (RandomEdge == 3){ // bottom Enemy[NumberEnemy]->Left = random(shpWall->Width); Enemy[NumberEnemy]->Top = shpWall->Top + shpWall->Height - 5; } NumberEnemy++; alivenme++; } } //--------------------------------------------------------------------------- void __fastcall TForm1::CollisionCheck(TShape *&ShotCheck, TShape *&EnemyCheck) { if (ShotCheck->Left + ShotCheck->Width >=EnemyCheck->Left) { if (ShotCheck->Top <= EnemyCheck->Top + EnemyCheck->Height) { if (ShotCheck->Left <= EnemyCheck->Left + EnemyCheck->Width) { if (ShotCheck->Top + ShotCheck->Height >= EnemyCheck->Top) { EnemyDeaths->Rewind(); EnemyDeaths->Play(); NoKillsSoFar = 601; EnemyCheck->Enabled = false; EnemyCheck->Left = -500; EnemyCheck->Top = -500; ShotCheck->Top = -500; ShotCheck->Left = -500; TotalEnemiesKilled++; if (MakeEnemy->Interval > 1) MakeEnemy->Interval = 1000 - ((TotalEnemiesKilled / 5) * 20); else MakeEnemy->Interval = 1; if (Multiplier < 150 && Achievement == 0) Multiplier = (TotalEnemiesKilled / 10) + 1; Score += 100 * Multiplier; } } } } } //--------------------------------------------------------------------------- void __fastcall TForm1::EnemyCollisionCheck(TShape *&Ship, TShape *&EnemyCheck) { if (Ship->Left + Ship->Width >=EnemyCheck->Left) { if (Ship->Top <= EnemyCheck->Top + EnemyCheck->Height) { if (Ship->Left <= EnemyCheck->Left + EnemyCheck->Width) { if (Ship->Top + Ship->Height >= EnemyCheck->Top) { SoundEffects->Close(); SoundEffects->FileName = "Sounds/die2.wav"; SoundEffects->Open(); SoundEffects->Play(); NoKillsSoFar = 601; NoKillTimer->Enabled = false; for(int k = deadnme; k < alivenme; k++) delete Enemy[k]; deadnme = 0; alivenme = 0; NumberEnemy = 0; for(int kk = dead; kk < alive;kk++) delete Shot[kk]; dead = 0; alive = 0; for(int kkk = dead2; kkk < alive2;kkk++) delete Shot2[kkk]; dead2 = 0; alive2 = 0; NumberShot = 0; MakeEnemy->Interval = 1000; TotalEnemiesKilled = 0; Ship->Top = ClientHeight / 2; Ship->Left = ClientWidth / 2; Multiplier = 1; Lives--; if (Lives == -1) { ShotTimer->Enabled = false; Timer1->Enabled = false; TimerShotMaker->Enabled = false; MakeEnemy->Enabled = false; CollisionTest->Enabled = false; EnemyMove->Enabled = false; GraveDigger->Enabled = false; Flames->Enabled = false; BgMusic->Stop(); GameOver = 1; memBMP->Canvas->Brush->Style = bsClear; memBMP->Canvas->TextOutA(ClientWidth/2 - 90,ClientHeight/2,"Game Over"); memBMP->Canvas->TextOutA(ClientWidth/2 - 150,ClientHeight/2 + 200,"(Press Enter to Play Again)"); memBMP->Canvas->Brush->Style = bsSolid; Canvas->Draw(0, 0, memBMP); } } } } } } //--------------------------------------------------------------------------- void __fastcall TForm1::TimerCollisionTest(TObject *Sender) { for(int c = deadnme; c < alivenme; c++){ for(int d = dead; d < alive;d++){ if (Enemy[c]->Enabled == true) { CollisionCheck(Shot[d], Enemy[c]); } } for(int dd = dead2; dd < alive2;dd++){ if (Enemy[c]->Enabled == true) { CollisionCheck(Shot2[dd], Enemy[c]); } } } for(int cc = deadnme; cc < alivenme; cc++) EnemyCollisionCheck(Shape1, Enemy[cc]); } //--------------------------------------------------------------------------- void __fastcall TForm1::TimerEnemyMove(TObject *Sender) { if (BgMusic->Position == BgMusic->Length) { BgMusic->Rewind(); BgMusic->Play(); } double midxnme, midynme, movxlen, movylen, TheRatio2; memBMP->Canvas->Pen->Color=clBlack; memBMP->Canvas->Brush->Color=clBlack; memBMP->Canvas->Rectangle(0,0,ClientWidth,ClientHeight); //Planets and stuff for (int bbp = 0; bbp < 14; bbp++) { BitBlt(memBMP->Canvas->Handle, Planets[bbp]->Left, Planets[bbp]->Top, Planets[bbp]->Width, Planets[bbp]->Height, Planets[bbp]->Canvas->Handle,0,0,SRCCOPY); } for (int bbps = 0; bbps < 100; bbps++) { memBMP->Canvas->Pixels[PixelStars1[bbps][0]][PixelStars1[bbps][1]] = clWhite; memBMP->Canvas->Pixels[PixelStars2[bbps][0]][PixelStars2[bbps][1]] = cl3DDkShadow; } //End Planets memBMP->Canvas->Brush->Style = bsClear; for(int m = deadnme; m < alivenme; m++){ if (Enemy[m]->Enabled == true) { midxnme = Enemy[m]->Left + (Enemy[m]->Width / 2); midynme = Enemy[m]->Top + (Enemy[m]->Height / 2); movxlen = midxnme - MidX; movylen = midynme - MidY; TheRatio2 = sqrt(movylen*movylen + movxlen*movxlen) / (Enemy[m]->Height / 2); if (TheRatio2 != 0) { memBMP->Canvas->Pen->Color = clAqua; memBMP->Canvas->Pen->Width = 3; if (((movxlen) / TheRatio2 /5 >= -1 && (movxlen) / TheRatio2 /5 < -0.5) && ((movylen) / TheRatio2 /5 >= -1 && (movylen) / TheRatio2 /5 < -0.5)) { Enemy[m]->Left -= -1.45; Enemy[m]->Top -= -1.45; memBMP->Canvas->RoundRect(Enemy[m]->Left,Enemy[m]->Top,Enemy[m]->Left + Enemy[m]->Width, Enemy[m]->Top + Enemy[m]->Height, 3, 3); } else { Enemy[m]->Left -= ((movxlen) / TheRatio2 /5); Enemy[m]->Top -= ((movylen) / TheRatio2 /5); memBMP->Canvas->RoundRect(Enemy[m]->Left,Enemy[m]->Top,Enemy[m]->Left + Enemy[m]->Width, Enemy[m]->Top + Enemy[m]->Height, 3, 3); } } } } memBMP->Canvas->Brush->Style = bsSolid; memBMP->Canvas->Brush->Color=clBlack; /* TPoint Pt[13]; Pt[0] = Point(Enemy[m]->Left + Enemy[m]->Width /2, Enemy[m]->Top + Enemy[m]->Height /2); Pt[1] = Point(Enemy[m]->Left, Enemy[m]->Top + Enemy[m]->Height /2); Pt[2] = Point(Enemy[m]->Left + Enemy[m]->Width /4, Enemy[m]->Top + Enemy[m]->Height /4); Pt[3] = Point(Enemy[m]->Left + Enemy[m]->Width /2, Enemy[m]->Top + Enemy[m]->Height /2); Pt[4] = Point(Enemy[m]->Left + Enemy[m]->Width /2, Enemy[m]->Top); Pt[5] = Point(Enemy[m]->Left + 3 * Enemy[m]->Width /4, Enemy[m]->Top + Enemy[m]->Height /4); Pt[6] = Point(Enemy[m]->Left + Enemy[m]->Width /2, Enemy[m]->Top + Enemy[m]->Height /2); Pt[7] = Point(Enemy[m]->Left + Enemy[m]->Width, Enemy[m]->Top + Enemy[m]->Height /2); Pt[8] = Point(Enemy[m]->Left + 3 * Enemy[m]->Width /4, Enemy[m]->Top + 3 * Enemy[m]->Height /4); Pt[9] = Point(Enemy[m]->Left + Enemy[m]->Width /2, Enemy[m]->Top + Enemy[m]->Height /2); Pt[10] = Point(Enemy[m]->Left + Enemy[m]->Width /2, Enemy[m]->Top + Enemy[m]->Height); Pt[11] = Point(Enemy[m]->Left + Enemy[m]->Width /4, Enemy[m]->Top + 3 * Enemy[m]->Height /4); Pt[12] = Point(Enemy[m]->Left + Enemy[m]->Width /2, Enemy[m]->Top + Enemy[m]->Height /2); memBMP->Canvas->MoveTo(Enemy[m]->Left + Enemy[m]->Width /2, Enemy[m]->Top + Enemy[m]->Height /2); PolylineTo(memBMP->Canvas->Handle, Pt, 13);*/ //------------ for(int f = 0; f < 50; f++) memBMP->Canvas->Pixels[FlamePosX[f]][FlamePosY[f]] = clRed; memBMP->Canvas->Pen->Color=clWhite; memBMP->Canvas->Pen->Width = 1; memBMP->Canvas->Ellipse(Shape2->Left, Shape2->Top, Shape2->Left + Shape2->Width, Shape2->Top + Shape2->Height); memBMP->Canvas->Ellipse(Shape1->Left, Shape1->Top, Shape1->Left + Shape1->Width, Shape1->Top + Shape1->Height); memBMP->Canvas->Ellipse(Shape1->Left + 2, Shape1->Top + 2, Shape1->Left + Shape1->Width - 2, Shape1->Top + Shape1->Height - 2); memBMP->Canvas->Ellipse(Shape1->Left + 4, Shape1->Top + 4, Shape1->Left + Shape1->Width - 4, Shape1->Top + Shape1->Height - 4); memBMP->Canvas->Ellipse(Shape1->Left + 6, Shape1->Top + 6, Shape1->Left + Shape1->Width - 6, Shape1->Top + Shape1->Height - 6); memBMP->Canvas->Brush->Color = clHotLight; for(int i = dead; i < alive;i++){ memBMP->Canvas->Ellipse(Shot[i]->Left, Shot[i]->Top, Shot[i]->Left + Shot[i]->Width, Shot[i]->Top + Shot[i]->Height); } for(int ii = dead2; ii < alive2;ii++){ memBMP->Canvas->Ellipse(Shot2[ii]->Left, Shot2[ii]->Top, Shot2[ii]->Left + Shot2[ii]->Width, Shot2[ii]->Top + Shot2[ii]->Height); } memBMP->Canvas->Brush->Style = bsClear; memBMP->Canvas->Font->Color = clLime; memBMP->Canvas->Font->Size = 8; //memBMP->Canvas->Font->Name = "ZeroHour"; memBMP->Canvas->TextOutA(8,5,"Score"); memBMP->Canvas->TextOutA((ClientWidth /2) - 100,5,"Lives"); memBMP->Canvas->TextOutA((ClientWidth /2) + 40,5,"Bombs"); memBMP->Canvas->TextOutA(ClientWidth - 100,5,"Multiplier"); memBMP->Canvas->TextOutA(8,5,"Score"); memBMP->Canvas->Font->Size = 14; //memBMP->Canvas->Font->Name = "Lucida Sans"; memBMP->Canvas->TextOutA(8,17,Score); memBMP->Canvas->TextOutA((ClientWidth /2) - 90,17,Lives); memBMP->Canvas->TextOutA((ClientWidth /2) + 60,17,Bombs); memBMP->Canvas->TextOutA(ClientWidth - 100,17,Multiplier); memBMP->Canvas->Brush->Style = bsSolid; memBMP->Canvas->Pen->Color = clLime; memBMP->Canvas->Pen->Width = 2; TPoint WallPt[5]; WallPt[0] = Point(shpWall->Left, shpWall->Top); WallPt[1] = Point(shpWall->Left + shpWall->Width, shpWall->Top); WallPt[2] = Point(shpWall->Left + shpWall->Width, shpWall->Top + shpWall->Height); WallPt[3] = Point(shpWall->Left, shpWall->Top + shpWall->Height); WallPt[4] = Point(shpWall->Left, shpWall->Top); memBMP->Canvas->MoveTo(shpWall->Left, shpWall->Top-1); PolylineTo(memBMP->Canvas->Handle, WallPt, 5); //------------ Canvas->Draw(0, 0, memBMP); } //--------------------------------------------------------------------------- void __fastcall TForm1::GraveDiggerTimer(TObject *Sender) { if (deadnme < alivenme) if (Enemy[deadnme]->Enabled == false) deadnme++; if (deadnme == 1000000) { deadnme = 0; alivenme = 0; NumberEnemy = 0; } } //--------------------------------------------------------------------------- void __fastcall TForm1::ComeToLifeTimer(TObject *Sender) { Fading++; if (Fading == 20) { ComeToLife->Enabled = false; MakeEnemy->Enabled = true; } Shape1->Height = Fading; Shape1->Width = Fading; } //--------------------------------------------------------------------------- void __fastcall TForm1::FlamesTimer(TObject *Sender) { FlamePosX[FlameNum] = MidX; FlamePosY[FlameNum] = MidY; FlameNum++; if (FlameNum == 50) { FlameNum = 0; } } //--------------------------------------------------------------------------- void __fastcall TForm1::FormOnClick(TObject *Sender) { if (Lives >= 0){ if (NumberShot >= 0 && NumberShot < 100) ShotFCNMaker(Shot[NumberShot], alive); else ShotFCNMaker(Shot2[NumberShot - 100], alive2); NumberShot++; if (NumberShot == 200) NumberShot = 0; } } //--------------------------------------------------------------------------- void __fastcall TForm1::MovePlanetsTimer(TObject *Sender) { for (int mp = 0; mp < 14; mp++) { Planets[mp]->Left -= 1; Planets[mp]->Top += 2; if (Planets[mp]->Left < -(ClientWidth / 2)) Planets[mp]->Left = ClientWidth + (ClientWidth / 2); if (Planets[mp]->Top > ClientHeight + (ClientHeight / 2)) Planets[mp]->Top = -(ClientHeight / 2); } for (int ms = 0; ms < 100; ms++) { PixelStars1[ms][0] -= 3; PixelStars1[ms][1] += 6; PixelStars2[ms][0] -= 2; PixelStars2[ms][1] += 4; if (PixelStars1[ms][0] < 0) PixelStars1[ms][0] = ClientWidth; if (PixelStars1[ms][1] > ClientHeight) PixelStars1[ms][1] = 0; if (PixelStars2[ms][0] < 0) PixelStars2[ms][0] = ClientWidth; if (PixelStars2[ms][1] > ClientHeight) PixelStars2[ms][1] = 0; } } //--------------------------------------------------------------------------- void __fastcall TForm1::NoKillTimerTimer(TObject *Sender) { NoKillsSoFar++; if (NoKillsSoFar == 600) { Multiplier = 150; Achievement = 1; NoKillTimer->Enabled = false; } else if (NoKillsSoFar > 600) { NoKillTimer->Enabled = false; } } //---------------------------------------------------------------------------