Advertisement
Guest User

Untitled

a guest
Feb 13th, 2016
45
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.43 KB | None | 0 0
  1. #A1R1ShahidIbrahimIS_pyde
  2. # Bear Bouncing
  3. # Ibrahim Shahid
  4. # Bear Bounces Across The Screen
  5. # 12/02/16 Revision 1
  6.  
  7.  
  8. #Setup
  9. def setup():
  10. size(1200, 800)
  11. initalize()
  12.  
  13. #Methods
  14. def initalize():
  15. global scl,pos,vel
  16. #Constants
  17.  
  18. #Vectors
  19. pos=PVector(0,60)
  20. vel=PVector(5,5)
  21.  
  22. #Variables
  23. scl = .5
  24.  
  25. #Images and Sounds
  26.  
  27.  
  28. def deadmau5 ():
  29. global scl,pos
  30.  
  31. pushMatrix();
  32. translate(pos.x, pos.y); #this reorients the origin to be at x=200 and y=200
  33. scale(1);
  34.  
  35. fill(204, 95, 0);
  36. #arms
  37. ellipse(131, 185, 135, 41);
  38. ellipse(280, 185, 135, 41);
  39. #body
  40. ellipse(203, 229, 126, 142);
  41. #ears
  42. fill(204, 95, 0);
  43. ellipse(177, 88, 33, 33);
  44. ellipse(227, 88, 33, 33);
  45. fill(242, 159, 239);
  46. ellipse(177, 88, 16, 16);
  47. ellipse(227, 88, 16, 16);
  48. #head
  49. fill(204, 95, 0);
  50. ellipse(203, 133, 93, 93);
  51. #legs
  52. ellipse(181, 273, 50, 50);
  53. ellipse(232, 273, 50, 50);
  54. fill(0, 0, 0);
  55. ellipse(235, 280, 25, 25);
  56. ellipse(180, 280, 25, 25);
  57. ellipse(170, 264, 6, 6);
  58. ellipse(181, 261, 6, 6);
  59. ellipse(192, 264, 6, 6);
  60. ellipse(222, 264, 6, 6);
  61. ellipse(234, 261, 6, 6);
  62. ellipse(245, 264, 6, 6);
  63. #eyes
  64. fill(255, 255, 255);
  65. ellipse(188, 122, 25, 25);
  66. ellipse(224, 122, 25, 25);
  67. #pupils
  68. fill(0, 0, 0);
  69. ellipse(188, 122, 10, 10);
  70. ellipse(224, 122, 10, 10);
  71. fill(255, 255, 255);
  72. ellipse(187, 121, 5, 5);
  73. ellipse(222, 121, 5, 5);
  74. fill(0, 0, 0);
  75. #nose
  76. fill(242, 159, 239);
  77. triangle(207, 155, 214, 142, 198, 142);
  78. #mouth
  79. fill(0, 0, 0);
  80. ellipse(208, 165, 30, 18);
  81. #fingers
  82. ellipse(100, 184, 26, 26);
  83. ellipse(311, 184, 26, 26);
  84. ellipse(77, 185, 6, 6);
  85. ellipse(83, 194, 6, 6);
  86. ellipse(83, 176, 6, 6);
  87. ellipse(170, 264, 6, 6);
  88. ellipse(181, 261, 6, 6);
  89. ellipse(192, 264, 6, 6);
  90. ellipse(332, 185, 6, 6);
  91. ellipse(328, 194, 6, 6);
  92. ellipse(328, 176, 6, 6);
  93.  
  94. popMatrix(); #this essentially resets the origin
  95.  
  96. def movedead():
  97. global vel,pos
  98. pos.add(vel)
  99. if (pos.x>width-350):
  100. vel.x=-1*vel.x
  101. if(pos.y>height-300):
  102. vel.y=-1*vel.y
  103. if(pos.x<-60):
  104. vel.x=-1*vel.x
  105. if(pos.y<-70):
  106. vel.y=-1*vel.y
  107. #Draw Method
  108. def draw ():
  109. background(0)
  110. deadmau5()
  111. movedead()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement