i have a problem with my game, i am beginner. My Bullets not work(if i press multiple time, my bullet resset) for example if i want to shoot from the mouse (left_button), i press 1 time, bullet go top, if i press 3 times in 1 sec, my bullet is resst, coppy my code, and see! Please!
import pygame
pygame.init()
red = (189, 87, 87)
white = (230, 230, 230)
xbullet = 150
ybullet = 510
tix = 380
tiy = 50
screen = pygame.display.set_mode((800, 600))
window_title = pygame.display.set_caption("bullets")
xa, ya = pygame.mouse.get_pos()
running = True
bullet = pygame.draw.rect(screen, white, pygame.Rect(xa, ya, 5, 20))
while running:
for event in pygame.event.get():
if event.type == pygame.QUIT:
running = False
if event.type == pygame.MOUSEBUTTONDOWN:
xa, ya = pygame.mouse.get_pos()
click = pygame.mouse.get_pressed()
if click:
print(xa, ya)
screen.fill((94, 94, 94))
ya -= 2.15
object = pygame.draw.rect(screen, red, pygame.Rect(tix, tiy, 60 ,60))
bullet = pygame.draw.rect(screen, white, pygame.Rect(xa, ya, 5, 20))
pygame.display.flip()
pygame.display.update()