MÔN KỸ THUẬT ĐỒ HỌA MÁY TÍNH
- Chúng ta sẽ học…
Các thuật toán đồ họa và lập trình đồ họa
Các cấu trúc dữ liệu đồ họa
Màu sắc và sức nhìn của con người(human vision)
Một số mô hình hình học–các mô hình và hiển thị - Đây là một môn Tin học!
BÀI DEMO CỦA SINH VIÊN KHÓA 2017 PHẦN 2
Sinh viên: Nguyễn Hoàng Nhi
#include <iostream>
#include <graphics.h>
#include <stdlib.h>
#include <time.h>
using namespace std;
char* luot_choi[]={"79","78","77","76","75","74","73","72","71","70","69","68","67","66","65","64","63","62","61","60","59","58","57","56","55","54","53","52","51","50","49","48","46","45","43","42","41","40","39","38","37","36","35","34","33","32","31","30","29","28","27","26","25","24","23","22","21","20","19","18","17","16","15","14","13","12","11","10","9","8","7","6","5","4","3","2","1","0"};
char* tinh_diem[]={"1","2","3","4","5","6","7"};
char* thoi_gian_xem[]={"1","2","3","4","5","6","7","8","9","10","11","12","13","14","15","16","17","18","19","20","21","22","23","24","25","26","27","28","29","30","31","32","33","34","35","36","37","38","39","40"};
int main()
{
initwindow(910,650);
int a=0;
int m=1;
char key;
int game=0;
int i = 0,j=0;
int dem=0;
int thu_tu=0;
int x=40,y=40;
int thu_tu_game_2 = 0;
while(a==0)
{
setcolor(14);
settextstyle(0,0,10);
outtextxy(100,100,"THU THACH ");
outtextxy(100,200," TRI NHO ");
setcolor(15);
outtextxy(130,300,"--------");
settextstyle(1,0,4);
setcolor(3);
outtextxy(90,400,"Nhan Phim Bat Ky De Bat Dau.");
outtextxy(210,450,"Nhan ESC De Thoat.");
key = getch();
if(key == 27)
{
a=5;
game=5;
m=2;
break;
cleardevice();
}
else
{
cleardevice();
a=1;
}
}
while(a==1)
{
setcolor(15);
settextstyle(1,0,6);
outtextxy(300,30,"Man 1");
settextstyle(0,0,4);
setcolor(14);
outtextxy(20,100,">.< LUAT CHOI: ");
settextstyle(1,0,2);
setcolor(3);
outtextxy(20,180,"-Ban Phai An Theo Dung Thu Tu Mau Sac.");
outtextxy(20,230,"-Neu An Sai Mau Ban Co The An Lai Nhung Ban Chi Co The");
outtextxy(20,250," Di Chuyen Duoc 80 Luot.");
outtextxy(20,310,"-Neu Vuot Qua 80 Luot Ban Se Thua.");
setcolor(15);
settextstyle(0,0,2);
outtextxy(60,600,"(NHAN 'Y' DE VAO GAME,NHAN 'N' DE THOAT GAME)");
settextstyle(0,0,2);
outtextxy(40,355,"Ban Co 20 Giay De Nho Thu Tu Mau Sac");
delay(10000);
for(int r=0;r<=19;r++)
{
settextstyle(0,0,2);
outtextxy(140,495,"-> -> -> -> -> ->");
setcolor(1);
sector(100,500,0,360,30,30);
setcolor(2);
sector(220,500,0,360,30,30);
setcolor(4);
sector(340,500,0,360,30,30);
setcolor(7);
sector(460,500,0,360,30,30);
setcolor(6);
sector(580,500,0,360,30,30);
setcolor(14);
sector(700,500,0,360,30,30);
setcolor(5);
sector(820,500,0,360,30,30);
delay(1000);
setcolor(15);
settextstyle(0,0,4);
outtextxy(40,400,thoi_gian_xem[r]);
}
setcolor(0);
sector(100,500,0,360,30,30);
setcolor(0);
sector(220,500,0,360,30,30);
setcolor(0);
sector(340,500,0,360,30,30);
setcolor(0);
sector(460,500,0,360,30,30);
setcolor(0);
sector(580,500,0,360,30,30);
setcolor(0);
sector(700,500,0,360,30,30);
setcolor(0);
sector(820,500,0,360,30,30);
key = getch();
if(key == 110 || key == 78)
{
a=5;
game=5;
m=2;
break;
cleardevice();
}
if(key == 89 || key == 121)
{
cleardevice();
a=2;
}
}
if(m==1)
{
setlinestyle(0,0,3);
setcolor(1);
rectangle(7,7,614,472);
setcolor(14);
sector(x,y,50,320,10,10);
settextstyle(0,0,2);
outtextxy(20,490,">.< LUAT CHOI: ");
outtextxy(20,510,"-Ban Phai An Theo Dung Thu Tu Mau Sac.");
outtextxy(20,530,"-Neu An Sai Mau Ban Co The An Lai Mau Khac Nhung Ban ");
outtextxy(20,550," Chi Co The Di Chuyen Duoc 80 Luot.");
outtextxy(20,570,"-Neu Qua 80 Luot Ban Se Thua.");
outtextxy(640,30,"So Luot Con Lai:");
outtextxy(640,200,"DIEM: ");
setcolor(15);
outtextxy(640,350,"CODE BY:");
outtextxy(640,380,"4NF ChubbyMan");
outtextxy(640,400,"4NF My Duyen");
outtextxy(640,420,"4NF Billie");
setcolor(15);
settextstyle(0,0,6);
outtextxy(700,60,"80");
setcolor(1);
circle(80,240,2);
}
while(game==0)
{
if(kbhit())
{
key = getch();
if(key == 77 & x <= 580)
{
dem += 1;
setcolor(0);
sector(x,y,0,360,10,10);
x+=20;
setcolor(14);
sector(x,y,50,320,10,10);
setcolor(0);
sector(772,84,0,360,22,30);
setcolor(15);
outtextxy(700,60,luot_choi[j]);
j += 1;
if(x==80 & y== 240)
{
outtextxy(650,250,tinh_diem[0]);
setcolor(2);
circle(200,140,2);
setcolor(3);
circle(200,340,2);
thu_tu=1;
}
if(x==200 & y==140 & thu_tu ==1 )
{
outtextxy(650,250,tinh_diem[1]);
setcolor(3);
circle(200,340,2);
setcolor(11);
circle(320,80,2);
setcolor(4);
circle(320,200,2);
setcolor(10);
circle(320,280,2);
setcolor(9);
circle(320,400,2);
thu_tu=2;
}
if(x==320 & y==200 & thu_tu==2)
{
outtextxy(650,250,tinh_diem[2]);
setcolor(11);
circle(320,80,2);
setcolor(10);
circle(320,280,2);
setcolor(9);
circle(320,400,2);
setcolor(8);
circle(440,120,2);
setcolor(7);
circle(440,240,2);
setcolor(6);
circle(440,360,2);
thu_tu=3;
}
if(x==440 & y == 240 & thu_tu==3)
{
outtextxy(650,250,tinh_diem[3]);
setcolor(8);
circle(440,120,2);
setcolor(6);
circle(440,360,2);
thu_tu=4;
}
if(x==440 & y==360 & thu_tu==4)
{
outtextxy(650,250,tinh_diem[4]);
setcolor(8);
circle(440,120,2);
setcolor(5);
circle(560,80,2);
setcolor(13);
circle(560,200,2);
setcolor(14);
circle(560,280,2);
setcolor(12);
circle(560,400,2);
thu_tu=5;
}
if(x==560 & y==280 & thu_tu==5)
{
outtextxy(650,250,tinh_diem[5]);
setcolor(5);
circle(560,80,2);
setcolor(13);
circle(560,200,2);
setcolor(12);
circle(560,400,2);
thu_tu=6;
}
if(x==560 & y==80 & thu_tu ==6)
{
outtextxy(650,250,tinh_diem[6]);
setcolor(13);
circle(560,200,2);
setcolor(12);
circle(560,400,2);
thu_tu=1000;
}
}
if(key == 75 & x >= 30)
{
setcolor(0);
sector(x,y,0,360,10,10);
x-=20;
setcolor(14);
sector(x,y,225,135,10,10);
dem += 1;
setcolor(0);
sector(772,84,0,360,22,30);
setcolor(15);
outtextxy(700,60,luot_choi[j]);
j += 1;
if(x==80 & y== 240)
{
outtextxy(650,250,tinh_diem[0]);
setcolor(2);
circle(200,140,2);
setcolor(3);
circle(200,340,2);
thu_tu=1;
}
if(x==200 & y==140 & thu_tu ==1 )
{
outtextxy(650,250,tinh_diem[1]);
setcolor(3);
circle(200,340,2);
setcolor(11);
circle(320,80,2);
setcolor(4);
circle(320,200,2);
setcolor(10);
circle(320,280,2);
setcolor(9);
circle(320,400,2);
thu_tu=2;
}
if(x==320 & y==200 & thu_tu==2)
{
outtextxy(650,250,tinh_diem[2]);
setcolor(11);
circle(320,80,2);
setcolor(10);
circle(320,280,2);
setcolor(9);
circle(320,400,2);
setcolor(8);
circle(440,120,2);
setcolor(7);
circle(440,240,2);
setcolor(6);
circle(440,360,2);
thu_tu=3;
}
if(x==440 & y == 240 & thu_tu==3)
{
outtextxy(650,250,tinh_diem[3]);
setcolor(8);
circle(440,120,2);
setcolor(6);
circle(440,360,2);
thu_tu=4;
}
if(x==440 & y==360 & thu_tu==4)
{
outtextxy(650,250,tinh_diem[4]);
setcolor(8);
circle(440,120,2);
setcolor(5);
circle(560,80,2);
setcolor(13);
circle(560,200,2);
setcolor(14);
circle(560,280,2);
setcolor(12);
circle(560,400,2);
thu_tu=5;
}
if(x==560 & y==280 & thu_tu==5)
{
outtextxy(650,250,tinh_diem[5]);
setcolor(5);
circle(560,80,2);
setcolor(13);
circle(560,200,2);
setcolor(12);
circle(560,400,2);
thu_tu=6;
}
if(x==560 & y==80 & thu_tu ==6)
{
outtextxy(650,250,tinh_diem[6]);
setcolor(13);
circle(560,200,2);
setcolor(12);
circle(560,400,2);
thu_tu=1000;
}
}
if(key == 72 & y >= 30)
{
setcolor(0);
sector(x,y,0,360,10,10);
y-=20;
setcolor(14);
sector(x,y,135,50,10,10);
dem += 1;
setcolor(0);
sector(772,84,0,360,22,30);
setcolor(15);
outtextxy(700,60,luot_choi[j]);
j += 1;
if(x==80 & y== 240)
{
outtextxy(650,250,tinh_diem[0]);
setcolor(2);
circle(200,140,2);
setcolor(3);
circle(200,340,2);
thu_tu=1;
}
if(x==200 & y==140 & thu_tu ==1 )
{
outtextxy(650,250,tinh_diem[1]);
setcolor(3);
circle(200,340,2);
setcolor(11);
circle(320,80,2);
setcolor(4);
circle(320,200,2);
setcolor(10);
circle(320,280,2);
setcolor(9);
circle(320,400,2);
thu_tu=2;
}
if(x==320 & y==200 & thu_tu==2)
{
outtextxy(650,250,tinh_diem[2]);
setcolor(11);
circle(320,80,2);
setcolor(10);
circle(320,280,2);
setcolor(9);
circle(320,400,2);
setcolor(8);
circle(440,120,2);
setcolor(7);
circle(440,240,2);
setcolor(6);
circle(440,360,2);
thu_tu=3;
}
if(x==440 & y == 240 & thu_tu==3)
{
outtextxy(650,250,tinh_diem[3]);
setcolor(8);
circle(440,120,2);
setcolor(6);
circle(440,360,2);
thu_tu=4;
}
if(x==440 & y==360 & thu_tu==4)
{
outtextxy(650,250,tinh_diem[4]);
setcolor(8);
circle(440,120,2);
setcolor(5);
circle(560,80,2);
setcolor(13);
circle(560,200,2);
setcolor(14);
circle(560,280,2);
setcolor(12);
circle(560,400,2);
thu_tu=5;
}
if(x==560 & y==280 & thu_tu==5)
{
outtextxy(650,250,tinh_diem[5]);
setcolor(5);
circle(560,80,2);
setcolor(13);
circle(560,200,2);
setcolor(12);
circle(560,400,2);
thu_tu=6;
}
if(x==560 & y==80 & thu_tu ==6)
{
outtextxy(650,250,tinh_diem[6]);
setcolor(13);
circle(560,200,2);
setcolor(12);
circle(560,400,2);
thu_tu=1000;
}
}
if(key == 80 & y <= 440)
{
setcolor(0);
sector(x,y,0,360,10,10);
y+=20;
setcolor(14);
sector(x,y,320,225,10,10);
dem += 1;
setcolor(0);
sector(772,84,0,360,22,30);
setcolor(15);
outtextxy(700,60,luot_choi[j]);
j += 1;
if(x==80 & y== 240)
{
outtextxy(650,250,tinh_diem[0]);
setcolor(2);
circle(200,140,2);
setcolor(3);
circle(200,340,2);
thu_tu=1;
}
if(x==200 & y==140 & thu_tu ==1 )
{
outtextxy(650,250,tinh_diem[1]);
setcolor(3);
circle(200,340,2);
setcolor(11);
circle(320,80,2);
setcolor(4);
circle(320,200,2);
setcolor(10);
circle(320,280,2);
setcolor(9);
circle(320,400,2);
thu_tu=2;
}
if(x==320 & y==200 & thu_tu==2)
{
outtextxy(650,250,tinh_diem[2]);
setcolor(11);
circle(320,80,2);
setcolor(10);
circle(320,280,2);
setcolor(9);
circle(320,400,2);
setcolor(8);
circle(440,120,2);
setcolor(7);
circle(440,240,2);
setcolor(6);
circle(440,360,2);
thu_tu=3;
}
if(x==440 & y == 240 & thu_tu==3)
{
outtextxy(650,250,tinh_diem[3]);
setcolor(8);
circle(440,120,2);
setcolor(6);
circle(440,360,2);
thu_tu=4;
}
if(x==440 & y==360 & thu_tu==4)
{
outtextxy(650,250,tinh_diem[4]);
setcolor(8);
circle(440,120,2);
setcolor(5);
circle(560,80,2);
setcolor(13);
circle(560,200,2);
setcolor(14);
circle(560,280,2);
setcolor(12);
circle(560,400,2);
thu_tu=5;
}
if(x==560 & y==280 & thu_tu==5)
{
outtextxy(650,250,tinh_diem[5]);
setcolor(5);
circle(560,80,2);
setcolor(13);
circle(560,200,2);
setcolor(12);
circle(560,400,2);
thu_tu=6;
}
if(x==560 & y==80 & thu_tu ==6)
{
outtextxy(650,250,tinh_diem[6]);
setcolor(13);
circle(560,200,2);
setcolor(12);
circle(560,400,2);
thu_tu=1000;
}
}
}
if(dem == 78)
{
setcolor(7);
settextstyle(0,0,5);
outtextxy(80,200,"GAME OVER =(");
break;
}
if(thu_tu==1000)
{
setcolor(7);
settextstyle(0,0,5);
outtextxy(100,200,"YOU WON !!!");
delay(2000);
cleardevice();
game=1;
}
}
while(game==1)
{
setcolor(15);
settextstyle(1,0,6);
outtextxy(300,30,"Man 2");
settextstyle(0,0,4);
setcolor(14);
outtextxy(20,100,">.< LUAT CHOI: ");
settextstyle(1,0,2);
setcolor(3);
outtextxy(20,180,"-Ban Phai An Theo Dung Thu Tu Mau Sac.");
outtextxy(20,230,"-Neu An Sai Mau Ban Se Thua.");
outtextxy(20,280,"-Ban Duoc Di Chuyen Tu Do.");
setcolor(15);
settextstyle(0,0,2);
outtextxy(60,600,"(NHAN 'Y' DE VAO GAME,NHAN 'N' DE THOAT GAME)");
settextstyle(0,0,2);
outtextxy(40,355,"Ban Co 40 Giay De Nho Thu Tu Mau Sac");
delay(10000);
for(int f=0;f<=39;f++)
{
settextstyle(0,0,2);
outtextxy(140,495,"-> -> -> -> -> ->");
setcolor(15);
sector(100,500,0,360,30,30);
setcolor(4);
sector(220,500,0,360,30,30);
setcolor(1);
sector(340,500,0,360,30,30);
setcolor(5);
sector(460,500,0,360,30,30);
setcolor(14);
sector(580,500,0,360,30,30);
setcolor(6);
sector(700,500,0,360,30,30);
setcolor(3);
sector(820,500,0,360,30,30);
delay(1000);
setcolor(15);
settextstyle(0,0,4);
outtextxy(40,400,thoi_gian_xem[f]);
}
setcolor(0);
sector(100,500,0,360,30,30);
setcolor(0);
sector(220,500,0,360,30,30);
setcolor(0);
sector(340,500,0,360,30,30);
setcolor(0);
sector(460,500,0,360,30,30);
setcolor(0);
sector(580,500,0,360,30,30);
setcolor(0);
sector(700,500,0,360,30,30);
setcolor(0);
sector(820,500,0,360,30,30);
key = getch();
if(key == 110 || key == 78)
{
a=5;
game=5;
m=2;
break;
cleardevice();
}
if(key == 89 || key == 121)
{
cleardevice();
game=2;
}
}
if(m==1)
{
setlinestyle(0,0,3);
setcolor(1);
rectangle(7,7,614,472);
x=40,y=40;
setcolor(14);
sector(x,y,50,320,10,10);
settextstyle(0,0,2);
outtextxy(20,490,">.< LUAT CHOI: ");
outtextxy(20,510,"-Ban Phai An Theo Dung Thu Tu Mau Sac.");
outtextxy(20,530,"-Neu An Sai Mau Ban Se Thua.");
outtextxy(20,550,"-Ban Co The Di Chuyen Tu Do.");
outtextxy(640,200,"DIEM: ");
setcolor(15);
outtextxy(640,350,"CODE BY:");
outtextxy(640,380,"4NF ChubbyMan");
outtextxy(640,400,"4NF My Duyen");
outtextxy(640,420,"4NF Billie");
settextstyle(0,0,6);
setcolor(1);
circle(40,180,2);
setcolor(2);
circle(40,400,2);
setcolor(3);
circle(100,60,2);
setcolor(4);
circle(180,100,2);
setcolor(5);
circle(160,200,2);
setcolor(6);
circle(200,360,2);
setcolor(15);
circle(300,120,2);
setcolor(8);
circle(400,260,2);
setcolor(9);
circle(360,380,2);
setcolor(10);
circle(280,260,2);
setcolor(11);
circle(480,60,2);
setcolor(12);
circle(500,300,2);
setcolor(13);
circle(440,200,2);
setcolor(14);
circle(500,400,2);
}
while(game==2)
{
if(kbhit())
{
key = getch();
if(key == 77 & x <= 580)
{
setcolor(0);
sector(x,y,0,360,10,10);
x+=20;
setcolor(14);
sector(x,y,50,320,10,10);
if(x==300 & y==120 & thu_tu_game_2==0)
{
setcolor(15);
outtextxy(650,250,tinh_diem[0]);
thu_tu_game_2=1;
}
if(x==180 & y==100 & thu_tu_game_2==1)
{
setcolor(15);
outtextxy(650,250,tinh_diem[1]);
thu_tu_game_2=2;
}
if(x==180 & y==100 )
{
if(thu_tu_game_2==0)
{
outtextxy(50,250,"GAME OVER !!!");
break;
}
}
if(x==40 & y==180 & thu_tu_game_2==2)
{
setcolor(15);
outtextxy(650,250,tinh_diem[2]);
thu_tu_game_2=3;
}
if(x==40 & y==180 )
{
if(thu_tu_game_2==0 || thu_tu_game_2==1)
{
outtextxy(50,250,"GAME OVER !!!");
break;
}
}
if(x==160 & y==200 & thu_tu_game_2==3)
{
setcolor(15);
outtextxy(650,250,tinh_diem[3]);
thu_tu_game_2=4;
}
if(x==160 & y== 200)
{
if(thu_tu_game_2==0 || thu_tu_game_2==1 || thu_tu_game_2==2)
{
outtextxy(50,250,"GAME OVER !!!");
break;
}
}
if(x==500 & y==400 & thu_tu_game_2==4)
{
setcolor(15);
outtextxy(650,250,tinh_diem[4]);
thu_tu_game_2=5;
}
if(x==500 & y==400)
{
if(thu_tu_game_2==0 || thu_tu_game_2==1 || thu_tu_game_2==2 || thu_tu_game_2==3)
{
outtextxy(50,250,"GAME OVER !!!");
break;
}
}
if(x==200 & y==360 & thu_tu_game_2==5)
{
setcolor(15);
outtextxy(650,250,tinh_diem[5]);
thu_tu_game_2=6;
}
if(x==200 & y==360)
{
if(thu_tu_game_2==0 || thu_tu_game_2==1 || thu_tu_game_2==2 || thu_tu_game_2==3 || thu_tu_game_2==4)
{
outtextxy(50,250,"GAME OVER !!!");
break;
}
}
if(x==100 & y==60 & thu_tu_game_2==6)
{
setcolor(15);
outtextxy(650,250,tinh_diem[6]);
outtextxy(50,250,"You Won !!");
delay(2000);
break;
}
if(x==100 & y==60)
{
if(thu_tu_game_2==0 || thu_tu_game_2==1 || thu_tu_game_2==2 || thu_tu_game_2==3 || thu_tu_game_2==4 || thu_tu_game_2==5)
{
outtextxy(50,250,"GAME OVER !!!");
break;
}
}
if(x==40 & y==400 )
{
outtextxy(50,250,"GAME OVER !!!");
break;
}
if(x==400 & y==260 )
{
outtextxy(50,250,"GAME OVER !!!");
break;
}
if(x==360 & y==380 )
{
outtextxy(50,250,"GAME OVER !!!");
break;
}
if(x==280 & y==260 )
{
outtextxy(50,250,"GAME OVER !!!");
break;
}
if(x==480 & y==60 )
{
outtextxy(50,250,"GAME OVER !!!");
break;
}
if(x==500 & y==300 )
{
outtextxy(50,250,"GAME OVER !!!");
break;
}
if(x==440 & y==200 )
{
outtextxy(50,250,"GAME OVER !!!");
break;
}
}
if(key == 75 & x >= 30)
{
setcolor(0);
sector(x,y,0,360,10,10);
x-=20;
setcolor(14);
sector(x,y,225,135,10,10);
if(x==300 & y==120 & thu_tu_game_2==0)
{
setcolor(15);
outtextxy(650,250,tinh_diem[0]);
thu_tu_game_2=1;
}
if(x==180 & y==100 & thu_tu_game_2==1)
{
setcolor(15);
outtextxy(650,250,tinh_diem[1]);
thu_tu_game_2=2;
}
if(x==180 & y==100 )
{
if(thu_tu_game_2==0)
{
outtextxy(50,250,"GAME OVER !!!");
break;
}
}
if(x==40 & y==180 & thu_tu_game_2==2)
{
setcolor(15);
outtextxy(650,250,tinh_diem[2]);
thu_tu_game_2=3;
}
if(x==40 & y==180 )
{
if(thu_tu_game_2==0 || thu_tu_game_2==1)
{
outtextxy(50,250,"GAME OVER !!!");
break;
}
}
if(x==160 & y==200 & thu_tu_game_2==3)
{
setcolor(15);
outtextxy(650,250,tinh_diem[3]);
thu_tu_game_2=4;
}
if(x==160 & y== 200)
{
if(thu_tu_game_2==0 || thu_tu_game_2==1 || thu_tu_game_2==2)
{
outtextxy(50,250,"GAME OVER !!!");
break;
}
}
if(x==500 & y==400 & thu_tu_game_2==4)
{
setcolor(15);
outtextxy(650,250,tinh_diem[4]);
thu_tu_game_2=5;
}
if(x==500 & y==400)
{
if(thu_tu_game_2==0 || thu_tu_game_2==1 || thu_tu_game_2==2 || thu_tu_game_2==3)
{
outtextxy(50,250,"GAME OVER !!!");
break;
}
}
if(x==200 & y==360 & thu_tu_game_2==5)
{
setcolor(15);
outtextxy(650,250,tinh_diem[5]);
thu_tu_game_2=6;
}
if(x==200 & y==360)
{
if(thu_tu_game_2==0 || thu_tu_game_2==1 || thu_tu_game_2==2 || thu_tu_game_2==3 || thu_tu_game_2==4)
{
outtextxy(50,250,"GAME OVER !!!");
break;
}
}
if(x==100 & y==60 & thu_tu_game_2==6)
{
setcolor(15);
outtextxy(650,250,tinh_diem[6]);
outtextxy(50,250,"You Won !!");
delay(2000);
break;
}
if(x==100 & y==60)
{
if(thu_tu_game_2==0 || thu_tu_game_2==1 || thu_tu_game_2==2 || thu_tu_game_2==3 || thu_tu_game_2==4 || thu_tu_game_2==5)
{
outtextxy(50,250,"GAME OVER !!!");
break;
}
}
if(x==40 & y==400 )
{
outtextxy(50,250,"GAME OVER !!!");
break;
}
if(x==400 & y==260 )
{
outtextxy(50,250,"GAME OVER !!!");
break;
}
if(x==360 & y==380 )
{
outtextxy(50,250,"GAME OVER !!!");
break;
}
if(x==280 & y==260 )
{
outtextxy(50,250,"GAME OVER !!!");
break;
}
if(x==480 & y==60 )
{
outtextxy(50,250,"GAME OVER !!!");
break;
}
if(x==500 & y==300 )
{
outtextxy(50,250,"GAME OVER !!!");
break;
}
if(x==440 & y==200 )
{
outtextxy(50,250,"GAME OVER !!!");
break;
}
}
if(key == 72 & y >= 30)
{
setcolor(0);
sector(x,y,0,360,10,10);
y-=20;
setcolor(14);
sector(x,y,135,50,10,10);
if(x==300 & y==120 & thu_tu_game_2==0)
{
setcolor(15);
outtextxy(650,250,tinh_diem[0]);
thu_tu_game_2=1;
}
if(x==180 & y==100 & thu_tu_game_2==1)
{
setcolor(15);
outtextxy(650,250,tinh_diem[1]);
thu_tu_game_2=2;
}
if(x==180 & y==100 )
{
if(thu_tu_game_2==0)
{
outtextxy(50,250,"GAME OVER !!!");
break;
}
}
if(x==40 & y==180 & thu_tu_game_2==2)
{
setcolor(15);
outtextxy(650,250,tinh_diem[2]);
thu_tu_game_2=3;
}
if(x==40 & y==180 )
{
if(thu_tu_game_2==0 || thu_tu_game_2==1)
{
outtextxy(50,250,"GAME OVER !!!");
break;
}
}
if(x==160 & y==200 & thu_tu_game_2==3)
{
setcolor(15);
outtextxy(650,250,tinh_diem[3]);
thu_tu_game_2=4;
}
if(x==160 & y== 200)
{
if(thu_tu_game_2==0 || thu_tu_game_2==1 || thu_tu_game_2==2)
{
outtextxy(50,250,"GAME OVER !!!");
break;
}
}
if(x==500 & y==400 & thu_tu_game_2==4)
{
setcolor(15);
outtextxy(650,250,tinh_diem[4]);
thu_tu_game_2=5;
}
if(x==500 & y==400)
{
if(thu_tu_game_2==0 || thu_tu_game_2==1 || thu_tu_game_2==2 || thu_tu_game_2==3)
{
outtextxy(50,250,"GAME OVER !!!");
break;
}
}
if(x==200 & y==360 & thu_tu_game_2==5)
{
setcolor(15);
outtextxy(650,250,tinh_diem[5]);
thu_tu_game_2=6;
}
if(x==200 & y==360)
{
if(thu_tu_game_2==0 || thu_tu_game_2==1 || thu_tu_game_2==2 || thu_tu_game_2==3 || thu_tu_game_2==4)
{
outtextxy(50,250,"GAME OVER !!!");
break;
}
}
if(x==100 & y==60 & thu_tu_game_2==6)
{
setcolor(15);
outtextxy(650,250,tinh_diem[6]);
outtextxy(50,250,"You Won !!");
delay(2000);
break;
}
if(x==100 & y==60)
{
if(thu_tu_game_2==0 || thu_tu_game_2==1 || thu_tu_game_2==2 || thu_tu_game_2==3 || thu_tu_game_2==4 || thu_tu_game_2==5)
{
outtextxy(50,250,"GAME OVER !!!");
break;
}
}
if(x==40 & y==400 )
{
outtextxy(50,250,"GAME OVER !!!");
break;
}
if(x==400 & y==260 )
{
outtextxy(50,250,"GAME OVER !!!");
break;
}
if(x==360 & y==380 )
{
outtextxy(50,250,"GAME OVER !!!");
break;
}
if(x==280 & y==260 )
{
outtextxy(50,250,"GAME OVER !!!");
break;
}
if(x==480 & y==60 )
{
outtextxy(50,250,"GAME OVER !!!");
break;
}
if(x==500 & y==300 )
{
outtextxy(50,250,"GAME OVER !!!");
break;
}
if(x==440 & y==200 )
{
outtextxy(50,250,"GAME OVER !!!");
break;
}
}
if(key == 80 & y <= 440)
{
setcolor(0);
sector(x,y,0,360,10,10);
y+=20;
setcolor(14);
sector(x,y,320,225,10,10);
if(x==300 & y==120 & thu_tu_game_2==0)
{
setcolor(15);
outtextxy(650,250,tinh_diem[0]);
thu_tu_game_2=1;
}
if(x==180 & y==100 & thu_tu_game_2==1)
{
setcolor(15);
outtextxy(650,250,tinh_diem[1]);
thu_tu_game_2=2;
}
if(x==180 & y==100 )
{
if(thu_tu_game_2==0)
{
outtextxy(50,250,"GAME OVER !!!");
break;
}
}
if(x==40 & y==180 & thu_tu_game_2==2)
{
setcolor(15);
outtextxy(650,250,tinh_diem[2]);
thu_tu_game_2=3;
}
if(x==40 & y==180 )
{
if(thu_tu_game_2==0 || thu_tu_game_2==1)
{
outtextxy(50,250,"GAME OVER !!!");
break;
}
}
if(x==160 & y==200 & thu_tu_game_2==3)
{
setcolor(15);
outtextxy(650,250,tinh_diem[3]);
thu_tu_game_2=4;
}
if(x==160 & y== 200)
{
if(thu_tu_game_2==0 || thu_tu_game_2==1 || thu_tu_game_2==2)
{
outtextxy(50,250,"GAME OVER !!!");
break;
}
}
if(x==500 & y==400 & thu_tu_game_2==4)
{
setcolor(15);
outtextxy(650,250,tinh_diem[4]);
thu_tu_game_2=5;
}
if(x==500 & y==400)
{
if(thu_tu_game_2==0 || thu_tu_game_2==1 || thu_tu_game_2==2 || thu_tu_game_2==3)
{
outtextxy(50,250,"GAME OVER !!!");
break;
}
}
if(x==200 & y==360 & thu_tu_game_2==5)
{
setcolor(15);
outtextxy(650,250,tinh_diem[5]);
thu_tu_game_2=6;
}
if(x==200 & y==360)
{
if(thu_tu_game_2==0 || thu_tu_game_2==1 || thu_tu_game_2==2 || thu_tu_game_2==3 || thu_tu_game_2==4)
{
outtextxy(50,250,"GAME OVER !!!");
break;
}
}
if(x==100 & y==60 & thu_tu_game_2==6)
{
setcolor(15);
outtextxy(650,250,tinh_diem[6]);
outtextxy(50,250,"You Won !!");
delay(2000);
break;
}
if(x==100 & y==60)
{
if(thu_tu_game_2==0 || thu_tu_game_2==1 || thu_tu_game_2==2 || thu_tu_game_2==3 || thu_tu_game_2==4 || thu_tu_game_2==5)
{
outtextxy(50,250,"GAME OVER !!!");
break;
}
}
if(x==40 & y==400 )
{
outtextxy(50,250,"GAME OVER !!!");
break;
}
if(x==400 & y==260 )
{
outtextxy(50,250,"GAME OVER !!!");
break;
}
if(x==360 & y==380 )
{
outtextxy(50,250,"GAME OVER !!!");
break;
}
if(x==280 & y==260 )
{
outtextxy(50,250,"GAME OVER !!!");
break;
}
if(x==480 & y==60 )
{
outtextxy(50,250,"GAME OVER !!!");
break;
}
if(x==500 & y==300 )
{
outtextxy(50,250,"GAME OVER !!!");
break;
}
if(x==440 & y==200 )
{
outtextxy(50,250,"GAME OVER !!!");
break;
}
}
}
}
getch();
return 0;
}