int main() { txCreateWindow (1200, 700); txSelectFont ("Comic Sans MS", -20, -30); txPlaySound ("msc.wav"); Titry(); txClear(); txTextOut (500, 350, "Жил был один козёл..."); txSleep (1000); txClear (); txTextOut (500, 350, "И его все любили"); GoatLove (); txPlaySound ("msc.wav"); txSleep (2000); txClear (); txTextOut (500, 350, "Но потом появился"); txSleep (1000); txClear (); txPlaySound ("Tam.wav"); txTextOut (575, 350, "ОН"); FxDrawTv (TX_LIGHTGRAY, TX_BLACK, 500, 500); txSleep(5000); txPlaySound ("msc.wav"); TitryEnd(); return 0; }
int main () { CreateMyWindow (); // pictures_t pictures; // LoadPictures (pictures); // array_t <dyn, button_t> buttons (0); // SetButtons (buttons, pictures); // int buttonPressed = NothingPressed; // txBegin (); // while (!Exit ()) { DrawBackground (pictures); // DoOperationsWithButtons (buttons, &buttonPressed); // txSleep (1); } txEnd (); DeletePictures (pictures); _txExit = true; return 0; }
void MoveShar () { int x = 100, y = 100; int x1 = 1000, y1 = 700; int x2 = 500, y2 = 400; int x3 = 800, y3 = 400; int vx = 3, vy = 0; int vx1 = -3, vy1 = 0; int vx2 = 0, vy2 = 3; int vx3 = 0, vy3 = -3; int Xpr = 600, Ypr = 400; int Xpr1 = 400, Ypr1 = 600; int Xpr2 = 1200, Ypr2 = 450; int Xpr3 = 100, Ypr3 = 600; int Xpr4 = 300, Ypr4 = 300; double dt = 1; double v = 3, v1 = 3, v2 = 3, v3 = 3; double Diametr = 20; while (!GetAsyncKeyState(VK_ESCAPE)) { if (!GetAsyncKeyState (VK_SPACE)) { txSetFillColor (TX_BLACK); txFloodFill (1600, 100); txClear (); } dt = dt + 0.001; Score (dt, 750, 50); txSetColor (TX_LIGHTRED); txSetFillColor (TX_LIGHTRED); txCircle (x, y, Diametr); txSetColor (TX_LIGHTGREEN); txSetFillColor (TX_LIGHTGREEN); txCircle (x1, y1, Diametr); txSetColor (TX_LIGHTBLUE); txSetFillColor (TX_LIGHTBLUE); txCircle (x2, y2, Diametr); txSetColor (TX_LIGHTMAGENTA); txSetFillColor (TX_LIGHTMAGENTA); txCircle (x3, y3, Diametr); Prepyatstvie (Xpr, Ypr); Prepyatstvie (Xpr1, Ypr1); Prepyatstvie (Xpr2, Ypr2); Prepyatstvie (Xpr3, Ypr3); Prepyatstvie (Xpr4, Ypr4); Sharik (&x, &y, &vx, &vy, &v, &dt, &Xpr, &Ypr, &Xpr1, &Ypr1, &Xpr2, &Ypr2, &Xpr3, &Ypr3, &Xpr4, &Ypr4); Sharik1 (&x1, &y1, &vx1, &vy1, &v1, &dt, &Xpr, &Ypr, &Xpr1, &Ypr1, &Xpr2, &Ypr2, &Xpr3, &Ypr3, &Xpr4, &Ypr4); Sharik2 (&x2, &y2, &vx2, &vy2, &v2, &dt, &Xpr, &Ypr, &Xpr1, &Ypr1, &Xpr2, &Ypr2, &Xpr3, &Ypr3, &Xpr4, &Ypr4); Sharik3 (&x3, &y3, &vx3, &vy3, &v3, &dt, &Xpr, &Ypr, &Xpr1, &Ypr1, &Xpr2, &Ypr2, &Xpr3, &Ypr3, &Xpr4, &Ypr4); //Chit (&v1); txSleep (3); } }
void Xfor(int koor, int how) { for (int i = 0; i < 5; i++) { koor = koor + how; txSleep(6); } }
int main () { int n = 0; SortingAlgorithm sortAlgArray[SORT_ALG_ARRAY_SIZE] = { SortingAlgorithm ( bubbleSort, { 12, 205, 90}, n++, Mode (0, 2)), SortingAlgorithm ( selectionSort, {205, 12, 90}, n++, Mode (0, 2)), SortingAlgorithm ( insertionSort, { 12, 90, 205}, n++, Mode (0, 2)), SortingAlgorithm (binaryInsertionSort, {112, 90, 155}, n++, Mode (0, 2)) }; Button buttonArray[BUTTON_ARRAY_SIZE] = { Button (Point ( 0, 0), 0, 0, "BubbleSort" ), Button (Point ( 0, 0), 0, 0, "SelectionSort" ), Button (Point ( 0, 0), 0, 0, "InsertionSort" ), Button (Point ( 0, 0), 0, 0, "BinaryInsertionSort"), Button (Point (130, 405), 140, 30, "Now watching:" ), Button (Point ( 4, 367), 56, 26, "Play/Stop" ) }; distributeButtons (buttonArray, BUTTON_ARRAY_SIZE, 4, Point (654, 140), Point (954, 440)); Mode mode = Mode(COMPS, 3), updateGraphic = Mode( 1, 2); _txWindowStyle &= ~WS_CAPTION; txCreateWindow (WIDTH, HEIGHT); txTextCursor (false); HDC background = txLoadImage ("sortTube.bmp"); assert (background); while (!GetAsyncKeyState (VK_ESCAPE)) { txBegin (); txBitBlt (txDC (), 0, 0, 960, 480, background); txClearConsole (); calculations (sortAlgArray, SORT_ALG_ARRAY_SIZE, buttonArray, BUTTON_ARRAY_SIZE, &mode, &updateGraphic); //rendering (sortAlgArray, SORT_ALG_ARRAY_SIZE, buttonArray, BUTTON_ARRAY_SIZE, mode); txEnd (); txSleep (1000/30); } txDeleteDC (background); return 0; }
void TitryEnd() { int t = 0; while (t <= 100) { t++; txTextOut (-100+t*13, 200, "Конец первой части"); txSleep (50); txSetFillColor (TX_WHITE); txClear (); } }
void TextOut() { int t = 0; while (t <= 100) { t++; txSetColor (TX_BLACK); txTextOut (470, 10+t*6, "Привет!"); txSleep(70); txClear(); } }
void GoatLove() { int t = 0; txPlaySound ("kzl.wav"); while (t <= 50) { t++; txTextOut (500, 350, "И его все любили"); FxDrawGoat (500, 150, t%2*20, 0, 1, 0, 0, 0); FxDrawMan (800, 150, t%2*20, t%2*20, 0); txSleep (100); txSetFillColor (TX_WHITE); txClear(); } }
int main () { _txWindowStyle &= ~ WS_CAPTION; txCreateWindow (XWindow, YWindow); C_Ball ball [4500] = {}; Mass_Ball (ball, 4500); for (int i = 0;; i++) { txBegin (); if (!GetAsyncKeyState (VK_SPACE)) { txSetFillColor (TX_BLACK); txSetColor (TX_BLACK); txClear (); } Dvig_and_draw (ball, 4500); txSleep (0); txEnd (); } }
void Titry() { int t = 0; while (t <= 100) { t++; FxDrawGoat (500, 350, 0, 0, 1, 0, 0, 5); txTextOut (-600+t*18, 200, "История одного козла (Автор: Иван Черемисенов)"); txSleep (70); txSetFillColor (TX_WHITE); txClear (); } }
void MoveShar () { int x = 100, y = 100; int x1 = 1000, y1 = 700; int x2 = 500, y2 = 300; int x3 = 800, y3 = 500; int x4 = 906, y4 = 701; int vx = 3, vy = 0; int vx1 = -3, vy1 = 0; int vx2 = -3, vy2 = 3; int vx3 = 4, vy3 = 4; int vx4 = 5, vy4 = -5; double dt = 1; double v = 3; double Diametr = 20; double Diametr1 = 10; while (!GetAsyncKeyState(VK_ESCAPE)) { if (!GetAsyncKeyState (VK_SPACE)) { txSetFillColor (TX_BLACK); txFloodFill (1600, 100); txClear (); } dt = dt + 0.001; Score (dt, 750, 50); DrawShar (x, y, Diametr, TX_LIGHTBLUE); DrawShar (x1, y1, Diametr, TX_LIGHTGREEN); DrawShar (x2, y2, Diametr, TX_RED); DrawShar (x3, y3, Diametr, TX_RED); DrawShar (x4, y4, Diametr, TX_RED); Sharik (&x, &y, &vx, &vy, &v, &dt); Sharik1 (&x1, &y1, &vx1, &vy1, &v, &dt); Sharik_COMP (&x2, &y2, &vx2, &vy2, &v, &dt); Sharik_COMP (&x3, &y3, &vx3, &vy3, &v, &dt); Sharik_COMP (&x4, &y4, &vx4, &vy4, &v, &dt); if (Dist (x1, y1, x2, y2) <= 15 + 15) { txSetFillColor (TX_BLACK); txFloodFill (1600, 100); txClear (); text ("Win 2!", 100, 200, TX_LIGHTBLUE); break; } if (Dist (x1, y1, x3, y3) <= 15 + 15) { txSetFillColor (TX_BLACK); txFloodFill (1600, 100); txClear (); text ("Win 2!", 100, 200, TX_LIGHTBLUE); break; } if (Dist (x, y, x2, y2) <= 15 + 15) { txSetFillColor (TX_BLACK); txFloodFill (1600, 100); txClear (); text ("Win 1!", 100, 200, TX_LIGHTGREEN); break; } if (Dist (x, y, x3, y3) <= 15 + 15) { txSetFillColor (TX_BLACK); txFloodFill (1600, 100); txClear (); text ("Win 1!", 100, 200, TX_LIGHTGREEN); break; } if (Dist (x, y, x4, y4) <= 15 + 15) { txSetFillColor (TX_BLACK); txFloodFill (1600, 100); txClear (); text ("Win 1!", 100, 200, TX_LIGHTGREEN); break; } if (Dist (x1, y1, x4, y4) <= 15 + 15) { txSetFillColor (TX_BLACK); txFloodFill (1600, 100); txClear (); text ("Win 2!", 100, 200, TX_LIGHTBLUE); break; } txSleep (0); } }
int MovingOn (/* const */char allMap [MASSLAYER][MASSSIZE][MASSSIZE], int layer, int* pos, int x, int y, int* nyamka) { HDC WallImage = txLoadImage("images/DoorMetall.bmp"); HDC DoorImage = txLoadImage("images/spinportal.bmp"); HDC FloorImage = txLoadImage("images/plitkafloor.bmp"); HDC FoodImage = txLoadImage("images/edaplitka.bmp"); HDC KnifeImage = txLoadImage("images/plasma-bulb.bmp"); int vy = 0; int vx = 0; int t = 0; int colo = TX_BLACK; HDC KNIF = KnifeImage; txBegin (); while (true) { txSetFillColor (MEOW_COLOR); txClear(); DrawKarta (0, 0, 1 * SIZEB, 1 * SIZEB, allMap, layer, FoodImage, WallImage, DoorImage, FloorImage, KNIF); if (t % 16 == 1) { if (KNIF == KnifeImage) KNIF = FloorImage; else if (KNIF == FloorImage) KNIF = KnifeImage; } MovePelByXY (&x, &y, &vx, &vy, allMap, layer); pelmen (x, y, 15, 6, 6, t % 15, t % 15); if (allMap [layer][YM][XM] == 'w') *pos = 1; else if (allMap [layer][YM][XM] == 'v') *pos = 2; else if (allMap [layer][YM][XM] == 'y') *pos = 3; else if (allMap [layer][YM][XM] == 'z') *pos = 4; if (allMap[layer][YM][XM] == NYAM) { allMap[layer][YM][XM] = SPACE; *nyamka = *nyamka += 1; } if (allMap [layer][YM][XM] == WIN) return 1; if (allMap [layer][YM][XM] == 'A') return 2; if (allMap [layer][YM][XM] == 'B') return 3; if (allMap [layer][YM][XM] == 'C') return 4; if (allMap[layer][YM][XM] == KNIFE) if (KNIF == KnifeImage) return 0; t++; txSleep (30); } txEnd(); txDeleteDC (WallImage); txDeleteDC (DoorImage); txDeleteDC (FloorImage); txDeleteDC (FoodImage); txDeleteDC (KnifeImage); }
void MoveShar () { double x = 100, y = 100; double vx = 0, vy = 0; double dt = 1; int Xpr = 600, Ypr = 400; int Xpr1 = 400, Ypr1 = 600; int Xpr2 = 1200, Ypr2 = 450; int Xpr3 = 100, Ypr3 = 600; int Xpr4 = 300, Ypr4 = 300; double v = 3; double Diametr = 20; double Heart = 5; while (!GetAsyncKeyState(VK_ESCAPE)) { txSetColor (RGB(random (0, +255), random (0, +255), random (0, +255))); txSetFillColor (RGB(random (0, +255), random (0, +255), random (0, +255))); txCircle (x, y, Diametr); Prepyatstvie (Xpr, Ypr); Prepyatstvie (Xpr1, Ypr1); Prepyatstvie (Xpr2, Ypr2); Prepyatstvie (Xpr3, Ypr3); Prepyatstvie (Xpr4, Ypr4); Score (dt, 750, 50); Score (Heart, 550, 50); dt = dt + 0.001; x = x + vx * dt; y = y + vy * dt; if (x < 0) { vy = -10000; vx = -10000; txSetFillColor (TX_BLACK); txFloodFill (1600, 100); txClear (); text ("Game Over!", 100, 200); } if (x > 1500) { vy = 10000; vx = 10000; txSetFillColor (TX_BLACK); txFloodFill (1600, 100); txClear (); text ("Game Over!", 100, 200); } if (y > 800) { vy = 10000; vx = 10000; txSetFillColor (TX_BLACK); txFloodFill (1600, 100); txClear (); text ("Game Over!", 100, 200); } if (y < 0) { vy = -10000; vx = -10000; txSetFillColor (TX_BLACK); txFloodFill (1600, 100); txClear (); text ("Game Over!", 100, 200); } if (GetAsyncKeyState(VK_UP)) { vx = 0; vy = -v; } if (GetAsyncKeyState(VK_LEFT)) { vy = 0; vx = -v; } if (GetAsyncKeyState(VK_DOWN)) { vx = 0; vy = v; } if (GetAsyncKeyState(VK_RIGHT)) { vy = 0; vx = v; } if (-20 < Xpr - x and Xpr - x < 20 and -50 < Ypr - y and Ypr - y < 50) { Heart = Heart - 1; } if (-20 < Xpr3 - x and Xpr3 - x < 20 and -50 < Ypr3 - y and Ypr3 - y < 50) { Heart = Heart - 1; } if (-20 < Xpr2 - x and Xpr2 - x < 20 and -50 < Ypr2 - y and Ypr2 - y < 50) { Heart = Heart - 1; } if (-20 < Xpr1 - x and Xpr1 - x < 20 and -50 < Ypr1 - y and Ypr1 - y < 50) { Heart = Heart - 1; } if (-20 < Xpr4 - x and Xpr4 - x < 20 and -50 < Ypr4 - y and Ypr4 - y < 50) { Heart = Heart - 1; } if (GetAsyncKeyState (VK_SPACE)) { txSetFillColor (TX_BLACK); txFloodFill (1600, 100); txClear (); } if (GetAsyncKeyState ('L')) { v = 1; } if (Heart < 0) { vx = 0; vy = 0; txSetFillColor (TX_BLACK); txFloodFill (1600, 100); txClear (); text ("Game over!", 100, 200); } if (dt > 3) { Heart = Heart + 0.002; } txSleep (2); } }
void MoveShar () { int x = 100, y = 100; int x1 = 1000, y1 = 700; int x2 = 500, y2 = 300; int x3 = 800, y3 = 500; int vx = 3, vy = 0; int vx1 = -3, vy1 = 0; int vx2 = -3, vy2 = 3; int vx3 = 4, vy3 = 4; int Xpr = 600, Ypr = 400; int Xpr1 = 400, Ypr1 = 600; int Xpr2 = 1200, Ypr2 = 450; int Xpr3 = 100, Ypr3 = 600; int Xpr4 = 300, Ypr4 = 300; double dt = 1; double v = 3; double r = 20; while (!GetAsyncKeyState(VK_ESCAPE)) { if (!GetAsyncKeyState (VK_SPACE)) { txSetFillColor (TX_BLACK); txFloodFill (1600, 100); txClear (); } dt = dt + 0.001; Score (dt, 750, 50); DrawShar (x, y, r, TX_LIGHTBLUE); DrawShar (x1, y1, r, TX_LIGHTGREEN); DrawShar (x2, y2, r, TX_RED); DrawShar (x3, y3, r, TX_RED); Prepyatstvie (Xpr, Ypr); Prepyatstvie (Xpr1, Ypr1); Prepyatstvie (Xpr2, Ypr2); Prepyatstvie (Xpr3, Ypr3); Prepyatstvie (Xpr4, Ypr4); Stolknov_s_Prep_COMP (x2, y2, &vx2, &vy2, Xpr, Ypr); Stolknov_s_Prep_COMP (x2, y2, &vx2, &vy2, Xpr1, Ypr1); Stolknov_s_Prep_COMP (x2, y2, &vx2, &vy2, Xpr2, Ypr2); Stolknov_s_Prep_COMP (x2, y2, &vx2, &vy2, Xpr3, Ypr3); Stolknov_s_Prep_COMP (x2, y2, &vx2, &vy2, Xpr4, Ypr4); Stolknov_s_Prep_COMP (x3, y3, &vx3, &vy3, Xpr, Ypr); Stolknov_s_Prep_COMP (x3, y3, &vx3, &vy3, Xpr1, Ypr1); Stolknov_s_Prep_COMP (x3, y3, &vx3, &vy3, Xpr2, Ypr2); Stolknov_s_Prep_COMP (x3, y3, &vx3, &vy3, Xpr3, Ypr3); Stolknov_s_Prep_COMP (x3, y3, &vx3, &vy3, Xpr4, Ypr4); Stolknov_s_Prep (TX_LIGHTGREEN, "Win 1!", x, y, &vx, &vy, Xpr, Ypr); Stolknov_s_Prep (TX_LIGHTGREEN, "Win 1!", x, y, &vx, &vy, Xpr1, Ypr1); Stolknov_s_Prep (TX_LIGHTGREEN, "Win 1!", x, y, &vx, &vy, Xpr2, Ypr2); Stolknov_s_Prep (TX_LIGHTGREEN, "Win 1!", x, y, &vx, &vy, Xpr3, Ypr3); Stolknov_s_Prep (TX_LIGHTGREEN, "Win 1!", x, y, &vx, &vy, Xpr4, Ypr4); Stolknov_s_Prep (TX_LIGHTBLUE, "Win 2!", x1, y1, &vx1, &vy1, Xpr, Ypr); Stolknov_s_Prep (TX_LIGHTBLUE, "Win 2!", x1, y1, &vx1, &vy1, Xpr1, Ypr1); Stolknov_s_Prep (TX_LIGHTBLUE, "Win 2!", x1, y1, &vx1, &vy1, Xpr2, Ypr2); Stolknov_s_Prep (TX_LIGHTBLUE, "Win 2!", x1, y1, &vx1, &vy1, Xpr3, Ypr3); Stolknov_s_Prep (TX_LIGHTBLUE, "Win 2!", x1, y1, &vx1, &vy1, Xpr4, Ypr4); Sharik (&x, &y, &vx, &vy, &v, &dt, r); Sharik1 (&x1, &y1, &vx1, &vy1, &v, &dt, r); Sharik_COMP (&x2, &y2, &vx2, &vy2, &v, &dt, r); Sharik_COMP (&x3, &y3, &vx3, &vy3, &v, &dt, r); if (Dist (x1, y1, x2, y2) <= r + r) { txSetFillColor (TX_BLACK); txFloodFill (1600, 100); txClear (); text ("Win 2!", 100, 200, TX_LIGHTBLUE); break; } if (Dist (x1, y1, x3, y3) <= r + r) { txSetFillColor (TX_BLACK); txFloodFill (1600, 100); txClear (); text ("Win 2!", 100, 200, TX_LIGHTBLUE); break; } if (Dist (x, y, x2, y2) <= r + r) { txSetFillColor (TX_BLACK); txFloodFill (1600, 100); txClear (); text ("Win 1!", 100, 200, TX_LIGHTGREEN); break; } if (Dist (x, y, x3, y3) <= r + r) { txSetFillColor (TX_BLACK); txFloodFill (1600, 100); txClear (); text ("Win 1!", 100, 200, TX_LIGHTGREEN); break; } if (Dist (x, y, x1, y1) <= r + r) { vx = -2 * vx; vy = -2 * vy; vx1 = -2 * vx1; vy1 = -2 * vy1; } txSleep (5); } }
void fizic () { int i = 0, k = 0; CBall Mol [3200] = {}; CBall Mol2 [3200] = {}; txTextCursor (false); double time = 0; int davlenK = 0, davlenK_s = 0; int davlenN = 0, davlenN_s = 0; int K = 0, N = 0; int t = 0; double X_Sten = XWindow / 2, X_Sten_S = XWindow / 2; double temper = 0; double temper_s = 0; int Zoom = 0; int interv = 0; int l1 = 0, l2 = 0; Dlya_Graf (); HDC Molekula = txLoadImage ("Image//Молекула гелия.bmp"); HDC Molekula2 = txLoadImage ("Image//Молекула 3.bmp"); Mass1 (Mol , N); Mass2 (Mol2, K); text ("Для помощи нажмите I", XWindow / 2 + 30, YWindow - 40, TX_GREEN, 30, 8); while (!GetAsyncKeyState (VK_ESCAPE)) { txBegin (); kolba (); //txSetColor (TX_WHITE); //Clear (XWindow - 510, YWindow - 90, XWindow - 120, YWindow - 10); txSetColor (RGB(0, 0, 255), 7); txLine (X_Sten, 250, X_Sten, YWindow); if (GetAsyncKeyState (VK_RIGHT)) X_Sten ++; if (GetAsyncKeyState (VK_LEFT)) X_Sten --; else if (X_Sten < 200 && i + k > 150) X_Sten += 0.25; if (X_Sten > XWindow / 2) X_Sten = XWindow / 2; if (X_Sten < 125) X_Sten = 125; Ottalkiv (i, Mol, &temper); Ottalkiv (k, Mol2, &temper); for (K = 0; K < k; K++) { Molek (&Mol2 [K], X_Sten); kart (&Mol2 [K], Molekula2); if (Mol2[K].y - Mol2[K].rad == 250)davlenK += 2; temper += temp (Mol2 [K].vx, Mol2 [K].vy); //if (GetAsyncKeyState ('G')) Mol2 [K].vy -= 0.05; } for (N = 0; N < i; N++) { Molek (&Mol [N], X_Sten); kart (&Mol [N], Molekula); if (Mol[N].y - Mol[N].rad == 250) davlenN ++; temper += temp (Mol [N].vx, Mol [N].vy); //if (GetAsyncKeyState ('G')) Mol [N].vy -= 0.05; } if (t > 75) { Manometr (davlenK, XWindow / 2 - 150, 110, TX_WHITE, "Давление оранжевых:"); Manometr (davlenN, XWindow / 2 - 350, 110, TX_WHITE, "Давление зеленых:"); Grafik (X_Sten_S + XWindow / 2 - 100/*XWindow / 2 + time + 2*/, temper_s / 5, X_Sten + XWindow / 2 - 100/*XWindow / 2 + time + 2 + 0.05 * 75*/, temper / 5); t = 0; davlenK_s = davlenK; davlenN_s = davlenN; temper_s = temper; X_Sten_S = X_Sten; davlenK = 0; davlenN = 0; } if (temper > 70000) { while (Zoom < 2500) { vzriv (Zoom, X_Sten / 2, YWindow / 2); Zoom += 10; txSleep (0); } text ("Максимальная температура превышена :(", XWindow / 2 - 500, YWindow / 2, RGB(0, 255, 0), 50, 25); //txMessageBox ("Вы взорвались!", ":( :(", 2); /*if (txMessageBox ("Вы взорвались!", ":( :(", 2) == IDABORT) _txExit = true;*/ break; //if (txMessageBox ("Вы взорвались!", ":( :(", 2) == IDABORT) } Manometr (i + k, 150, 110, TX_WHITE, "Количество:"); if (temper > 50000) { text ("!!!Температура очень высокая!!!", XWindow - 500, YWindow - 50, RGB(255, 0, 0), 25, 12); Manometr (temper, 370, 110, RGB (255, 255 - (temper - 50000) * 255 / 20000, 255 - (temper - 50000) * 255 / 20000), "Температура:"); } else { Manometr (temper, 370, 110, TX_WHITE, "Температура:"); } if (i == 0) if (peregorodka() == true) i += 1; if (i > 0 && i < 3200) if (peregorodka() == true && l1 > 2) { i += 1; l1 = 0; } if (k == 0) if (peregorodka2() == true) k += 1; if (k > 0 && k < 3200) if (l2 > 4 && peregorodka2() == true) { k += 1; l2 = 0; } if (GetAsyncKeyState ('R')) { i = 0, k = 0; Mass1 (Mol, N); Mass2 (Mol2, K); } if (GetAsyncKeyState ('W') && i > 0) { i--; Mol [i].x = 0; Mol [i].y = 325; } if (GetAsyncKeyState ('X') && k > 0) { k--; Mol [k].x = 0; Mol [k].y = YWindow - 75; } if (GetAsyncKeyState ('I')) { text ("Нажмите A что-бы добавить молекулу 1 вида", 30, YWindow / 2 - 90, TX_GREEN, 30, 8); text ("Нажмите D что-бы добавить молекулу 2 вида", 30, YWindow / 2 - 55, TX_GREEN, 30, 8); text ("Нажмите W что-бы удалить молекулу 1 вида", 30, YWindow / 2 - 20, TX_GREEN, 30, 8); text ("Нажмите X что-бы удалить молекулу 2 вида", 30, YWindow / 2 + 20, TX_GREEN, 30, 8); text ("Нажмите R что-бы удалить молекулы всех видов", 30, YWindow / 2 + 90, TX_GREEN, 30, 8); text ("Движение перегородки стрелками", 30, YWindow / 2 + 55, TX_GREEN, 30, 8); //text ("Нажмите G и включится гравитация", 30, YWindow / 2 + 125, TX_GREEN, 30, 8); } l1 ++; l2 ++; time += 0.05; t++; interv++; temper = 0; txEnd (); } txDeleteDC (Molekula); txDeleteDC (Molekula2); }
void MoveShar () { CBall Ball [6] = {{750, 400, 0, 0, 25, 3}}; CBall sn1 = {0, 0, 5, 5, 8}; CBall sn2 = {1500, 0, 5, 5, 8}; CBall sn3 = {1500, 800, 5, 5, 8}; CBall sn4 = {0, 800, 5, 5, 8}; CBall snbig1 = {sn1.x, sn2.y, 5, 5, 16}; CBall snbig2 = {sn3.x, sn4.y, 5, 5, 16}; CBall snBIGG = {snbig1.x, snbig2.y, 5, 5, 32}; double t = 0; double dt = 1; int N = 6; int i = 1; HDC vrag = txLoadImage ("vrag.bmp"); HDC igrok = txLoadImage ("igrok.bmp"); HDC fon = txLoadImage ("fon1.bmp"); HDC snaryad1 = txLoadImage ("снаряд20.bmp"); HDC snaryad2 = txLoadImage ("снаряд40.bmp"); HDC snaryad3 = txLoadImage ("снаряд80.bmp"); while (!GetAsyncKeyState(VK_ESCAPE)) { txSetFillColor (TX_BLACK); txClear (); txBitBlt (txDC (), 0, 0, 1500, 800, fon, 0, 0); txTransparentBlt (txDC (), Ball[0].x - Ball[0].rad, Ball[0].y - Ball[0].rad, 50, 50, igrok, 0, 0, TX_WHITE); Upravlenie (&Ball[0], dt); //----------------Mass------------------ while (i < N) { Ball[i].x = random (20, 1480); Ball[i].y = random (20, 780); Ball[i].vx = random (1.5, 3.5); Ball[i].vy = random (1.5, 3.5); Ball[i].rad = 30; i++; } All_Vrag (Ball, vrag, dt, N); i = 1; while (i < N) { if (Dist (Ball[i], Ball[0]) <= Ball[i].rad + Ball[0].rad) { txMessageBox ("Вы съедены!!!", "Поражение", 0); break; } i++; } //--------------Chit------------------------ if (GetAsyncKeyState ('L')) { Stena (&Ball[0]); } else { if (Ball[0].x + Ball[0].rad > 1500 || Ball[0].x - Ball[0].rad < 0 || Ball[0].y + Ball[0].rad > 800 || Ball[0].y - Ball[0].rad < 0 ) { txMessageBox ("Вы задохнулись!!!", "Поражение", 0); break; } } //-----------Snaryadi----------------------- Snaryad_polnost (&sn1, &sn2, &sn3, &sn4, &snbig1, &snbig2, &snBIGG, snaryad1, snaryad2, snaryad3, &Ball[0], dt); if (Dist (sn1, Ball[0]) <= sn1.rad + Ball[0].rad || Dist (sn2, Ball[0]) <= sn2.rad + Ball[0].rad || Dist (sn3, Ball[0]) <= sn3.rad + Ball[0].rad || Dist (sn4, Ball[0]) <= sn4.rad + Ball[0].rad || Dist (snbig1, Ball[0]) <= snbig1.rad + Ball[0].rad || Dist (snbig2, Ball[0]) <= snbig2.rad + Ball[0].rad || Dist (snBIGG, Ball[0]) <= snBIGG.rad + Ball[0].rad ) { txMessageBox ("Вы сгорели!!!", "Поражение", 0); break; } //-------------Pobeda------------ t += 0.005; Score (t, 750, 20); if (t > 20) { txMessageBox ("Победа!!!", "Победа", 0); break; } //------------------------------- txSleep (0); } txDeleteDC (vrag); txDeleteDC (igrok); txDeleteDC (fon); txDeleteDC (snaryad1); txDeleteDC (snaryad2); txDeleteDC (snaryad3); }
int main() { txCreateWindow(SX * 2, SY * 2); txTextCursor(false); SetWindowText(txWindow(), "Illusions"); Illusions illus[ILLUSIONS] = {}; HDC skins[ILLUSIONS] = {txLoadImage("WTF.bmp"), txLoadImage("Cat.bmp"), txLoadImage("Packman.bmp"), txLoadImage("Spiral.bmp"), txLoadImage("Sphere.bmp"), txLoadImage("Figure.bmp"), txLoadImage("DINOSOWER.bmp"), txLoadImage("Packman2.bmp"), txLoadImage("Cab.bmp"), txLoadImage("Cab2.bmp"), txLoadImage("Head.bmp"), txLoadImage("6terna.bmp"), txLoadImage("6terna4.bmp"), txLoadImage("bike.bmp"), txLoadImage("Ўарик.bmp"), txLoadImage("fish.bmp"), txLoadImage("kriper.bmp"), txLoadImage("WTF2.bmp"), txLoadImage("kub.bmp"), txLoadImage("water.bmp"), txLoadImage("serdce.bmp")}; HDC transparent = txLoadImage("Transparent5.bmp"); double x = -450, y = 25; for(int i = 0; i < ILLUSIONS; i++) illus[i].SetSkin(skins[i]); illus[0].show = true; while(!Key(27)) { txBegin(); txSetFillColor(TX_BLACK); txClear(); for(int i = 0; i < ILLUSIONS; i++) { if(illus[i].show) { txBitBlt(txDC(), illus[i].x, illus[i].y, X_DEST * 2, Y_DEST * 2, illus[i].skin, 0, 0); if(Key('1')) { if(i > 0) illus[i].show = false, illus[i - 1].show = true; else illus[i].show = false, illus[ILLUSIONS - 1].show = true; } if(Key('2')) { if(i < ILLUSIONS - 1) illus[i].show = false, illus[i + 1].show = true; else illus[i].show = false, illus[ 0].show = true; } while(Key('1') || Key('2')) txSleep (1); } } if(Key(VK_LEFT )) x -= 0.25; if(Key(VK_RIGHT)) x += 0.25; if(Key(VK_UP )) y--; if(Key(VK_DOWN )) y++; txTransparentBlt(txDC(), x, y, X_DEST * 4, Y_DEST * 2, transparent, 0, 0, TX_WHITE); txEnd(); } txDeleteDC(transparent); return 0; }