'Python Crash Course - Alien Invasion - increase_speed() doesn't work

I'm doing Alien invasion. At the chapter Leveling up, i've an issue with the method increase_speed(). It does nothing, so the game won't go faster after a new wave of aliens arrives.

Here is my code in settings.py:

def initialize_dynamic_settings(self):

    self.velocity = 2.0
    self.projectile_speed = 3.0
    self.alien_speed = 1.0
    # 1 = droite, -1 = gauche
    self.fleet_direction = 1

def increase_speed(self):
    self.velocity *= self.speed_scale
    self.alien_speed *= self.speed_scale
    self.projectile_speed *= self.speed_scale

And in main.py

    def check_collisions_bullet_alien(self):
    # Gestion des collisions entre le groupe projectiles et le groupe aliens, résultant du kill des deux entités
    collision = pygame.sprite.groupcollide(self.projectiles_gp, self.alien.aliens_gp, True, True)
    if collision :
        self.stats.score += self.settings.alien_points
    if not self.alien.aliens_gp:
        self.projectiles_gp.empty()
        self.alien.create_fleet()
        self.settings.increase_speed()
        self.stats.score += self.settings.all_aliens_points

I've checked for the source code of the game on the web but I don't understand where I've made a mistake.

Thanks for your help ;)



Solution 1:[1]

Solved : I was trying to change a static variable throught an instance of the Settings class. So, Python was creating a dynamic variable instead of changing the static one.

Solution : Call directly the static variable of the Class to change it in the increase_speed() fonction.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Furvent