I'm trying to add some difficulty in "game". Basically I want to call method to increase speed of a sprite everytime players score is multiply of 100 (it should happen on 100, 200, etc.).
I'm using pygame and livewires packages.
How I handled it was by using range like:
if self.score.value in range(0, 10000+1, 100):
pizza.update_speed()
and update method just increases speed:
def update_speed(self):
Pizza.speed += 0.25
So... it works but I am sure that it is not elegant and there is a better way of doing it.
How should I code it so I can check the score "infinitely" and in a proper way?
You can check if the remainder (
%
) of the division ofself.score.value
and 100 is 0: