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))
- # Переменные
- count = 0
- click = 1
- price_bonus_1 = 15
- price_bonus_2 = 200
- bonus_1_val = 1
- bonus_2_val = 15
- def draw():
- fon.draw()
- animal.draw()
- screen.draw.text(count,color='white', center = (150,100), fontsize=96)
- bonus_1.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)
- bonus_2.draw()
- 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)
- def for_bonus_1():
- global count
- count+=bonus_1_val
- def for_bonus_2():
- global count
- count+=bonus_2_val
- def on_mouse_down(button, pos):
- global count, price_bonus_1,price_bonus_2, bonus_2_val,bonus_1_val
- 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 *=4
- bonus_1_val *=2
- if bonus_2.collidepoint(pos):
- if count >= price_bonus_2:
- count -= price_bonus_2
- schedule_interval(for_bonus_2, 2)
- price_bonus_2 *=4
- bonus_2_val *=2
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement