Программирование компьютерной графики. Создание игры «Опасный лабиринт», страница 2

circle (xc, yc, 10);

}

void MenuShow (void) //галвное меню

{

setcolor (8);

settextstyle( DEFAULT_FONT, HORIZ_DIR, 40);

outtextxy (320,20,"Опасный лабиринт");

settextstyle( DEFAULT_FONT, HORIZ_DIR, 32 );

setcolor (3);

outtextxy (320,105, "Новая игра");

outtextxy (315,195, "Уровень");

settextstyle( DEFAULT_FONT, HORIZ_DIR, 20 );

outtextxy (315, 285, "Таблица рекордов");

settextstyle( DEFAULT_FONT, HORIZ_DIR, 32 );

outtextxy (320,370, "Выход");

setcolor (8);

line (0, 50, 50, 50);

line (100,0, 100, 100);

line (50,50, 50, 150);

line (50,150, 0,150);

line (100,100, 190,100);

line (190,100, 190,50);

line (190,50, 450,50);

line (450,50, 450,100);

line (450,100, 540,100);

line (540,100, 540,0);

line (640,50, 590,50);

line (590,50, 590,150);

line (590,150, 640,150);

line (540,150, 450,150);

line (540,150, 540,200);

line (540,200, 590,200);

line (100,150, 100, 200);

line (100,200, 50,200);

line (100,150, 190, 150);

line (190,150, 190,220);

line (50,200, 50,220);

line (50,220, 190,220);

line (190,270, 100,270);

line (100,270, 100,370);

line (100,370, 170,370);

line (170,370, 170,480);

line (0,270, 50,270);

line (50,270, 50,420);

line (50,420, 120,420);

line (120,420, 120,480);

line (590,200, 590,220);

line (590,220, 450,220);

line (450,220, 450,150);

line (450,270, 550,270);

line (550,270, 550,370);

line (550,370, 470,370);

line (470,370, 470,480);

line (590,270, 590,420);

line (590,420, 520,420);

line (520,420, 520,480);

line (590,270, 640,270);

line (190,270, 190,430);

line (190,430, 450,430);

line (450,430, 450,270);

setcolor (13);

rectangle (220,85, 420,135);

rectangle (220,175, 420,225);

rectangle (220,265, 420,315);

rectangle (220,355, 420,405);

}

void Pole (void) //прорисовка поля

{

setcolor(0);

rectangle(0,440,640,480);

setfillstyle( 1, 0);

floodfill(320, 460, 0);

setcolor (4);

line(0,440,640,440);

setcolor (3);

settextstyle( DEFAULT_FONT, HORIZ_DIR, 20 );

outtextxy( 40, 460, "Время:" );

outtextxy(235, 460, "Количество жизней:" );

}

void TheEnd (void) //конец

{

for (int m=1; m<15; m++)

{

setcolor (m);

settextstyle( DEFAULT_FONT, HORIZ_DIR, 32 );

outtextxy( 320, 200, "Congratulations!" );

outtextxy( 320, 240, "You Win!" );

sleep (100);

}

}    

void GameOver (void) //Конец игры.. =(

{

int key=0;

cleardevice();

setcolor (4);

settextstyle( DEFAULT_FONT, HORIZ_DIR, 40);

outtextxy (320,240,"Game over");

key=0;

while (key!=13)

key=getch();                 

cleardevice ();        

}

void IgrMenuShow (void) //прорисовка пользовательского меню

{

setcolor (8);

settextstyle( DEFAULT_FONT, HORIZ_DIR, 40);

outtextxy (320,20,"Опасный лабиринт");

settextstyle( DEFAULT_FONT, HORIZ_DIR, 32 );

setcolor (3);

outtextxy (320,105, "Продолжить");

outtextxy (315,195, "В главное меню");

settextstyle( DEFAULT_FONT, HORIZ_DIR, 20 );

outtextxy (315, 285, "Таблица рекордов");

settextstyle( DEFAULT_FONT, HORIZ_DIR, 32 );

outtextxy (320,370, "Выход");

setcolor (8);

line (0, 50, 50, 50);

line (100,0, 100, 100);

line (50,50, 50, 150);

line (50,150, 0,150);

line (100,100, 190,100);

line (190,100, 190,50);

line (190,50, 450,50);

line (450,50, 450,100);

line (450,100, 540,100);

line (540,100, 540,0);

line (640,50, 590,50);

line (590,50, 590,150);

line (590,150, 640,150);

line (540,150, 450,150);

line (540,150, 540,200);

line (540,200, 590,200);

line (100,150, 100, 200);

line (100,200, 50,200);

line (100,150, 190, 150);

line (190,150, 190,220);

line (50,200, 50,220);

line (50,220, 190,220);

line (190,270, 100,270);

line (100,270, 100,370);

line (100,370, 170,370);

line (170,370, 170,480);

line (0,270, 50,270);

line (50,270, 50,420);

line (50,420, 120,420);

line (120,420, 120,480);

line (590,200, 590,220);

line (590,220, 450,220);

line (450,220, 450,150);

line (450,270, 550,270);

line (550,270, 550,370);

line (550,370, 470,370);

line (470,370, 470,480);

line (590,270, 590,420);

line (590,420, 520,420);

line (520,420, 520,480);

line (590,270, 640,270);

line (190,270, 190,430);

line (190,430, 450,430);

line (450,430, 450,270);

setcolor (13);

rectangle (220,85, 420,135);

rectangle (220,175, 420,225);

rectangle (220,265, 420,315);

rectangle (220,355, 420,405);