giganciprogramowania

platforma.py (Arkanoid cz1)

Feb 2nd, 2026 (edited)
54
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.67 KB | None | 0 0
  1. import pygame
  2.  
  3. SZEROKOSC_EKRANU = 1024
  4. WYSOKOSC_EKRANU = 800
  5.  
  6. class Platforma(pygame.sprite.Sprite):
  7. def __init__(self):
  8. super(Platforma, self).__init__()
  9. self.obraz = pygame.image.load("images/pad.png")
  10. self.zresetuj_pozycje()
  11.  
  12. #resetowanie pozycji
  13. def zresetuj_pozycje(self):
  14. self.rect = pygame.Rect(SZEROKOSC_EKRANU/2-70, WYSOKOSC_EKRANU-100, 140, 30)
  15.  
  16. #poruszanie platformą
  17. def ruszaj_platforma(self, wartosc):
  18. predkosc = 10
  19. self.rect.move_ip(wartosc*predkosc, 0)
  20. if self.rect.left <= 0: self.rect.x = 0
  21. if self.rect.right >= SZEROKOSC_EKRANU: self.rect.x = SZEROKOSC_EKRANU-140
  22.  
Advertisement
Add Comment
Please, Sign In to add comment