Ето код
import pygame
pygame.init()
window = pygame.display.set_mode((1000, 800))
pygame.display.set_caption("Test drawings")
player = pygame.image.load("C:\\Users\DeLL\Downloads\dfrt.png")
bg = pygame.image.load("C:\\Users\\DeLL\\Pictures\\ajy.jpg")
player1 = pygame.transform.scale(player, (60, 60))
x = 50
y = 730
wigh = 60
high = 60
speed = 5
jump = False
countjump = 10
lastMove = "right"
class snaryd():
def __init__(self, x, y, color, radius, facing):
self.x = x
self.y = y
self.color = color
self.facing = facing
self.radius = radius
self.vel = 8*facing
def draw(self, window):
pygame.draw.circle(window, self.color(self.x, self.y), self.radius)
def drawindow():
for bul in bullets:
bul.draw(window)
clock = pygame.time.Clock()
bullets = []
runGame = True
while runGame:
clock.tick(30)
for event in pygame.event.get():
if event.type == pygame.QUIT:
runGame = False
for bul in bullets:
if bul.x < 500 and bul.x > 0:
bul.x += bul.vel
else:
bullets.pop(bullets.index(bul))
keys = pygame.key.get_pressed()
if keys[pygame.K_e]:
if lastMove == "right":
facing = 1
else:
facing = -1
if len(bullets)<5:
bullets.append(snaryd(round(x + wigh//2), round(y + high//2), 8, (255, 0, 0), facing))
if keys[pygame.K_a] and x>5:
x -= speed
lastMove = "left"
if keys[pygame.K_d] and x<1000-60-5:
x += speed
lastMove = "right"
if not(jump):
if keys[pygame.K_SPACE]:
jump = True
else:
if countjump >= -10:
if countjump < 0:
y += (countjump**2)/2
else:
y -= (countjump**2)/2
countjump -=1
else:
jump = False
countjump = 10
for bul in bullets:
bul.draw(window)
window.blit(bg,(0, 0))
window.blit(player1,(x, y))
pygame.display.update()
pygame.quit()
Ето ошибка
bul.draw(window) /eror 'int' object is not callable
import pygame
pygame.init()
window = pygame.display.set_mode((1000, 800))
pygame.display.set_caption("Test drawings")
player = pygame.image.load("C:\\Users\DeLL\Downloads\dfrt.png")
bg = pygame.image.load("C:\\Users\\DeLL\\Pictures\\ajy.jpg")
player1 = pygame.transform.scale(player, (60, 60))
x = 50
y = 730
wigh = 60
high = 60
speed = 5
jump = False
countjump = 10
lastMove = "right"
class snaryd():
def __init__(self, x, y, color, radius, facing):
self.x = x
self.y = y
self.color = color
self.facing = facing
self.radius = radius
self.vel = 8*facing
def draw(self, window):
pygame.draw.circle(window, self.color(self.x, self.y), self.radius)
def drawindow():
for bul in bullets:
bul.draw(window)
clock = pygame.time.Clock()
bullets = []
runGame = True
while runGame:
clock.tick(30)
for event in pygame.event.get():
if event.type == pygame.QUIT:
runGame = False
for bul in bullets:
if bul.x < 500 and bul.x > 0:
bul.x += bul.vel
else:
bullets.pop(bullets.index(bul))
keys = pygame.key.get_pressed()
if keys[pygame.K_e]:
if lastMove == "right":
facing = 1
else:
facing = -1
if len(bullets)<5:
bullets.append(snaryd(round(x + wigh//2), round(y + high//2), 8, (255, 0, 0), facing))
if keys[pygame.K_a] and x>5:
x -= speed
lastMove = "left"
if keys[pygame.K_d] and x<1000-60-5:
x += speed
lastMove = "right"
if not(jump):
if keys[pygame.K_SPACE]:
jump = True
else:
if countjump >= -10:
if countjump < 0:
y += (countjump**2)/2
else:
y -= (countjump**2)/2
countjump -=1
else:
jump = False
countjump = 10
for bul in bullets:
bul.draw(window)
window.blit(bg,(0, 0))
window.blit(player1,(x, y))
pygame.display.update()
pygame.quit()
Ето ошибка
bul.draw(window) /eror 'int' object is not callable