├── Bouncing Ball.C └── README.md /Bouncing Ball.C: -------------------------------------------------------------------------------- 1 | // Author : youtube channel-dotnetmob 2 | // Date : 10-Sep-2015 3 | // Description : CG program for bouncing ball 4 | 5 | #include 6 | #include 7 | 8 | #define HEIGHT getmaxy() 9 | #define WIDTH getmaxx() 10 | #define GROUND 450 11 | #define MAXHEIGHT 420 12 | 13 | void main() 14 | { 15 | int x,y=0,t=MAXHEIGHT,c=1; 16 | int gd=DETECT,gm; 17 | initgraph(&gd,&gm,"C:\\T urboC3\\BGI"); 18 | 19 | for(x=40;x<=getmaxx();x=x+2) 20 | { 21 | //Draw Ground 22 | rectangle(0,MAXHEIGHT,getmaxx(),MAXHEIGHT+5); 23 | floodfill(5,MAXHEIGHT+3,WHITE); 24 | //Draw Ball 25 | pieslice(x,y,0,360,20); 26 | //floodfill(x,y,RED); 27 | delay(100); 28 | if(y>MAXHEIGHT-20) 29 | { 30 | c=0; 31 | t=t-40; 32 | } 33 | if(y<=(MAXHEIGHT-t)) 34 | { 35 | c=1; 36 | } 37 | if(t>=40) 38 | y=y+(c?15:-15); 39 | 40 | cleardevice(); 41 | //Exit upon keypress 42 | if(kbhit()) 43 | break; 44 | } 45 | getch(); 46 | } -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # CG Program For Bouncing Ball 2 | Computer Graphics Program For Bouncing Ball in C Programming. 3 | 4 | ## Get the Code 5 | 6 | ``` 7 | $ git clone https://github.com/CodAffection/CG-Program-For-Bouncing-Ball.git 8 | ``` 9 | 10 | ## How it works ? 11 | 12 | :tv: Video tutorial on this same topic 13 | Url : https://youtu.be/vW-6BsM5llM 14 | 15 | Demo for Bouncing Ball in C Programming 18 | 19 | 20 | | :bar_chart: | List of Tutorials | | :moneybag: | Support Us | 21 | |--------------------------:|:---------------------|---|---------------------:|:-------------------------------------| 22 | | Angular |http://bit.ly/2KQN9xF | |Paypal | https://goo.gl/bPcyXW | 23 | | Asp.Net Core |http://bit.ly/30fPDMg | |Amazon Affiliate | https://geni.us/JDzpE | 24 | | React |http://bit.ly/325temF | | 25 | | Python |http://bit.ly/2ws4utg | | :point_right: | Follow Us | 26 | | Node.js |https://goo.gl/viJcFs | |Website |http://www.codaffection.com | 27 | | Asp.Net MVC |https://goo.gl/gvjUJ7 | |YouTube |https://www.youtube.com/codaffection | 28 | | Flutter |https://bit.ly/3ggmmJz| |Facebook |https://www.facebook.com/codaffection | 29 | | Web API |https://goo.gl/itVayJ | |Twitter |https://twitter.com/CodAffection | 30 | | MEAN Stack |https://goo.gl/YJPPAH | | 31 | | C# Tutorial |https://goo.gl/s1zJxo | | 32 | | Asp.Net WebForm |https://goo.gl/GXC2aJ | | 33 | | C# WinForm |https://goo.gl/vHS9Hd | | 34 | | MS SQL |https://goo.gl/MLYS9e | | 35 | | Crystal Report |https://goo.gl/5Vou7t | | 36 | | CG Exercises in C Program |https://goo.gl/qEWJCs | | 37 | --------------------------------------------------------------------------------