Ошибка TypeError: 'pygame.rect.Rect' object is not callable
Код игры, она запускается, но при попытке выстрелить выходить ошибка "TypeError: 'pygame.rect.Rect' object is not callable" что делать не знаю, подскажите кто может.
import pygame as pg
pg.init()
pg.font.init()
title = "Kill him!"
game_over = False
bullet_speed = 50
bullet_pos = (125, 325)
fps = 60
width = 800
height = 480
red = (191, 23, 23)
black = (0, 0, 0)
white = (255, 255, 255)
yelow = (241, 245, 34)
green = (13, 143, 26)
player_x = 125
player_y = 325
player_widht = 100
player_height = 100
player_speed = 8
player_last_move = "right"
roof_rect = pg.rect.Rect(0, 0, 800, 125)
floor_rect = pg.rect.Rect(0, 400, 800, 125)
player_rect = pg.rect.Rect(125, 325, 100, 100)
#bullet_rect = pg.rect.Rect(125, 325, 15, 5)
right_rect = pg.rect.Rect(801, 240, 5, 500)
bullit = pg.rect.Rect(player_x, player_y, 10, 10)
player_rect.x = player_x
player_rect.y = player_y
bullet = pg.image.load("bullet.png")
background = pg.image.load("grass.png")
player = pg.image.load("shooter2.png")
player = pg.transform.scale(player, (90, 105))
pg.mouse.set_visible(False)
screen = pg.display.set_mode([width, height])
pg.display.set_caption(title)
screen.blit(player, (player_rect))
class snaryad():
def __init__(self, player_x, player_y, radius, color, facing):
self.player_x = player_x
self.player_y = player_y
self.radius = radius
self.color = color
self.facing = facing
self.vel = 8 * facing
def draw(self, screen):
pg.draw.circle(screen, self.color, (self.x, self.y), self.radius)
snaryad = pg.rect.Rect(player_x, player_y, 10, 10)
clock = pg.time.Clock()
bullets = []
for bullit in bullets:
bullit.draw(screen)
running = True
while running:
for event in pg.event.get():
if event.type == pg.QUIT:
running = False
continue
for bullit in bullets:
if bullit.x < 800 and bullit.x > 0:
bullit.x += bullit.vel
else:
bullets.pop(bullets.index(bullit))
screen.blit(background,(0, 0))
screen.blit(background,(320, 0))
screen.blit(background,(640, 0))
screen.blit(background,(0, 320))
screen.blit(background,(320, 320))
screen.blit(background,(640, 320))
screen.blit(player, (player_rect))
if not game_over:
keys = pg.key.get_pressed()
if keys[pg.K_f]:
if player_last_move == "right":
facing = 1
else:
facing = -1
f
if len(bullets) < 10:
bullets.append[snaryad(round(player_x + player_widht // 2),
round(player_y + player_height // 2), 5, yelow, facing)]
if keys[pg.K_a] and player_rect.x > 5:
player_rect.x -= player_speed
player_last_move = "left"
elif keys[pg.K_d] and player_rect.x < 800 - player_rect.width - 5:
player_rect.x += player_speed
player_last_move = "right"
elif keys[pg.K_w] and player_rect.y > 5:
player_rect.y -= player_speed
elif keys[pg.K_s] and player_rect.y < 480 - player_rect.height - 5:
player_rect.y += player_speed
clock.tick(fps)
pg.display.flip()