Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import random
- def setup():
- global textboxes,man,manfill,penny,pennyspeed,pennyfill,arcx,arcy
- global backgroundcolor
- global wall,ground,arcdrop
- global pause,clicked
- global randomnumber, arcsize
- #---objects---
- restart_text = [500,20,100,50,"Restart",color(50,156,69)]
- pause_text = [500,70,100,50,"Pause",color(69,11,200)]
- throw_text = [270,450,100,50,"Throw",color(255,99,71)]
- score_text = [500,120,100,50,"Scores",color(0,191,255)]
- textboxes = [restart_text,pause_text,throw_text,score_text]
- man = [0,350,50,100]
- manfill = 255
- penny = [50,400,10]
- pennyspeed = 2
- pennyfill = color(139,69,19)
- arcx = 0
- arcy = 400
- #---boundries---
- wall = [650,450,650,0]
- ground = [0,450,675,450]
- arcdrop = [0,ground[1],arcy]
- #---booleans---
- pause = False
- clicked = False
- #---other---
- backgroundcolor = 180
- #---code---
- size(675,500)
- randomnumber = random.randint(1,10)*20
- arcsize = randomnumber
- def drawtextboxes(textboxes):
- textSize(30)
- fill(255)
- for i in range(len(textboxes)):
- fill(textboxes[i][5])
- rect(textboxes[i][0],textboxes[i][1],textboxes[i][2],textboxes[i][3])
- fill(255)
- text(textboxes[i][4],textboxes[i][0],textboxes[i][1]+35)
- def draw():
- global textboxes,man,manfill,penny,pennyspeed,pennyfill,arcx,arcy
- global backgroundcolor
- global wall,ground,arcdrop
- global pause,arcsize
- background(backgroundcolor)
- arcx = man[0] + (arcsize / 2) + man[2]
- arcdrop[0] = arcx + (arcsize / 2)
- fill(manfill)
- rect(man[0],man[1],man[2],man[3])
- fill(pennyfill)
- ellipse(penny[0],penny[1],penny[2],penny[2])
- noFill()
- stroke(0)
- arc(arcx,arcy,arcsize,arcsize,PI,TWO_PI)
- line(arcdrop[0],arcdrop[1],arcdrop[0],arcdrop[2])
- line(ground[0],ground[1],ground[2],ground[3])
- line(wall[0],wall[1],wall[2],wall[3])
- # drawtextboxes(textboxes)
- def isClicked(info):
- clicked = False
- if mousePressed and mouseButton == LEFT:
- if info[0] < mouseX < info[0] + info[2] and info[1] < mouseY < info[1] + info[3]:
- clicked = True
- return clicked
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement