Dec-08-2017, 07:48 PM
Hello I am not sure how to really question my question if that makes sense. I am following metulburr's pygame tutorial and something I don't really understand is why when I make a class I have self. I have my example below but if someone could explain what self.*** actually does or clarify it simply that would help, also I see under the player class "def __init__" a lot why is __init__ commonly used?
class player: def __init__(self, screen_rect): self.image = pg.image.load('spaceship.png').contert() self.image.set_colorkey((255,0,255)) self.rect = self.image.get_rect(center = screen_rect.center) def draw(self, surf): surf.blit(self.image, self.rect)