создавал лёгкую игру для теста антиинжектора (просто обычний проект для теста) столкнулся с ошибкой что не может найти параметр "цвет" при этом он задан код:
import pygame
pygame.init()
win = pygame.display.set_mode((500, 500))
pygame.display.set_caption("Foxrik Game!")
walkRight = [pygame.image.load('right_2.png'),
pygame.image.load('right_2.png'),pygame.image.load('right_3.png'),
pygame.image.load('right_4.png'),pygame.image.load('right_5.png'),
pygame.image.load('right_6.png')]
walkLeft = [pygame.image.load('left_1.png'),
pygame.image.load('left_2.png'),pygame.image.load('left_3.png'),
pygame.image.load('left_4.png'),pygame.image.load('left_5.png'),
pygame.image.load('left_6.png')]
bg = pygame.image.load('bg.jpg')
playerStand = pygame.image.load('idle.png')
clock = pygame.time.Clock()
x = 225
y = 430
width = 60
height = 71
speed = 5
isJump = False
jumpcount = 10
left = False
right = False
animcount = 0
lastMove = "right"
class snaryad():
def __init__(self, x, y, radius, color, facing):
self.x = x
self.x=y
self.x=radius
self.x=color
self.x=facing
self.vel = 8 * facing
def draw(self, win):
pygame.draw.circle(win, self.color, (self.x, self.y),self.radius)
def drawWindow():
global animcount
win.blit(bg, (0, 0))
if animcount + 1 >= 30:
animcount = 0
if left:
win.blit(walkLeft[animcount // 5], (x,y))
animcount += 1
elif right:
win.blit(walkRight[animcount // 5], (x,y))
animcount += 1
else:
win.blit(playerStand, (x,y))
for bullet in bullets:
bullet.draw(win)
pygame.display.update()
run = True
bullets = []
while run:
clock.tick(30)
drawWindow()
for event in pygame.event.get():
if event.type == pygame.QUIT:
run = False
for bullet in bullets:
if bullet.x < 500 and bullet.x > 0:
bullet.x += bullet.vel
else:
bullets.pop(bullets.index(bullet))
keys = pygame.key.get_pressed()
if keys[pygame.K_f]:
if lastMove == "right":
facing = 1
else:
facing = -1
if len(bullets) < 5:
bullets.append(snaryad(round(x + width // 2), round(y + height // 2), 5, (255, 0, 0), facing))
keys = pygame.key.get_pressed()
if keys[pygame.K_a] and x > 5:
x -= speed
left = True
right = False
lastMove = "left"
elif keys[pygame.K_d] and x < 440:
x +=speed
right = True
left = False
lastMove = "right"
else:
left = False
right = False
animcount = 0
if not (isJump):
if keys[pygame.K_SPACE]:
isJump=True
else:
if jumpcount >= -10:
if jumpcount < 0:
y += (jumpcount ** 2) / 2
else:
y -= (jumpcount ** 2) / 2
jumpcount -= 1
else:
isJump = False
jumpcount = 10
pygame.quit()