A man walking in the rain.


#include<stdio.h> 
#include<dos.h> 
#include<conio.h> 
#include<graphics.h> 
#include<stdlib.h> 

void rain(int x1,int y1,int x2,int y2) 
{ 
    int s,dx,dy,m,c=0,t=1; 
    float xi,yi,x,y; 

    dx=x2-x1; 
    dy=y2-y1; 

    if(abs(dx)>abs(dy)) 
        s=abs(dx); 
    else 
        s=abs(dy); 

    xi=dx/(float)s; 
    yi=dy/(float)s; 

    x=x1; 
    y=y1; 

    putpixel(x1+0.5,y1+0.5,9); 

    for(m=0;m<s;m++) 
    { 
        c++; 
        x+=xi; 
        y+=yi; 
        if(getpixel(x,y)==4) 
            break; 
        if(c%10==0) 
            t++; 
        putpixel(x+0.5,y+0.5,0); 
        if(t%2==0) 
            putpixel(x+0.5,y+0.5,9); 

    } 

} 

void main() 
{ 
    int gd=DETECT,gm=DETECT,c=-200,i=0,x=40,l=15,h=15,ht=0; 
    initgraph(&gd,&gm,""); 
    cleardevice(); 
    setcolor(BROWN); 
    line(0,201,600,201); 

cont: 

    while(!kbhit()) 
    { 
        setcolor(4); 
        ellipse(x,100,0,180,50,30); 
        line(x-50,100,x+50,100); 
        line(x,100,x,150); 
        circle(x-20,115,15); 
        line(x-20,130,x-20,175); 
        line(x-20,175,x-20-l,200); 
        line(x-20,175,x-20+l,200); 
        line(x-20,140,x,150); 
        line(x-20,140,x-20-h,160); 


        for(i=0;i<620;i+=20) 
        { 
            rain(i,c,i,200); 
        } 
        c++; 
        if(c==0) 
            c=-100; 
        setcolor(0); 
        delay(50); 
        ellipse(x,100,0,180,50,30); 
        line(x-50,100,x+50,100); 
        line(x,100,x,150); 
        circle(x-20,115,15); 
        line(x-20,130,x-20,175); 
        line(x-20,175,x-20-l,200); 
        line(x-20,175,x-20+l,200); 
        line(x-20,140,x,150); 
        line(x-20,140,x-20-h,160); 

        line(x+50,100,x+50,200); 
        x++; 
        l--; 
        if(l==-15) 
            l=15; 
        if(ht==1) 
            h++; 
        else h--; 

        if(h==15) 
            ht=0; 
        else if(h==-15) 
            ht=1; 

    } 
    if(getch()==' ') 
    { 
        while(!kbhit()); 
        getch(); 
        goto cont; 
    } 
}

Comments

  1. Hey man keep posting...it helped me a lot..thanx..we need people lyk u

    ReplyDelete
  2. i need a program to show sinking of titanic... can you plz help me for that? itz very urgent.. my id is dhanyab07@gmail.com

    ReplyDelete
  3. hey just send me the skeleton walking and stretching a line into band by using mouseover

    ReplyDelete
  4. hey i need a program to draw the hut along with basic graphic geometric shapes as moon, mountains etc.;please send it to my mail pranayarahul@gmail.com its very urgent.....

    ReplyDelete
  5. hay plz pposting moving computer mouse i tried but i can't

    ReplyDelete
  6. hey.. i need a prgrm for haunted house.. just a house, the light glowing at the window and door creaking open.plz cud u send it to my id.. lovelrose2@gmail.com

    ReplyDelete

Post a Comment

Popular posts from this blog

Pendulum

Fish Movement

Moving Wheel