Advertisement
OtsoSilver

Untitled

Sep 19th, 2021
859
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.14 KB | None | 0 0
  1. #pgzero
  2.  
  3. WIDTH = 600
  4. HEIGHT = 400
  5.  
  6. TITLE = "Animal clicker"
  7. FPS = 30
  8.  
  9. # Объекты
  10. animal = Actor("giraffe", (150, 250))
  11. fon = Actor("fon")
  12. bonus_1 = Actor("bonus", (450, 100))
  13. bonus_2 = Actor("bonus", (450, 200))
  14. price_b1 = 15
  15. price_b2 = 200
  16. # Переменные
  17. count = 0
  18. click = 1
  19.  
  20. def draw():
  21.     fon.draw()
  22.     animal.draw()
  23.     screen.draw.text(count, center=(150, 100), color="white", fontsize = 96)
  24.     bonus_1.draw()
  25.     screen.draw.text("+1$ каждые 2с", center=(450, 80), color="black", fontsize = 20)
  26.     screen.draw.text("цена: "+str(price_b1)+"$", center=(450, 110), color="black", fontsize = 20)
  27.     bonus_2.draw()
  28.     screen.draw.text("+15$ каждые 2с", center=(450, 180), color="black", fontsize = 20)
  29.     screen.draw.text("цена: "+str(price_b2)+"$", center=(450, 210), color="black", fontsize = 20)
  30.  
  31.  
  32. def on_mouse_down(button, pos):
  33.     global count
  34.     if button == mouse.LEFT:
  35.         # Клик по объекту animal
  36.         if animal.collidepoint(pos):
  37.             count += click
  38.             animal.y = 200
  39.             animate(animal, tween = 'bounce_end', duration=0.5, y = 250)
  40.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement