Mega Code Archive
Egg Game
#include"dos.h"
#include"graphics.h"
#include
#include
#include
#include
#include
#include
union REGS i,o;
main()
{
FILE *fp;
fp=fopen("record.txt","r");
if(fp=NULL)
cout<<"THE GAME HAS SOME PROBLEMS FOR MORE DETAILS CONTECT varun...";
void help();
int initmouse();
int restrictmouseptr(int,int,int,int);
int getmousepos(int *,int *,int *);
int showmouseptr();
int gd=DETECT,gm,maxx,maxy,x,y,button;
initgraph(&gd,&gm,"c:\turboc3\bin");
//circle(100,100,40);
int count=0;
maxx=getmaxx();
maxy=getmaxy();
// rectangle(0,0,maxx,maxy);
setbkcolor(1);
setviewport(0,0,maxx,maxy,1);
gotoxy(26,1);
//printf("mouse demonstration program");
if(initmouse()==0)
{
closegraph();
restorecrtmode(); //to go back to normal graphics mode or deleting
viewport.
printf("
mouse driver not loaded");
exit(1);
}
restrictmouseptr(0,getmaxy()-20,maxx,getmaxy()-15);
//showmouseptr();
//gotoxy(1,2);
//printf("left button");
//gotoxy(15,2);
//printf("right button");
//printf("press any key to exit....");
int a=30;int b=0;
setcolor(0);
setfillstyle(1,15);
int score=0;
count=20;
int s=5;
int level=0;
char name[40];
gotoxy(5,2);
cout<<"PLEASE ENTER YOUR SWEET NAME::-";
gets(name);
gotoxy(5,2);
cout<<"
";
while(!kbhit())
{
getmousepos(&button,&x,&y);
// gotoxy(5,3);
// (button&1)==1 ? printf("down") : printf("up");
//gotoxy(20,3);
// (button&1)==2 ? printf("down") : printf("up");
setcolor(15);
setfillstyle(1,15);
fillellipse(a,b,10,15);
if((b>getmaxy()-20)&&(b<=getmaxy()-15))
{
if(a>=(x-20)&&(a<=(x+60)))
{
score+=10;
gotoxy(320,2);
textcolor(13);
cout<<"your score: "<getmaxy()+40)
{
b=0;
a=random(getmaxx());
gotoxy(10,2);
cout<<"eggs left: "<