I am making a game using python and pygame and as my game started to grow, in some of my classes the number of instance variables started to get big. Like in the settings class is like this:
class Settings: """A class to store all settings for Alien Invasion.""" def __init__(self): """Initialize the game's static settings.""" # Screen Settings self.screen_size = (1260, 700) self.screen_width = 1260 self.screen_height = 700 # game background images self.bg_img = pygame.image.load('images/background/space.jpg') self.second_bg = pygame.image.load('images/background/space2.png') self.third_bg = pygame.image.load('images/background/space4.jpg') self.game_over = pygame.image.load('images/other/gameover.png') self.pause = pygame.image.load('images/other/pause.png') self.fire_sound = pygame.mixer.Sound('sounds/fire.wav') self.endless = False self.last_stand = False # Ships settings self.max_hp = 5 self.thunderbird_hp = 3 self.phoenix_hp = 3 # Thunderbolt settings self.thunderbird_bullet_count = 1 # Firebird settings self.phoenix_bullet_count = 50 # Alien settings self.alien_direction = 1 self.max_alien_speed = 4.0 self.max_aliens_num = 35 self.boss_hp = 50 self.boss_points = 2500 self.alien_points = 1 self.endless_num = 50 # PowerUps settings self.powerup_speed = 1.5 # How quickly the game speeds up self.speedup_scale = 0.3 self.score_scale = 4 self.initialize_dynamic_settings() # Player1 controls self.p1_controls = ("Player 1:\n" "Movement: Arrow Keys\n" "Shoot: Enter\n" "Ship skin: Numpad 1, 2, 3\n" "Pause: P") # Player2 controls self.p2_controls = ("Player 2:\n" "Movement: W, A, S, D\n" "Shoot: Space\n" "Ship skin: 1, 2, 3\n" "Pause: P")
My question now is, i should create different classes for different groups of variables and call the classes inside the Settings, o I should just group the variables in different methods in the Settings class?