so I made my character(player) to change its velocity faster if I press 'L shift' while pressing 'left key' or 'right key' at the same time. The problem is, I wanna make this 'dash' to stop when it reached to the limit I set. I want my character not to dash more than 400 at once. Is there any possible method I can do with..? because I tried many but I still couldn't find anything works. Here's part of my mainloop where the dash is set. char is defined before the loop.
while run:
clock.tick(20)
for event in pygame.event.get():
keys = pygame.key.get_pressed()
mods = pygame.key.get_mods()
if event.type == pygame.QUIT:
run = False
elif keys[pygame.K_LEFT] and mods & pygame.KMOD_LSHIFT or keys[pygame.K_RIGHT] and mods & pygame.KMOD_LSHIFT:
print("pressed: SHIFT")
char.vel = 20
#I wanna set dash limit to 400px but evry try sitll is all failled..
else:
char.vel = 5