I have a sprite that moves around when a one of the arrow keys is pressed however I would like the sprite to carry on moving in the direction of the key for a small amount of time after the key has been released, as if it was sliding around on ice.
'''
mv_speed = 5
def move(self):
global mv_speed
keys = pg.key.get_pressed()
self.pos_x += (mv_speed * (keys[pg.K_RIGHT] - keys[pg.K_LEFT]))
self.pos_y += (mv_speed * (keys[pg.K_DOWN] - keys[pg.K_UP]))
if keys == False:
self.pos_x += 50 * (keys[pg.K_RIGHT] - keys[pg.K_LEFT])
self.pos_y += 50 * (keys[pg.K_DOWN] - keys[pg.K_UP])
self.rect.center = [self.pos_x,self.pos_y]
'''