hello so I have just recently started using pygame to try and make a flappy bird clone. I am trying to use pygame.time.set_timer to refresh the jump every so often, but when I try I still can't jump more than once
Here's my code
import pygame
import os
pygame.init()
Windo = pygame.display.set_mode((500, 700))
pygame.display.set_caption("Flappy Flaprynth")
Birbimg = pygame.image.load("bird2gif.gif")
Birbx = 250
Birby = 350
CanBirbjmp = 1
running = True
birdactive = False
clock = pygame.time.Clock()
def draws():
Windo.fill((255, 255, 255))
Windo.blit(Birbimg, (Birbx, Birby))
pygame.display.update()
while running:
for event in pygame.event.get():
if event.type == pygame.QUIT:
running = False
pygame.time.set_timer(CanBirbjmp+1, 60, 1) # Here is my issue
keys = pygame.key.get_pressed()
if keys[pygame.K_SPACE] and CanBirbjmp == 1:
birdactive == True
CanBirbjmp = 0
for guac in range(10):
Birby -= 5
Birby += 1
draws()
clock.tick(60)
pygame.quit
I looked up the issue but the answer didn't apply to my situation. my code isn't the best I have written so it may be a bit hard to read.