#include <graphics.h>
#include <conio.h>
#include <iostream.h>
#include <math.h>
#include <dos.h>
#include <stdlib.h>
#define ESC_KEY 0x1b
int tx=0,ty=0;
void getx(int &ox)
{
if (ox==50)
{
tx=0;
ox=ox+1;
}
else if (ox==getmaxx()-50)
{
tx=-1;
ox=ox-1;
}
else if(tx==0)
ox=ox+1;
else if(tx==-1)
ox=ox-1;
}
void gety(int &oy)
{
if (oy==50)
{
ty=0;
oy=oy+1;
}
else if (oy==getmaxy()-50)
{
ty=-1;
oy=oy-1;
}
else if(ty==0)
oy=oy+1;
else if(ty==-1)
oy=oy-1;
}
void rock(int i,int j)
{
line(i,j+getmaxy()-100,i+150,j+100);
arc(i+165,j+106,29,150,16);
//arc(i+100,j+50,34,150,16);
line(i+180,j+100,i+300,j+getmaxy()-100);
}
int rev=0,re1=0;
int d=180,r=15,d1=100,r1=9;
int getr()
{
if (d==45)
{
if(d1==60)
{
re1=1;
r1--;
}
rev=1;
r=r-1;
}
else if(d==180)
{
if(d1==200)
{
re1=0;
re1++;
}
rev=0;
r=r+1;
}
else if (rev==0)
{
if(re1==0)
{
re1++;
}
r=r+1;
}
else if (rev==1)
{
if(re1=1)
{
re1--;
}
r=r-1;
}
return(r);
return(r1);
}
int getd()
{
if (d==45)
{
if(d==60)
{
re1=1;
d1=d1+5;
}
rev=1;
d=d+5;
}
else if(d==180)
{
if(d==210)
{
re1=0;
d1=d1-5;
}
rev=0;
d=d-5;
}
else if(rev==1)
{
if(re1==1)
{
d1=d1+5 ;
}
d=d+5;
}
else if (rev==0)
{
if(re1==0)
{
d1=d1-5;
}
d=d-5;
}
return(d);
return(d1);
}
void main()
{
int i,j,x,y,x1,y1;
int gdriver = DETECT, gmode, errorcode;
/* initialize graphics mode */
initgraph(&gdriver, &gmode, "..\\bgi");
x=10;
y=10;
x1=24;
y1=24;
a:
cleardevice();
getx(x);
gety(y);
arc(x-r,y,0,getd(),getr());
arc(x+r,y,180-getd(),180,getr());
//arc(x-r1,y,0,getd(),getr());
//arc(x+r1,y,180-getd(),180,getr());
rock(4,20);
rock(180,39);
rock(340,63);
circle(45,40,36);
settextstyle(0,HORIZ_DIR,1);
outtextxy((getmaxx()/2)-10,getmaxy()-10,"press ESCAPE key to stop");
while(!kbhit())
{
delay(20);
goto a;
}
if (getch()==ESC_KEY)
{
exit(1);
}
else
goto a;
}
#include <conio.h>
#include <iostream.h>
#include <math.h>
#include <dos.h>
#include <stdlib.h>
#define ESC_KEY 0x1b
int tx=0,ty=0;
void getx(int &ox)
{
if (ox==50)
{
tx=0;
ox=ox+1;
}
else if (ox==getmaxx()-50)
{
tx=-1;
ox=ox-1;
}
else if(tx==0)
ox=ox+1;
else if(tx==-1)
ox=ox-1;
}
void gety(int &oy)
{
if (oy==50)
{
ty=0;
oy=oy+1;
}
else if (oy==getmaxy()-50)
{
ty=-1;
oy=oy-1;
}
else if(ty==0)
oy=oy+1;
else if(ty==-1)
oy=oy-1;
}
void rock(int i,int j)
{
line(i,j+getmaxy()-100,i+150,j+100);
arc(i+165,j+106,29,150,16);
//arc(i+100,j+50,34,150,16);
line(i+180,j+100,i+300,j+getmaxy()-100);
}
int rev=0,re1=0;
int d=180,r=15,d1=100,r1=9;
int getr()
{
if (d==45)
{
if(d1==60)
{
re1=1;
r1--;
}
rev=1;
r=r-1;
}
else if(d==180)
{
if(d1==200)
{
re1=0;
re1++;
}
rev=0;
r=r+1;
}
else if (rev==0)
{
if(re1==0)
{
re1++;
}
r=r+1;
}
else if (rev==1)
{
if(re1=1)
{
re1--;
}
r=r-1;
}
return(r);
return(r1);
}
int getd()
{
if (d==45)
{
if(d==60)
{
re1=1;
d1=d1+5;
}
rev=1;
d=d+5;
}
else if(d==180)
{
if(d==210)
{
re1=0;
d1=d1-5;
}
rev=0;
d=d-5;
}
else if(rev==1)
{
if(re1==1)
{
d1=d1+5 ;
}
d=d+5;
}
else if (rev==0)
{
if(re1==0)
{
d1=d1-5;
}
d=d-5;
}
return(d);
return(d1);
}
void main()
{
int i,j,x,y,x1,y1;
int gdriver = DETECT, gmode, errorcode;
/* initialize graphics mode */
initgraph(&gdriver, &gmode, "..\\bgi");
x=10;
y=10;
x1=24;
y1=24;
a:
cleardevice();
getx(x);
gety(y);
arc(x-r,y,0,getd(),getr());
arc(x+r,y,180-getd(),180,getr());
//arc(x-r1,y,0,getd(),getr());
//arc(x+r1,y,180-getd(),180,getr());
rock(4,20);
rock(180,39);
rock(340,63);
circle(45,40,36);
settextstyle(0,HORIZ_DIR,1);
outtextxy((getmaxx()/2)-10,getmaxy()-10,"press ESCAPE key to stop");
while(!kbhit())
{
delay(20);
goto a;
}
if (getch()==ESC_KEY)
{
exit(1);
}
else
goto a;
}
No comments:
Post a Comment