Exemple #1
0
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;

    }
void Pr (COLORREF color, const char* text1, int* x, int* y, int* vx, int* vy, int* Xpr, int* Ypr, int* Xpr1, int* Ypr1, int* Xpr2, int* Ypr2, int* Xpr3, int* Ypr3, int* Xpr4, int* Ypr4)
    {
        if (-20 < *Xpr - *x and *Xpr - *x < 20 and -50 < *Ypr - *y and *Ypr - *y < 50)
            {
            *vx = 0;
            *vy = 0;
            txSetFillColor (TX_BLACK);
            txFloodFill (1600, 100);
            txClear ();
            text (text1, 100, 200, color);
            }
        if (-20 < *Xpr3 - *x and *Xpr3 - *x < 20 and -50 < *Ypr3 - *y and *Ypr3 - *y < 50)
            {
            *vx = 0;
            *vy = 0;
            txSetFillColor (TX_BLACK);
            txFloodFill (1600, 100);
            txClear ();
            text (text1, 100, 200, color);
            }
        if (-20 < *Xpr2 - *x and *Xpr2 - *x < 20 and -50 < *Ypr2 - *y and *Ypr2 - *y < 50)
            {
            *vx = 0;
            *vy = 0;
            txSetFillColor (TX_BLACK);
            txFloodFill (1600, 100);
            txClear ();
            text (text1, 100, 200, color);
            }
        if (-20 < *Xpr1 - *x and *Xpr1 - *x < 20 and -50 < *Ypr1 - *y and *Ypr1 - *y < 50)
            {
            *vx = 0;
            *vy = 0;
            txSetFillColor (TX_BLACK);
            txFloodFill (1600, 100);
            txClear ();
            text (text1, 100, 200, color);
            }
        if (-20 < *Xpr4 - *x and *Xpr4 - *x < 20 and -50 < *Ypr4 - *y and *Ypr4 - *y < 50)
            {
            *vx = 0;
            *vy = 0;
            txSetFillColor (TX_BLACK);
            txFloodFill (1600, 100);
            txClear ();
            text (text1, 100, 200, color);
            }
    }
int main()
    {
    txCreateWindow (sizeX, sizeY);

    palochka Main[ColVo];

    while (!GetAsyncKeyState (VK_ESCAPE))
        {
        txBegin ();
        txSetFillColor (TX_BLACK);
        txSetColor     (TX_BLACK);
        txClear ();

        for (int i = 0; i < ColVo; i++)
            {
            all_fizics(&(Main[i]));

            print_palochka (Main[i]);
            }

        txEnd   ();
        }

    return 0;
    }
Exemple #4
0
void Kot ()
    {

    HDC Kot  = txLoadImage ("Image//Кот.bmp");

    double x = random (XWindow / 2 + 300, XWindow / 2 - 300), y = random (YWindow / 2 - 300, YWindow / 2 + 300);
    double a = random (-300, 300), b = random (-300, 300);

    while (!GetAsyncKeyState (VK_ESCAPE))
        {
        txBegin ();
        txSetFillColor (TX_WHITE);
        txClear ();
        if (GetAsyncKeyState('A')) x-=2;
        if (GetAsyncKeyState('D')) x+=2;
        if (GetAsyncKeyState('W')) y-=2;
        if (GetAsyncKeyState('S')) y+=2;
        txTransparentBlt (txDC (), x, y, 92, 41, Kot, 0, 0, TX_WHITE);
        if (abs (x - x + a) > 35 + 10)txBitBlt (txDC (), x + a, y + b, 38, 20, Kot, 113, 10);
        if (x < 0) x = XWindow;
        if (x > XWindow) x = 0;
        if (y < 0) y = YWindow;
        if (y > YWindow) y = 0;

        txEnd ();
        }
    txDeleteDC (Kot);
    }
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);
        }
    }
Exemple #6
0
int main()
    {

    txCreateWindow (1200, 700);
    txSetFillColor (TX_WHITE);
    txClear();

    TextOut();

    }
void Stolknov_s_Prep (COLORREF color, const char* text1, int x, int y, int* vx, int* vy, int Xpr, int Ypr)
    {
    if (-30 <= Xpr - x && Xpr - x <= 30 && 7 -60 <= Ypr - y && Ypr - y <= 60)
        {
        *vx = 0;
        *vy = 0;
        txSetFillColor (TX_BLACK);
        txFloodFill (1600, 100);
        txClear ();
        text (text1, 100, 200, color);
        }
    }
void ogranich (int* x, int* y, int* vx, int*vy, const char* text1, COLORREF color)
    {
        if (*x < 0)
            {
            *vy = -10000;
            *vx = -10000;
            txSetFillColor (TX_BLACK);
            txFloodFill (1600, 100);
            txClear ();
            text (text1, 100, 200, color);
            }
        if (*x > 1500)
            {
            *vy = 10000;
            *vx = 10000;
            txSetFillColor (TX_BLACK);
            txFloodFill (1600, 100);
            txClear ();

            text (text1, 100, 200, color);
            }
        if (*y > 800)
            {
            *vy = 10000;
            *vx = 10000;
            txSetFillColor (TX_BLACK);
            txFloodFill (1600, 100);
            txClear ();
            text (text1, 100, 200, color);
            }
        if (*y < 0)
            {
            *vy = -10000;
            *vx = -10000;
            txSetFillColor (TX_BLACK);
            txFloodFill (1600, 100);
            txClear ();
            text (text1, 100, 200, color);
            }
    }
Exemple #9
0
void TitryEnd()
    {
    int t = 0;
    while (t <= 100)
        {
        t++;

        txTextOut (-100+t*13, 200, "Конец первой части");

        txSleep (50);

        txSetFillColor (TX_WHITE);
        txClear ();

        }
    }
Exemple #10
0
void Setka (double zoom, double a, double b, double PerX, double PerY)
    {
    txBegin ();

    txSetFillColor (TX_BLACK);
    txClear ();

    txSetColor (TX_WHITE, 3);
    txLine (0, b / 2, XWindow, b / 2);
    txLine (a / 2, 0, a / 2, YWindow);
    txLine (XWindow, b / 2, XWindow - 30, b / 2 - 15);
    txLine (XWindow, b / 2, XWindow - 30, b / 2 + 15);
    txLine (a / 2, 0, a / 2 + 15, 30);
    txLine (a / 2, 0, a / 2 - 15, 30);

    txEnd ();
    }
Exemple #11
0
void TextOut()
    {

    int t = 0;

    while (t <= 100)
        {
        t++;

        txSetColor (TX_BLACK);
        txTextOut (470, 10+t*6, "Привет!");

        txSleep(70);
        txClear();

        }

    }
Exemple #12
0
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 ();
    }
}
Exemple #13
0
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();
        }
    }
Exemple #14
0
void Osnov ()
    {
    double Zoom = 30;
    COLORREF color = TX_WHITE;
    double perX = 0, perY = 0;
    Setka (Zoom, XWindow, YWindow, 0, 0);
    int t = 0;

    while (!GetAsyncKeyState (VK_ESCAPE))
        {
        txBegin ();
        txClear ();

        //Mass_Nerav (Kn_Ner, Kn_NerN, color, Zoom, image, perX, perY);
        Neravenstvo (Zoom, TX_GREEN, Cheburashka, t%2, t%2, t%12, 1, 0, perX, perY);

        t ++;
        txEnd ();
        }
    }
Exemple #15
0
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 ();

        }


    }
Exemple #16
0
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;
    }
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);
    }
Exemple #18
0
void clearw (Stack* stk)
{
int R = stk->pop (), G = stk->pop (), B = stk->pop ();
txSetFillColor (RGB (R, G, B));
txClear ();
}
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 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);
        }
    }
Exemple #21
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 ()
    {
    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);
        }
    }
Exemple #23
0
int main()
    {
     _txWindowStyle &= ~ WS_CAPTION;

    txCreateWindow (XWindow, YWindow);

    int sz = 15;

    CBall  Ball [15] = {};

    Mass1 (Ball, sz);
    //double x = 0, y = 0, z = 0;
    //double vx = 0.06, vy = 0.04, vz = 0.02, dt = 1;
    while (!GetAsyncKeyState (VK_ESCAPE))
        {
        txSetFillColor (TX_WHITE);
        txBegin();
        txClear ();

        txSetColor (TX_BLUE, 5);
        Line3D ( 1,  1,  1, -1,  1,  1);
        Line3D (-1,  1, -1,  1,  1, -1);
        Line3D (-1,  1, -1, -1,  1,  1);
        Line3D ( 1,  1,  1,  1,  1, -1);

        txSetColor (TX_BROWN, 5);
        Line3D (-1, -1,  1, -1, -1, -1);
        Line3D ( 1, -1,  1, -1, -1,  1);
        Line3D ( 1, -1, -1,  1, -1,  1);
        Line3D ( 1, -1, -1, -1, -1, -1);

        txSetColor (TX_GREEN, 5);
        Line3D (-1,  1,  1, -1, -1,  1);
        Line3D (-1,  1, -1, -1, -1, -1);
        Line3D ( 1,  1, -1,  1, -1, -1);
        Line3D ( 1,  1,  1,  1, -1,  1);

        printf ("%lf, %lf,\n",ZoomZ, zGlob);

        /*txSetColor (TX_ORANGE, 5);
        Line3D (0, 3, 0,  1, 1, -1);
        Line3D (0, 3, 0, -1, 1,  1);
        Line3D (0, 3, 0, -1, 1, -1);
        Line3D (0, 3, 0,  1, 1,  1);*/
        /*
        for (int K = 0; K < sz; K++)
            {
            Dvig (&Ball [K], 1, 1, 1);
            txSetColor (RGB(random (50, 250), random (50, 250), random (50, 250))
            , 5);
            txSetFillColor (RGB(random (50, 250), random (50, 250), random (50, 250)));
            Circle3D (Ball[K].x, Ball[K].y, Ball[K].z, Ball[K].rad);
            }
        */
        /*Line3D (0, 0, 0, 10, 0, 0);
        Line3D (0, 0, 0, 0, 10, 0);
        Line3D (0, 0, 0, 0, 0, 10);*/

        Skale3D ();
        Translete3D ();
        Rotate ();
        txEnd ();
        }
    return 0;
    }