Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #pgzero
- WIDTH = 600
- HEIGHT = 400
- TITLE = "Animal clicker"
- FPS = 30
- # Объекты
- animal = Actor("giraffe", (150, 250))
- fon = Actor("fon")
- bonus_1 = Actor("bonus" , (450 , 100))
- bonus_2 = Actor("bonus" , (450 , 200))
- bonus_3 = Actor("bonus" , (450 , 300))
- play = Actor("play" , (300 , 75))
- cross = Actor("cross" , (580 , 20 ))
- shop = Actor("shop" , (300 , 175))
- collection = Actor("collection" , (300 , 275))
- price_bonus_1 = 15
- price_bonus_2 = 200
- price_bonus_3 = 600
- bonus_1_val = 1
- bonus_2_val = 15
- bonus_3_val = 50
- # Переменные
- count = 0
- click = 1
- mode = "menu"
- def draw():
- global mode
- if mode == "menu":
- fon.draw()
- play.draw()
- shop.draw()
- collection.draw()
- if mode == "game":
- fon.draw()
- animal.draw()
- screen.draw.text(count, center=(150,100), color = "white", fontsize = 96)
- bonus_1.draw()
- bonus_2.draw()
- bonus_3.draw()
- screen.draw.text("+"+str(bonus_1_val) + "$ каждые 2с", center=(450,80), color = "black", fontsize = 20)
- screen.draw.text("цена"+str(price_bonus_1)+"$", center=(450,110), color = "black", fontsize = 20)
- screen.draw.text("+"+str(bonus_2_val) + "$ каждые 2с", center=(450,180), color = "black", fontsize = 20)
- screen.draw.text("цена"+str(price_bonus_2)+"$", center=(450,210), color = "black", fontsize = 20)
- screen.draw.text("+"+str(bonus_3_val) + "$ каждые 2с", center=(450,280), color = "black", fontsize = 20)
- screen.draw.text("цена"+str(price_bonus_3)+"$", center=(450,310), color = "black", fontsize = 20)
- cross.draw()
- def for_bonus_1():
- global count
- count+= 1
- def for_bonus_2():
- global count
- count += 15
- def for_bonus_3():
- global count
- count += 50
- def on_mouse_down(button, pos):
- global count , click , price_bonus_1 , price_bonus_2 , bonus_1_val , bonus_2_val , mode , price_bonus_3 , bonus_3_val
- if button == mouse.LEFT and mode == "menu":
- if play.collidepoint(pos):
- mode = "game"
- if button == mouse.LEFT:
- if animal.collidepoint(pos):
- count += click
- animal.y = 200
- animate(animal, tween='bounce_end', duration=0.5, y=250)
- if bonus_1.collidepoint(pos):
- if count>= price_bonus_1:
- count-= price_bonus_1
- schedule_interval(for_bonus_1 , 2)
- price_bonus_1 += 15
- bonus_1_val += bonus_1_val
- bonus_1.y -= 5
- animate(bonus_1 , tween = "linear" , duration = 0.1 , y = 100)
- if bonus_2.collidepoint(pos):
- if count>= price_bonus_2:
- count-= price_bonus_2
- schedule_interval(for_bonus_2 , 2)
- price_bonus_2 += 200
- bonus_2_val += bonus_2_val
- bonus_2.y -= 5
- animate(bonus_2 , tween = "linear" , duration = 0.1 , y = 200)
- if bonus_3.collidepoint(pos):
- if count>= price_bonus_3:
- count-= price_bonus_3
- schedule_interval(for_bonus_3 , 2)
- price_bonus_3 += 600
- bonus_3_val += bonus_3_val
- bonus_3.y -= 5
- animate(bonus_3 , tween = "linear" , duration = 0.1 , y = 300)
- if cross.collidepoint(pos):
- if mode == "game":
- mode = "menu"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement