OtsoSilver

Untitled

Aug 29th, 2021
1,160
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.08 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.  
  15. # Переменные
  16. count = 0
  17. click = 1
  18.  
  19. def draw():
  20.     fon.draw()
  21.     animal.draw()
  22.     screen.draw.text(count, center=(150, 100), color="white", fontsize = 96)
  23.     bonus_1.draw()
  24.     screen.draw.text("+1$ каждые 2с", center=(450, 80), color="black", fontsize = 20)
  25.     screen.draw.text("цена: 15$", center=(450, 110), color="black", fontsize = 20)
  26.     bonus_2.draw()
  27.     screen.draw.text("+15$ каждые 2с", center=(450, 180), color="black", fontsize = 20)
  28.     screen.draw.text("цена: 200$", center=(450, 210), color="black", fontsize = 20)
  29.  
  30. def on_mouse_down(button, pos):
  31.     global count
  32.     if button == mouse.LEFT:
  33.         # Клик по объекту animal
  34.         if animal.collidepoint(pos):
  35.             count += click
  36.             animal.y = 200
  37.             animate(animal, tween='bounce_end', duration=0.5, y=250)
Advertisement
Add Comment
Please, Sign In to add comment