//tennis game by fensa
#include<stdio.h>
#include<conio.h>
#include<math.h>
#include<graphics.h>
void main()
{
float x=1,y=0.0,j=0.5,count=0.1,i,k,r=10;
int gd=DETECT,gm;
initgraph(&gd,&gm,"c:\\tc\\bgi");
circle(20,230,20);//bat1
line(20,250,20,300);
circle(450,230,20);//bat2
line(450,250,450,300);
// line(0,400,650,400);
sleep(1);
for(k=0;k<1;k++)
{
for(i=90;i<=270;i=i+2)
{
y=cos((i*22/7)/180)/j;
if(y>0)
y=-y;
x=x+5;
setcolor(14);
setfillstyle(1,14);
circle(x,y*75+200,r);
floodfill(x,y*75+200,14);
delay(40);
setcolor(0);
setfillstyle(1,0);
circle(x,y*75+200,r);
floodfill(x,y*75+200,0);
}
j=j+count;
count=count+0.1;
}
for(k=0;k<1;k++)
{
for(i=270;i>=90;i=i-2)
{
y=cos((i*22/7)/180)/j;
if(y>0)
y=-y;
x=x-5;
setcolor(14);
setfillstyle(1,14);
circle(x,y*75+200,r);
floodfill(x,y*75+200,14);
delay(40);
setcolor(0);
setfillstyle(1,0);
circle(x,y*75+200,r);
floodfill(x,y*75+200,0);
}
j=j+count;
count=count+0.1;
}
for(k=0;k<1;k++)
{
for(i=90;i<=270;i=i+2)
{
y=cos((i*22/7)/180)/j;
if(y>0)
y=-y;
x=x+5;
setcolor(14);
setfillstyle(1,14);
circle(x,y*75+200,r);
floodfill(x,y*75+200,14);
delay(40);
setcolor(0);
setfillstyle(1,0);
circle(x,y*75+200,r);
floodfill(x,y*75+200,0);
}
j=j+count;
count=count+0.1;
}
getch();
closegraph();
}
#include<stdio.h>
#include<conio.h>
#include<math.h>
#include<graphics.h>
void main()
{
float x=1,y=0.0,j=0.5,count=0.1,i,k,r=10;
int gd=DETECT,gm;
initgraph(&gd,&gm,"c:\\tc\\bgi");
circle(20,230,20);//bat1
line(20,250,20,300);
circle(450,230,20);//bat2
line(450,250,450,300);
// line(0,400,650,400);
sleep(1);
for(k=0;k<1;k++)
{
for(i=90;i<=270;i=i+2)
{
y=cos((i*22/7)/180)/j;
if(y>0)
y=-y;
x=x+5;
setcolor(14);
setfillstyle(1,14);
circle(x,y*75+200,r);
floodfill(x,y*75+200,14);
delay(40);
setcolor(0);
setfillstyle(1,0);
circle(x,y*75+200,r);
floodfill(x,y*75+200,0);
}
j=j+count;
count=count+0.1;
}
for(k=0;k<1;k++)
{
for(i=270;i>=90;i=i-2)
{
y=cos((i*22/7)/180)/j;
if(y>0)
y=-y;
x=x-5;
setcolor(14);
setfillstyle(1,14);
circle(x,y*75+200,r);
floodfill(x,y*75+200,14);
delay(40);
setcolor(0);
setfillstyle(1,0);
circle(x,y*75+200,r);
floodfill(x,y*75+200,0);
}
j=j+count;
count=count+0.1;
}
for(k=0;k<1;k++)
{
for(i=90;i<=270;i=i+2)
{
y=cos((i*22/7)/180)/j;
if(y>0)
y=-y;
x=x+5;
setcolor(14);
setfillstyle(1,14);
circle(x,y*75+200,r);
floodfill(x,y*75+200,14);
delay(40);
setcolor(0);
setfillstyle(1,0);
circle(x,y*75+200,r);
floodfill(x,y*75+200,0);
}
j=j+count;
count=count+0.1;
}
getch();
closegraph();
}
No comments:
Post a Comment