I'm trying to make an old-style shooter game where I press spacebar a small rectangle shoots out of the bigger one which is the player but when I try to the smaller rectangle waits for a few seconds then shoots off how do I fix this so the smaller one immediately shoots off
import pygame
import sys
pygame.init()
bg=pygame.display.set_mode((1300,640))
FPS=pygame.time.Clock()
p=x,y,width,height=(0,0,100,100)
b=b_x,b_y,b_width,b_height=(0,0,25,25)
shoot=False
def draw():
global bullet,b_x
bullet=pygame.draw.rect(bg,(0,0,255),(b_x+100,y,b_width,b_height))
b_x+=50
while True:
for event in pygame.event.get():
if event.type==pygame.QUIT:
pygame.quit()
sys.exit()
if event.type==pygame.KEYDOWN:
if event.key==pygame.K_LEFT:
x-=50
if event.key==pygame.K_RIGHT:
x+=50
if event.key==pygame.K_SPACE:
shoot=True
bg.fill((0,0,0))
player1=pygame.draw.rect(bg,(255,0,0),(x,y,width,height))
if shoot:
draw()
pygame.display.update()
FPS.tick(120)