Repciu

Untitled

Oct 25th, 2023
124
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.98 KB | None | 0 0
  1. import pygame
  2.  
  3. class Obraz(pygame.sprite.Sprite):
  4. def __init__(self, sciezka):
  5. super().__init__()
  6. self.obraz = pygame.image.load(sciezka)
  7.  
  8.  
  9. class Element():
  10. def __init__(self, typ):
  11. self.wybrany = 0
  12. self.lista_obrazow = []
  13. for i in range(1,4):
  14. sciezka = f"images/{typ}{i}.png"
  15. wczytany_obraz = Obraz(sciezka)
  16. self.lista_obrazow.append(wczytany_obraz)
  17.  
  18.  
  19. def wybierzNastepny(self):
  20. self.wybrany +=1
  21. if self.wybrany > 2:
  22. self.wybrany = 0
  23.  
  24. def wybranyObraz(self):
  25. return self.lista_obrazow[self.wybrany].obraz
  26.  
  27. class Head(Element):
  28. def __init__(self):
  29. super().__init__("head")
  30.  
  31. class Body(Element):
  32. def __init__(self):
  33. super().__init__("body")
  34.  
  35. class Eye(Element):
  36. def __init__(self):
  37. super().__init__("eye")
  38.  
  39. class Weapon(Element):
  40. def __init__(self):
  41. super().__init__("weapon")
  42.  
Advertisement
Add Comment
Please, Sign In to add comment