Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import pygame
- import copy
- class Klocek(pygame.sprite.Sprite):
- def __init__(self, x, y, zycie):
- super(Klocek, self).__init__()
- self.oryginalny_obraz = pygame.image.load("images/brick.png")
- self.pozycja = pygame.Rect(x, y, 96, 48)
- self.zycie = zycie
- def aktualizuj(self):
- maska_koloru = 0
- if self.zycie == 3:
- maska_koloru = (128,0,0)
- if self.zycie == 2:
- maska_koloru = (0,128,0)
- if self.zycie == 1:
- maska_koloru = (0,0,128)
- self.obraz = copy.copy(self.oryginalny_obraz)
- self.obraz.fill(maska_koloru, special_flags=pygame.BLEND_ADD)
- def update(self):
- self.aktualizuj()
- def uderzenie(self):
- self.zycie -= 1
- if self.zycie <= 0:
- self.kill()
Advertisement
Add Comment
Please, Sign In to add comment