Flying Kite

On April 15, 2012, in Animation, Drawing, by , Views : 27613


Program to implement a FLYING KITE using built-in functions available in the library.

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
#include<stdio.h>
#include<stdlib.h>
#include<conio.h>
#include<dos.h>
#include<graphics.h>
#include<ctype.h>
#include<math.h>
 
void main()
{
        int gd=DETECT,gm;
        int color;
        int x=10,y=1,inc_x=10,inc_y=10;
        int poly[10];
 
        initgraph(&gd,&gm," ");
 
        while(!kbhit())
        {
                x += inc_x;
                if(x > 200)
                        inc_x = -5;
                if(x < 0 )
                        inc_x = 10;
                y += inc_y;
                if(y > 100)
                        inc_y = -10;
                if(y < 0 )
                        inc_y = 10;
                cleardevice();
                setcolor(WHITE);
                setbkcolor(BLUE);
 
                poly[0]=100+x;
                poly[1]=50+y;
                poly[2]=140+x;
                poly[3]=100+y;
                poly[4]=100+x;
                poly[5]=155+y;
                poly[6]=60+x;
                poly[7]=100+y;
                poly[8]=100+x;
                poly[9]=50+y;
                drawpoly(5,poly);
                setfillstyle(SOLID_FILL,RED);
                fillpoly(5,poly);
 
                setlinestyle(SOLID_LINE,1,3);
                line(100+x,155+y,100+x,180+y);
                line(100+x,155+y,110+x,180+y);
                line(100+x,155+y,90+x,180+y);
 
                setlinestyle(SOLID_LINE,1,0);
                line(0,480,100+x,90+y);
                line(100+x,90+y,130+x,100+y);
                line(100+x,90+y,70+x,100+y);
                line(100+x,90+y,100+x,70+y);
 
                delay(260);
        }
        setlinestyle(SOLID_LINE,0,0);
        fflush(stdin);
}

Download the code using the below link:

Please 'Like' or '+1' us to get the download link! (If you have already liked us on facebook, then like us either on G+ or twitter)

Hope, it helps! 🙂



7 Responses to Flying Kite

  1. lalit says:

    YOUR websites very good .realal

  2. twinkle says:

    Good work sir :)kindly include comments along with the code

  3. suchi says:

    Gud wrk…

  4. renu says:

    nice….

  5. Sukhvir Singh says:

    Nice One

  6. koustubh muktibodh says:

    dear dipin sir,
    i liked your programming style and the way you have illustrated is very much appreciable.

  7. ramya kompelli says:

    Nice it obously it will help.

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:
clock ticking
Show the ticking of Clock

pendulum
Pendulum

line
Bresenham’s Line Drawing Algorithm

MinMaxClose