Advertisement
Guest User

Untitled

a guest
Oct 17th, 2017
54
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.10 KB | None | 0 0
  1.  
  2. #include<stdio.h>
  3. #include<graphics.h>
  4.  
  5. #define ScreenWidth getmaxx()
  6. #define ScreenHeight getmaxy()
  7. #define GroundY ScreenHeight*0.75
  8.  
  9. int ldisp=0;
  10.  
  11. void DrawManAndUmbrella(int x,int ldisp)
  12. {
  13.  
  14. circle(x,GroundY-90,10);
  15. line(x,GroundY-80,x,GroundY-30);
  16.  
  17. line(x,GroundY-70,x+10,GroundY-60);
  18. line(x,GroundY-65,x+10,GroundY-55);
  19. line(x+10,GroundY-60,x+20,GroundY-70);
  20. line(x+10,GroundY-55,x+20,GroundY-70);
  21.  
  22. line(x,GroundY-30,x+ldisp,GroundY);
  23. line(x,GroundY-30,x-ldisp,GroundY);
  24.  
  25. pieslice(x+20,GroundY-120,0,180,40);
  26. line(x+20,GroundY-120,x+20,GroundY-70);
  27. }
  28.  
  29. void Rain(int x)
  30. {
  31. int i,rx,ry;
  32. for(i=0;i<400;i++)
  33. {
  34. rx=rand() % ScreenWidth;
  35. ry=rand() % ScreenHeight;
  36. if(ry<GroundY-4)
  37. {
  38. if(ry<GroundY-120 || (ry>GroundY-120 && (rx<x-20 || rx>x+60)))
  39. line(rx,ry,rx+0.5,ry+4);
  40. }
  41. }
  42. }
  43. int main()
  44. {
  45. int gd=DETECT,gm,x=0;
  46.  
  47. initgraph(&gd,&gm,"C:\Program Files (x86)");
  48. while(!kbhit())
  49. {
  50.  
  51. line(0,GroundY,ScreenWidth,GroundY);
  52. Rain(x);
  53. ldisp=(ldisp+2)%20;
  54. DrawManAndUmbrella(x,ldisp);
  55. delay(75);
  56. cleardevice();
  57. x=(x+2)%ScreenWidth;
  58. }
  59. getch();
  60. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement