OtsoSilver

Untitled

Sep 19th, 2021
638
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  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.  
  13. # Переменные
  14. count = 0
  15. click = 1
  16.  
  17. def draw():
  18.     fon.draw()
  19.     animal.draw()
  20.     screen.draw.text(count, center=(150, 100), color="white", fontsize = 96)
  21.  
  22. def on_mouse_down(button, pos):
  23.     global count
  24.     if button == mouse.LEFT:
  25.         # Клик по объекту animal
  26.         if animal.collidepoint(pos):
  27.             count += click
  28.             animal.y = 200
  29.             animate(animal, tween = 'bounce_end', duration=0.5, y = 250)
  30.  
RAW Paste Data