A man walking with umbrella in the rain.

On October 7, 2008, in Animation, Drawing, Shapes, by , Views : 29647


1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
#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();
 
    // DRAW THE GROUND
    setcolor(BROWN);
    line(0, 201, 600, 201);
 
  cont:
 
    while (!kbhit()) {   // UNLESS a KEY is pressed
 
    	// DRAW THE MAN
	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);
 
	// DRAW THE RAIN
	for (i = 0; i < 620; i += 20) {
	    rain(i, c, i, 200);
	}
	c++;
	if (c == 0)
	    c = -100;
 
	setcolor(0);
	delay(50);
 
	// REMOVE THE MAN
	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);
 
	// MOVE THE COORDINATES OF THE MAN
	x++;
 
	// CODE for MOVING the LEG
	l--;
	if (l == -15)
	    l = 15;
 
	// CODE for MOVING the HAND    
	if (ht == 1)
	    h++;
	else
	    h--;
 
	if (h == 15)
	    ht = 0;
	else if (h == -15)
	    ht = 1;
 
    }
 
    // PAUSE THE MOVEMENT IF 'SPACEBAR' IS PRESSED, EXIT OTHERWISE
    if (getch() == ' ') {
	while (!kbhit());
	getch();
	goto cont;
    }
}

Hope, it helps! 🙂



15 Responses to A man walking with umbrella in the rain.

  1. ketty says:

    i like every programs

  2. Strings says:

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

  3. DHANYA says:

    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

  4. Amit Badam says:

    nice progame i like it..

  5. uma says:

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

  6. pranay says:

    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…..

  7. shikha says:

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

  8. rose says:

    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

  9. anchana says:

    really good….

  10. raivna says:

    nice code

  11. Kartik says:

    Well done.. Thanks for posting!

  12. makwanaurvashi says:

    nice program

  13. vatsal says:

    good one..

  14. Anitha says:

    nice and good one

  15. kokila says:

    Its very useful for me, i like it, thank u

Leave a Reply

Your email address will not be published. Required fields are marked *


*

Looking for something?

Use the form below to search the site:

Still not finding what you're looking for? Drop a comment on a post or contact us so we can take care of it!

Visit our friends!

A few highly recommended friends...

  • Dipin Krishna

Archives

All entries, chronologically...

Read more:
Rotation
2D Transformations: Rotation

kite
Flying Kite

Rotated Figure
2D Transformations: Translations, Scaling, Rotation and Shearing

MinMaxClose