So in a game I'm creating when the player picks up the speed boost sprite I want the players speed to periodically boosted for around five seconds, could someone help me understand how to do this? The 'Handle Caught' method will contain the code for the speed boost, the actual speed of the player is also set as a global variable 'speed' which is equal to 2. Thank you in advance
class Addspeed(games.Sprite):
image = games.load_image('addspeed.png')
speed = 2
def __init__(self,x,y = 10):
super(Addspeed, self).__init__(image = Addspeed.image,
x = x, y = y,
dy = Addspeed.speed)
def update(self):
if self.bottom>games.screen.height:
self.destroy()
def handle_caught(self):
global speed