为什么我在pygame.draw中有无效的语法?

问题描述

import pygame
from settings import *
from player import Player
import math
from map import *

pygame.init()
sc = pygame.display.set_mode((WIDTH,HEIGHT))
clock = pygame.time.Clock()
player = Player()
while True:
    for event in pygame.event.get():
        if event.type == pygame.QUIT:
            exit()

    player.movement()
    sc.fill(BLACK)

    pygame.draw.circle(sc,GREEN,(int(player.x),(int(player.y)),12 )
    pygame.draw.line(sc,player.pos,(player.x + WIDTH * math.cos(player.angle),player.y + WIDTH * math.sin(player.angle)))
    for x,y in world_map:
        pygame.draw.rect(sc,DARKGRAY,(x,y,TILE,TILE),2)
    pygame.display.flip()
    clock.tick(FPS)

  File "C:/Users/ASUS/AppData/Roaming/JetBrains/PyCharmCE2020.2/scratches/game3d.py",line 20
    pygame.draw.line(sc,^
SyntaxError: invalid Syntax

enter image description here

解决方法

第19行上有一个多余的括号

pygame.draw.circle(sc,GREEN,(int(player.x),(int(player.y)),12 )

应该是

pygame.draw.circle(sc,int(player.y)),12 )