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")
- bonus1 = Actor('bonus', (450, 100))
- bonus2 = Actor('bonus', (450, 200))
- # Переменные
- count = 0
- click = 1
- bonus1_price = 15
- bonus2_price = 200
- def draw():
- fon.draw()
- animal.draw()
- screen.draw.text(count, color = 'white', center = (150,100), fontsize= 96)
- bonus1.draw()
- screen.draw.text("+1$ каждые 2с", center=(450, 80), color="black", fontsize = 20)
- screen.draw.text("цена: " + str(bonus1_price) + "$", center=(450, 110), color="black", fontsize = 20)
- bonus2.draw()
- screen.draw.text("+15$ каждые 2с", center=(450, 180), color="black", fontsize = 20)
- screen.draw.text("цена: " + str(bonus2_price) + "$", center=(450, 210), color="black", fontsize = 20)
- def for_bonus1():
- global count
- count+=1
- def for_bonus2():
- global count
- count+=15
- def on_mouse_down(button,pos):
- global count, bonus1_price,bonus2_price
- if button == mouse.LEFT:
- if animal.collidepoint(pos):
- count += click
- animal.y = 200
- animate(animal, tween='bounce_end', duration=0.5, y=250)
- if bonus1.collidepoint(pos):
- if count >= bonus1_price:
- count -= bonus1_price
- schedule_interval(for_bonus1, 2)
- bonus1_price *= 2
- if bonus2.collidepoint(pos):
- if count >= bonus2_price:
- count -= bonus2_price
- schedule_interval(for_bonus2, 2)
- bonus1_price *= 2
Advertisement
Add Comment
Please, Sign In to add comment