python pygame sprint
well, i'm probably using it wrong....but here i'm trying to make my character(char) sprint only when i hold down LSHIFT with RIGHT but when i press it, the speed does increases, but it doesn't goes back to 5 from 10 if keys[pygame.K_RIGHT]: anim = walk_right[walk] px += char_speed walk += 1 if walk >= 9: walk = 1 if px >= W: px = 0 if keys[pygame.K_LSHIFT]: char_speed = 10 if event.type == pygame.KEYUP: if event.type == pygame.K_LSHIFT: char_speed = 5 if keys[pygame.K_LEFT]: anim = walk_left[walk] px -= char_speed walk += 1 if walk >= 9: walk = 0 if px <= 0: px = W