Advertisement
dmesticg

Untitled

Apr 3rd, 2018
122
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.21 KB | None | 0 0
  1. import random
  2. def setup():
  3. global textboxes,man,manfill,penny,pennyspeed,pennyfill,arcx,arcy
  4. global backgroundcolor
  5. global wall,ground,arcdrop
  6. global pause,clicked
  7. global randomnumber, arcsize
  8. #---objects---
  9. restart_text = [500,20,100,50,"Restart",color(50,156,69)]
  10. pause_text = [500,70,100,50,"Pause",color(69,11,200)]
  11. throw_text = [270,450,100,50,"Throw",color(255,99,71)]
  12. score_text = [500,120,100,50,"Scores",color(0,191,255)]
  13. textboxes = [restart_text,pause_text,throw_text,score_text]
  14. man = [0,350,50,100]
  15. manfill = 255
  16. penny = [50,400,10]
  17. pennyspeed = 2
  18. pennyfill = color(139,69,19)
  19. arcx = 0
  20. arcy = 400
  21. #---boundries---
  22. wall = [650,450,650,0]
  23. ground = [0,450,675,450]
  24. arcdrop = [0,ground[1],arcy]
  25. #---booleans---
  26. pause = False
  27. clicked = False
  28. #---other---
  29. backgroundcolor = 180
  30. #---code---
  31. size(675,500)
  32. randomnumber = random.randint(1,10)*20
  33. arcsize = randomnumber
  34.  
  35. def drawtextboxes(textboxes):
  36. textSize(30)
  37. fill(255)
  38. for i in range(len(textboxes)):
  39. fill(textboxes[i][5])
  40. rect(textboxes[i][0],textboxes[i][1],textboxes[i][2],textboxes[i][3])
  41. fill(255)
  42. text(textboxes[i][4],textboxes[i][0],textboxes[i][1]+35)
  43.  
  44. def draw():
  45. global textboxes,man,manfill,penny,pennyspeed,pennyfill,arcx,arcy
  46. global backgroundcolor
  47. global wall,ground,arcdrop
  48. global pause,arcsize
  49. background(backgroundcolor)
  50. arcx = man[0] + (arcsize / 2) + man[2]
  51. arcdrop[0] = arcx + (arcsize / 2)
  52. fill(manfill)
  53. rect(man[0],man[1],man[2],man[3])
  54. fill(pennyfill)
  55. ellipse(penny[0],penny[1],penny[2],penny[2])
  56. noFill()
  57. stroke(0)
  58. arc(arcx,arcy,arcsize,arcsize,PI,TWO_PI)
  59. line(arcdrop[0],arcdrop[1],arcdrop[0],arcdrop[2])
  60. line(ground[0],ground[1],ground[2],ground[3])
  61. line(wall[0],wall[1],wall[2],wall[3])
  62. # drawtextboxes(textboxes)
  63.  
  64. def isClicked(info):
  65. clicked = False
  66. if mousePressed and mouseButton == LEFT:
  67. if info[0] < mouseX < info[0] + info[2] and info[1] < mouseY < info[1] + info[3]:
  68. clicked = True
  69. return clicked
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement