i am new to python and I had a question about classes. After making a class, when you use def init(self), when is it necessary to have parameters after self. In some pygame I've seen that sometimes they included and sometimes not for example in the codes below for settings of game (Alien Invasion) and drawing a ship: I am confused that why is there a screen parameter, which is in the main program defining the display, and there is no parameter in settings. Please explain, thank you.
class Ship():
def __init__(self, screen):
# initializes the screen and set its starting postion
self.screen = screen
# now we load the image
self.image = pygame.image.load("ship.bmp")
self.rect = self.image.get_rect()
self.screen_rect = screen.get_rect()
# starting ship at each bottom of screen
self.rect.centerx = self.screen_rect.centerx
self.rect.bottom = self.screen_rect.bottom
def blitme(self):
# drawing ship at its locations, use blitme
self.screen.blit(self.image, self.rect)
class Settings():
def __init__(self):
self.screen_width = 1000
self.screen_height = 700
self.bg_color = (230, 230, 230)