im trying to shoot multiple bullets but i can only get it to shoot 1 then i have to restart the game how do i shoot multiple bullets ive tried doing for loops but i cant get them to work
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=(x,y,25,25)
bullets=[99]
shoot=False
def draw():
global bullet,b_x,shoot,m
b_x+=50
m=b_y+50
bullet=pygame.draw.rect(bg,(0,0,255),(b_x+100,m,b_width,b_height))
something()
def something():
pygame.draw.rect(bg, (0, 0, 255), (b_x + 100, m, b_width, b_height))
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(30)