我从pygame编程开始,我已经看到向量是有用的x和y变量。
问题是我甚至不能定义一个向量,因为pycharm抛出了以下代码:

这是脚本的主体:
import pygame as pg
class Character(pg.sprite.Sprite):
def __init__(self, ai_game):
pg.sprite.Sprite.__init__(self)
# Game
self.screen = ai_game.screen
self.screen_rect = self.screen.get_rect()
self.settings = ai_game.settings
'Initialize position'
self.rect.midbottom = self.screen_rect.midbottom
self.pos = pg.math.Vector2(1, 2)Pycharm抛出`“意外参数”和以下检查描述:
"Reports discrepancies between declared parameters and actual arguments, as well as incorrect arguments.我已经寻找了几个小时的解决方案,但我不能简单地让它工作。最令人沮丧的是,我看到他们定义向量的方式和我尝试的一样,而且看起来很简单。
发布于 2021-01-01 16:44:32
您的代码中没有错误。pygame.math.Vector2可以由单个参数构造,该参数是两个坐标的元组或两个单独的参数。实际上,您在IDE中发现了一个bug。
https://stackoverflow.com/questions/62735936
复制相似问题