OtsoSilver

Untitled

Aug 29th, 2021
1,084
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.46 KB | None | 0 0
  1. #pgzero
  2.  
  3. WIDTH = 600
  4. HEIGHT = 400
  5.  
  6. TITLE = "Animal clicker"
  7. FPS = 30
  8. # Объекты
  9. animal = Actor("giraffe", (150, 250))
  10. fon = Actor("fon")
  11. bonus1 = Actor('bonus', (450, 100))
  12. bonus2 = Actor('bonus', (450, 200))
  13. # Переменные
  14. count = 0
  15. click = 1
  16.  
  17. def draw():
  18.     fon.draw()
  19.     animal.draw()
  20.     screen.draw.text(count, color = 'white', center = (150,100), fontsize= 96)
  21.     bonus1.draw()
  22.     screen.draw.text("+1$ каждые 2с", center=(450, 80), color="black", fontsize = 20)
  23.     screen.draw.text("цена: 15$", center=(450, 110), color="black", fontsize = 20)
  24.     bonus2.draw()
  25.     screen.draw.text("+15$ каждые 2с", center=(450, 180), color="black", fontsize = 20)
  26.     screen.draw.text("цена: 200$", center=(450, 210), color="black", fontsize = 20)
  27.  
  28. def for_bonus1():
  29.     global count
  30.     count+=1
  31. def for_bonus2():
  32.     global count
  33.     count+=15    
  34.    
  35. def on_mouse_down(button,pos):
  36.     global count
  37.     if button == mouse.LEFT:
  38.         if animal.collidepoint(pos):
  39.             count += click
  40.             animal.y = 200
  41.             animate(animal, tween='bounce_end', duration=0.5, y=250)
  42.         if bonus1.collidepoint(pos):
  43.             if count >= 15:
  44.                 count -= 15
  45.                 schedule_interval(for_bonus1, 2)
  46.            
  47.            
  48.            
  49.            
  50.            
  51.            
  52.            
  53.            
  54.            
  55.            
  56.            
  57.            
  58.            
Advertisement
Add Comment
Please, Sign In to add comment