In my game the player has the avoid asteroids, and when the asteroid hits the bottom of the screen it's destroyed and the score increases by ten, but I want the asteroids speed to increase after the player reaches a certain score but every time I do this with the code I'm using the asteroid just glitches and the score begins to increase rapidly, could someone help me please?
The Asteroid class, the code is in the update method.
class Asteroid(games.Sprite):
global lives
global score
global inventory
"""
A asteroid which falls through space.
"""
image = games.load_image("asteroid_med.bmp")
speed = 2
def __init__(self, x,image, y = 10):
""" Initialize a asteroid object. """
super(Asteroid, self).__init__(image = image,
x = x, y = y,
dy = Asteroid.speed)
def update(self):
""" Check if bottom edge has reached screen bottom. """
if self.bottom>games.screen.height:
self.destroy()
score.value+=10
if score.value == 100:
Asteroid.speed+= 1
The score variable if needed
score = games.Text(value = 0, size = 25, color = color.green,
top = 5, right = games.screen.width - 10)
games.screen.add(score)