Ejemplo n.º 1
0
      void draw()
       {
	 setgraph();
	 for(int i=0;i<230;i+=5)
	    {
	      if (i%2==0)
		setcolor(1);
	      else
		setcolor(4);
	      rectangle(235-i,241-i,395+i,241+i);
	      delay(80);
	    }

	 for(i=0;i<40;++i)
	   {
	     setcolor(random(15));
	     settextstyle(4,0,5);
	     outtextxy(230,150,"DRAW!!! ");
	     settextstyle(7,0,4);
	       outtextxy(130,220,"Better Luck Next Time..");
	     delay(20);
	   }
	 setcolor(15);
	 settextstyle(4,0,5);
	 outtextxy(230,150,"DRAW!!!");
	 settextstyle(7,0,4);
	 outtextxy(130,220,"Better Luck Next Time..");
	 circle(320,320,40);
	 circle(300,300,5);
	 circle(340,300,5);
	 outtextxy(318,300,"l");
	 outtextxy(313,320,"o");
	 getch();
      }
Ejemplo n.º 2
0
Archivo: FED.C Proyecto: MegaGod/TW
/** setvideomode
*   init_cursor
*/
void setup_screen( void ) {
	extern int herc_align;

	registerfarbgidriver( EGAVGA_driver_far );
	registerfarbgidriver( Herc_driver_far );

	setgraph( );
	if ( scrmode == HERCMONO ) {
		writech = hgcwritech;
		if ( herc_align ) {
			align = 40;
		}/* else {
		 align = 0 (init already)
		 }*/
	} else {
		writech = ewritech;
		herc_align = 0;
	}

	init_graph_and_cursor( );

	clsall( );
	/*
	_rectangle( 0 + align, 0, 639 + align, 347 );
	*/
	_rectangle( 0, 0, 639, 347 );
	prakeaw( );
	dispstrhgc( "¨ØÌÒŧ¡Ã³ìÁËÒÇÔ·ÂÒÅÑÂ", 6, 0, BOLDATTR );
	/*
	_line( 0 + align, 24, 639 + align, 24 );
	*/
	_line( 0, 24, 639, 24 );
}
Ejemplo n.º 3
0
       void player2win()
       {
	 setgraph();
	 for(int i=0;i<230;i+=5)
	    {
	      setcolor(5);
	      rectangle(235-i,241-i,395+i,241+i);
	      delay(80);
	    }

	for(i=0;i<40;++i)
	   {
	     setcolor(random(15));
	     settextstyle(4,0,5);
	     outtextxy(100,150,"CONGRATULATIONS ");
	     settextstyle(7,0,4);
	     outtextxy(120,220,"PLAYER 2 is the winner");
	     delay(20);
	  }
	setcolor(15);
	settextstyle(4,0,5);
	outtextxy(100,150,"CONGRATULATIONS ");
	settextstyle(7,0,4);
	outtextxy(120,220,"PLAYER 2 is the winner");
	circle(320,320,40);
	circle(300,300,5);
	circle(340,300,5);
	outtextxy(318,300,"l");
	arc(320,340,180,360,8);
      }
Ejemplo n.º 4
0
    void pcwin()
       {
	 setgraph();
	 for(int i=0;i<230;i+=5)
	    {
	      setcolor(1);
	      rectangle(235-i,241-i,395+i,241+i);
	      delay(80);
	    }

	for(i=0;i<40;++i)
	   {
	     setcolor(random(15));
	     settextstyle(4,0,5);
	     outtextxy(230,150,"OOPS !!! ");
	     settextstyle(7,0,4);
	       outtextxy(250,220,"You Lost");

	     delay(20);
	  }
	 setcolor(15);
	 settextstyle(4,0,5);
	 outtextxy(230,150,"OOPS !!! ");
	 settextstyle(7,0,4);
	 outtextxy(250,220,"You Lost");
	 circle(320,320,40);
	 circle(300,300,5);
	 circle(340,300,5);
	 outtextxy(318,300,"l");
	 arc(320,350,0,180,8);
       }
Ejemplo n.º 5
0
   void main()                            // main function
   {
     clrscr();                           //clears the previous output screen
     setgraph();
     setbkcolor(0);
     for(int i=0;i<500;++i)
      {
	delay(7);
	putpixel(random(640),random(480),random(15));
      }
     settextstyle(7,0,5);
     outtextxy(285,90,"TIC");
     outtextxy(285,130,"TAC");
     outtextxy(285,170,"TOE");
     for( i=0;i<80;++i)
       {
	 setcolor(4);
	 circle(320,160,i+80);
	 delay(50);
       }
     settextstyle(5,0,3);
     setcolor(4);
     outtextxy(210,330,"press any key to continue ......");
     setcolor(13);
     outtextxy(220,400,"By : Yashika Ranjan");
     getch();
     closegraph();
     menu();
   }
Ejemplo n.º 6
0
void instructions()
{
	clrscr();
	setgraph();
	setbkcolor(15);
	setcolor(RED);
	settextstyle(4,0,5);
	outtextxy(25,30,"INSTRUCTIONS:");
	setcolor(BLUE);
	settextstyle(0,0,2);
	outtextxy(25,100,"The aim of the game is to score");
	outtextxy(25,130,"a total of 10 baskets.");
	outtextxy(25,160,"Difficulty increases with each successful basket.");
	settextstyle(0,0,1);
	outtextxy(25,200,"Baskets can be scored by throwing");
	outtextxy(25,220,"the ball with appropriate power.");
	outtextxy(25,250,"Press 'X' or 'ENTER' at the right time to choose power");
	outtextxy(25,270,"The Points increase by 2 with every Consecutive Basket.");
	outtextxy(25,320,"If you are able to stop the ball in the right area,");
	outtextxy(25,340,"then choose the right angle at which the ball has to be shot.");
	outtextxy(25,360,"Appropriate Area=GREEN Band.");
	outtextxy(25,380,"PRESS X TO START THE GAME");

	setfillstyle(1,YELLOW);
	bar(600,350,610,390);
	setfillstyle(1,GREEN);
	bar(600,390,610,400);
	setfillstyle(1,RED);
	bar(600,400,610,440);
	getch();
    	if(getch()=='x'||getch()=='X')
	    game();
	else if(getch()==27)
	    exit(0);
	closegraph();
}
Ejemplo n.º 7
0
   void menu()
   {
     clrscr();
     setgraph();
     setbkcolor(1);
       for(int i=0;i<635;i+=20)
	 {
	   setcolor(2);
	   setfillstyle(1,2);
	   circle(12+i,10,10);
	   floodfill(12+i,10,2);
	 }
       for(i=0;i<635;i+=20)
	 {
	   setcolor(2);
	   setfillstyle(1,2);
	   circle(12+i,468,10);
	   floodfill(12+i,468,2);
	 }
     settextstyle(8,0,3);
     for(i=420;i>30;i-=3)
	{
	  setcolor(random(15));
	  outtextxy(230,i,"SeLeCtIoN MeNu");
	  delay(40);
	  setcolor(1);
	  outtextxy(230,i,"SeLeCtIoN MeNu");
	}
     setcolor(14);
     outtextxy(230,30,"SeLeCtIoN MeNu");
     line(220,60,440,60);
     for(i=0;i<200;i+=3)
	{
	  setcolor(i);
	  settextstyle(7,0,2);
	  outtextxy(i,110," 1. NEW GAME");
	  outtextxy(i,160," 2. INSTRUCTIONS");
	  outtextxy(i,210," 3. EXIT");
	  delay(40);
	  setcolor(1);
	  outtextxy(i,110," 1. NEW GAME");
	  outtextxy(i,160," 2. INSTRUCTIONS");
	  outtextxy(i,210," 3. EXIT");
	}
     int v;
     for(int h=0;;)
       {
	  for(int i=0;i<635;i+=20)
	    {
	      setcolor(2);
	      setfillstyle(1,2);
	      circle(12+i,10,10);
	      floodfill(12+i,10,2);
	    }
	  for(i=0;i<635;i+=20)
	    {
	      setcolor(2);
	      setfillstyle(1,2);
	      circle(12+i,468,10);
	      floodfill(12+i,468,2);
	    }
     i=200;
     setcolor(15);
     ellipse(310,180,0,360,140,100);
     setfillstyle(1,4);
     floodfill(310,180,15);
     setcolor(15);
     settextstyle(7,0,2);
     outtextxy(i,110," 1. NEW GAME");
     outtextxy(i,160," 2. INSTRUCTIONS");
     outtextxy(i,210," 3. EXIT");
     setcolor(14);
     setfillstyle(1,14);
     circle(180,350,10);
     floodfill(180,350,14);
     setcolor(10);
     setfillstyle(1,10);
     circle(130,200,20);
     floodfill(130,200,10);
     setcolor(6);
     setfillstyle(1,6);
     circle(600,300,15);
     floodfill(600,300,6);
     setcolor(13);
     setfillstyle(1,13);
     circle(30,330,15);
     floodfill(30,330,13);
     setcolor(12);
     setfillstyle(1,12);
     circle(460,350,15);
     floodfill(460,350,12);
     setcolor(13);
     setfillstyle(1,13);
     circle(480,220,20);
     floodfill(480,220,13);
     setcolor(12);
     setfillstyle(1,12);
     circle(50,80,10);
     floodfill(50,80,12);
     setcolor(14);
     setfillstyle(1,14);
     circle(590,80,10);
     floodfill(590,80,14);

     if(h==300)
	v=1;
     else
     if(h==0)
	v=0;
     if(v==1)
	h-=10;
     else
     if(v==0)
	h+=10;
     setcolor(15);
     settextstyle(8,0,2);
     outtextxy(h,400,"Enter Your Choice (1,2 or 3)");
     delay(150);
     setcolor(1);
     settextstyle(8,0,2);
     outtextxy(h,400,"Enter Your Choice (1,2 or 3)");
     if(kbhit())
	{
	   char c=getch();
	   if(c=='1')
	       {
		setcolor(4);
		rectangle(205,320,440,420);
		setcolor(14);
		rectangle(206,321,439,419);
		setcolor(15);
		settextstyle(2,0,6);
		outtextxy(210,340," 1. USER vs COMPUTER");
		outtextxy(210,370," 2.PLAYER 1 vs PLAYER 2");
		p= getch();
		closegraph();
		game();
	       }
	   else
	   if(c=='2')
	       instructions();
	   else
	       exit(0);
	}
     settextstyle(8,0,3);
     setcolor(14);
     outtextxy(230,30,"SeLeCtIoN MeNu");
     line(220,60,440,60);
       }

   }
Ejemplo n.º 8
0
void main()
{
	//MAIN SCREEN
	setgraph();
	setbkcolor(15);
	setcolor(RED);
	settextstyle(4,0,8);
	outtextxy(20,20,"NBA Live 2011");
	settextstyle(3,0,4);
	outtextxy(300,420,"c MacroSoft Inc.2011");

	circle(307,445,10);

	setfillstyle(1,BLUE);
	bar(200,350,400,370);
	for(int x=2;x<10;x++)
	{
		if(x%2==0)
			setfillstyle(1,GREEN);
		else
			setfillstyle(1,15);
		for(int i=205;i<395;i+=15)
		{	bar(i,353,i+10,367);
			delay(50);
		}
	}
	settextstyle(4,0,3);
	outtextxy(123,380,"PRESS ANY KEY TO CONTINUE");
	getch();
	cleardevice();
	settextstyle(3,0,4);
	outtextxy(300,420,"c Macrosoft Inc.2011");

	circle(307,445,10);

	settextstyle(4,0,8);
	outtextxy(140,20,"Main Menu");
	setcolor(BLUE);
	settextstyle(1,0,4);
	outtextxy(195,200," 1. Start Game");
	outtextxy(195,230," 2. Instructions");
	outtextxy(195,260," 3. Exit");

	circle(80,380,45);
	setfillstyle(1,6);
	floodfill(50,385,1);
	line(80,335,80,425);
	arc(30,380,300,63,30);
	arc(130,380,117,240,30);

	circle(560,380,45);
	setfillstyle(1,6);
	floodfill(560,380,1);
	line(560,335,560,425);
	arc(510,380,300,63,30);
	arc(610,380,117,240,30);


	char c=getch();
	if(c=='1')
		game();
	else if(c=='2')
		instructions();
	else if(c==27||'4')
		exit(0);
	closegraph();

}
Ejemplo n.º 9
0
void game()
{
	//GAME SCREEN
	setgraph();

	setbkcolor(0);
	setcolor(RED);
	settextstyle(4,0,5);
	outtextxy(25,30,"CHOOSE YOUR TEAM :");
	setcolor(1);
	settextstyle(0,0,2);
	outtextxy(25,100,"1. New York Knicks");
	setcolor(2);
	outtextxy(25,130,"2. Boston Celtics");
	setcolor(3);
	outtextxy(25,160,"3. Orlando Jazz");
	setcolor(5);
	outtextxy(25,190,"4. Pheonix Suns");
	setcolor(11);
	outtextxy(25,220,"5. New Orleans Hornets");
	setcolor(12);
	outtextxy(25,250,"6. Miami Heat");
	setcolor(14);
	outtextxy(25,280,"7. Los Angeles Lakers");
	setcolor(15);
	outtextxy(25,310,"8. Chicago Bulls");
	char e=getch();
	cleardevice();
	int col;
	settextstyle(0,0,2);
	switch (e)
	{
		case '1':col=1;
			setcolor(col);
			outtextxy(10,10,"New York Knicks");
			break;
		case '2' :col=2;
			setcolor(col);
			outtextxy(10,10,"Boston Celtics");
			break;
		case '3' :col=3;
			setcolor(col);
			outtextxy(10,10,"Orlando Jazz");
			break;
		case '4' :col=5;
			setcolor(col);
			outtextxy(10,10,"Pheonix Suns");
			break;
		case '5' :col=11;
			setcolor(col);
			outtextxy(10,10,"New Orleans Hornets");
			break;
		case '6' :col=12;
			setcolor(col);
			outtextxy(10,10,"Miami Heat");
			break;
		case '7' :col=14;
			setcolor(col);
			outtextxy(10,10,"Los Angeles Lakers");
			break;
		case '8' :col=15;
			setcolor(col);
			outtextxy(10,10,"Chicago Bulls");
			break;
	}





	int k=0;
	setfillstyle(1,6);
	bar(0,280,640,480);//COURT
	setfillstyle(1,YELLOW);
	bar(200,300,210,340);
	setfillstyle(1,GREEN);
	bar(200,340,210,350);
	setfillstyle(1,RED);
	bar(200,350,210,390);
	setcolor(15);
	line(320,280,320,480);
	ellipse(0,360,0,360,50,50);
	ellipse(320,360,0,360,50,30);
	ellipse(640,360,0,360,50,50);
	setfillstyle(1,RED);
	bar(0,230,640,280);//NBA
	settextstyle(0,0,2);
	setcolor(15);
	for(int i=80;i<=500;i+=80)
	       outtextxy(i,255,"NBA");
	setfillstyle(1,14);
	bar(600,120,610,360);//BASKET
	setcolor(15);
	for(i=10,k=0;i>0;i--,k+=5)
	       ellipse(575,120+k,0,360,15+i,10);//BASKET
	bar(30,120,40,360);//BASKET
	setcolor(15);
	for(i=10,k=0;i>0;i--,k+=5)
	       ellipse(65,120+k,0,360,15+i,10);//BASKET
	//PLAYER
	circle(145,240,12);
	setfillstyle(1,col);
	floodfill(145,240,15);
	rectangle(145,252,147,390);
	floodfill(146,260,15);
	line(146,260,165,295);
	line(165,295,178,295);
	setfillstyle(1,15);

	circle(50,437,30);
	circle(50,437,33);
	settextstyle(6,0,2);
	outtextxy(40,406,"EA");
	outtextxy(25,426,"Sports");
	rectangle(30,45,150,80);
	settextstyle(4,0,2);
	outtextxy(34,47,"SCORE: ");

	//game loop
	char str[5],quit;
	int m=0,g=1;
	for(int end=1;end>0,g<=10;end++)
	{
	int x=317,y=0;
	for(;;x+=y)
	{
			setcolor(15);
			circle(173,x,16);
			setfillstyle(1,15);
			floodfill(173,x,15);
			delay(120-10*g);
			circle(173,x,16);
			setfillstyle(1,6);
			floodfill(173,x,6);

		 if(x>=385)
			y=-2;
		 else if(x<=317)
			y=2;
		 if(kbhit())
		 {
			char ch=getch();
			if(ch=='x'||ch=='X'||ch==13)
			break;
			else if(ch==27)
			{
				cleardevice();
				setbkcolor(BLUE);
				setcolor(GREEN);
				settextstyle(4,0,2);
				outtextxy(150,100,"GAME OVER");
				outtextxy(150,150,"YOUR FINAL SCORE IS : ");
				itoa(m,str,10);
				outtextxy(150,200,str);
				delay(2000);
				outtextxy(150,250,"WANNA PLAY AGAIN ? (Y/N) : ");
				quit=getch();
				if(quit=='y'||quit=='Y')
					game();
				else if(quit=='n'||quit=='N')
					exit(0);
			}
		 }

	 }


	 int t,o;
	 if(x<340)
		t=13;
	 else if(x<350)
		t=17;
	 else
		t=19;
		o=t;
	int xx=160,yy=125,b=0;
	char v[2];
	if(t==17)
	{
		arc(145,210,0,90,100);
		line(145,210,145,110);
		line(145,210,245,210);


		for(;xx>0;)
		{
			xx+=b;
			yy+=b;
			setcolor(RED);
			line(150,205,xx,yy);
			if(xx==200)
				delay(100);
			else
				delay(250);
			setcolor(0);
			line(150,205,xx,yy);
			if(xx==200)
				delay(100);
			else
				delay(250);
			if(xx==160)
				b=40;
			else if(xx==240)
				b=-40;
			if(kbhit())
		 {
			char ang=getch();
			if(ang=='x'||ang=='X'||ang==13)
			{
				setfillstyle(1,0);
				bar(145,110,245,210);
				break;
			}
			else if(ang==27)
			{
				cleardevice();
				setbkcolor(15);
				setcolor(RED);
				settextstyle(4,0,2);
				outtextxy(150,100,"GAME OVER");
				outtextxy(150,150,"YOUR FINAL SCORE IS : ");
				itoa(m,str,10);
				outtextxy(150,200,str);
				delay(2000);
				outtextxy(150,250,"WANNA PLAY AGAIN ? (Y/N) : ");
				quit=getch();
				if(quit=='y'||quit=='Y')
					game();
				else if(quit=='n'||quit=='N')
					exit(0);
			}
		}
	}


	 if(xx==240)
		t=13;
	 else if(xx==200)
		t=17;
	 else if(xx==160)
		t=19;
	 o=t;
	}


	int p=145,q=200;
	for(int kk=0;q<210&&p<550;t-=1)
	{
	      setcolor(15);
	      p+=15;
	      q-=t;
	      circle(p,q,16);
	      setfillstyle(1,15);
	      floodfill(p,q,15);
	      delay(100);
	      circle(p,q,16);
	      setfillstyle(1,0);
	      floodfill(p,q,0);

	}
	if(o==17)
	{

	      circle(575,195,16);
	      setfillstyle(1,15);
	      floodfill(575,195,15);
	      delay(150);
	      circle(575,195,16);
	      setfillstyle(1,0);
	      floodfill(575,195,0);

	      circle(575,255,16);
	      setfillstyle(1,15);
	      floodfill(575,255,15);
	      delay(150);
	      circle(575,255,16);
	      setfillstyle(1,RED);
	      floodfill(575,255,RED);
	      settextstyle(6,0,2);
	      outtextxy(200,100,"2 POINTS !!");
	      delay(1000);
	      setfillstyle(1,0);
	      bar(190,90,450,150);

	      setcolor(15);
	      bar(120,50,148,75);

	      m+=2;
	      itoa(m,str,10);
	      settextstyle(4,0,2);
	      outtextxy(121,47,str);
	      g++;
	}
	else
	{
	      settextstyle(6,0,2);
	      outtextxy(200,100,"MISSED SHOT...");
	      delay(1000);
	      bar(190,90,480,150);
	}

	}

	cleardevice();
	setbkcolor(BLUE);
	setcolor(2);
	outtextxy(150,50,"CONGRATS!! YOU COMPLETED ALL LEVELS");
	outtextxy(150,100,"GAME OVER");
	outtextxy(150,150,"YOUR FINAL SCORE IS : ");
	itoa(m,str,10);
	outtextxy(150,200,str);
	delay(2000);
	outtextxy(150,250,"WANNA PLAY AGAIN ? (Y/N) : ");
	quit=getch();
	if(quit=='y'||quit=='Y')
		game();
	else if(quit=='n'||quit=='N')
		exit(0);
	getch();
	closegraph();

 }