I'm trying to make my timer keep adding when we click e but Im not sure why I have to hold e for the timer to keep adding up my timer name is (tons) is there a way I could keep adding my timer when we click e instead of stopping when we are not clicking e anymore I tried the 'if event.type == pygame.K_e' but its the same thing I have to hold e
if keys[pygame.K_e]: # if we click e then it should keep adding tons
tons += 1
print(tons)
game loop V
run = True
while run:
# Making game run with fps
clock.tick(fps)
for event in pygame.event.get():
if event.type == pygame.QUIT:
run = False
# telling what to do when we say the word 'key'
keys = pygame.key.get_pressed()
if hit:
if keys[pygame.K_e]: # if we click e then it should keep adding tons
tons += 1
print(tons)
if tons > 10:
playerman.direction = "att"
if health2 > -21:
health2 -= 0.3
else:
playerman.direction = "Idle"
hit = False
if tons > 30:
tons = 0
playerman.direction = "Idle"