Bouncing Ball

On October 7, 2008, in Animation, by , Views : 18714


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
#include<stdio.h>
#include<conio.h>
#include<graphics.h>
#include<dos.h>
 
void main()
{
    int gd = DETECT, gm = DETECT;
    int x, y = 0, j, t = 400, c = 1;
    initgraph(&gd, &gm, "");
    setcolor(RED);
    setfillstyle(SOLID_FILL, RED);
    for (x = 40; x < 602; x++) {
	cleardevice();
	circle(x, y, 30);
	floodfill(x, y, RED);
	delay(40);
 
	if (y >= 400) {
	    c = 0;
	    t -= 20;
	}
	if (y <= (400 - t))
	    c = 1;
	y = y + (c ? 15 : -15);
 
    }
 
    getch();
}

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! 🙂



4 Responses to Bouncing Ball

  1. hii. thanks for graphics program!!it help me a lot!!my practical subject is computer graphics and multimedia and i'm so confused about multimedia program(sry…i'm an school of distance education student!! thatz wy..??)will u plz help me to find some programs using multimedia packages!!its so urgent!!plzz…..thank u..!

  2. Muhammad YouSaf says:

    very fantastic, great effort, nic..

  3. abirami.r says:

    super

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:
Car
Car Movement

kite
Flying Kite

wheel
Moving Wheel using Mid-Point Circle algorithm and DDA Line algorithm

MinMaxClose