Man Walking
CODE:
#include<stdio.h>#include<graphics.h>
#include<conio.h>
#define GroundY getmaxx()*0.75
int l=0;
void man(int x,int l)
{
//head
circle(x,GroundY-90,10);
line(x,GroundY-80,x,GroundY-30);
//hand
line(x,GroundY-70,x+10,GroundY-60);
line(x,GroundY-65,x+10,GroundY-55);
line(x,GroundY-60,x,GroundY-70);
line(x,GroundY-55,x,GroundY-70);
//legs
line(x,GroundY-30,x+l,GroundY);
line(x,GroundY-30,x-l,GroundY);
}
void main()
{
int gd=DETECT,gm,x=0;
initgraph(&gd,&gm," ");
while(!kbhit())
{
//Draw Ground
line(0,GroundY,getmaxx(),GroundY);
l=(l+2)%20;
man(x,l);
delay(75);
cleardevice();
x=(x+2)%getmaxx();
}
getch();
}
Comments
Post a Comment