0
def update(self):
        # Get the current mouse position. This returns the position
        # as a list of two numbers
         pos = pygame.mouse.get_pos()

        # Fetch the x and y out of the list,
        # just like we'd fetch letters out of a string.
        # Set the player object to the mouse location
        self.circ.x=pos[0]
        self.circ.y=pos[1]

パイゲームの初期化

self.circ.x=pos[0] が unident/indentation エラーがあるようです。私は python を初めて使用し、何が問題なのか疑問に思っていましたか?

4

3 に答える 3

2

pos 変数の前に空白があり、それを削除します。

def update(self):
    # Get the current mouse position. This returns the position
    # as a list of two numbers
    pos = pygame.mouse.get_pos()

    # Fetch the x and y out of the list,
    # just like we'd fetch letters out of a string.
    # Set the player object to the mouse location
    self.circ.x=pos[0]
    self.circ.y=pos[1]
于 2013-04-23T10:56:30.530 に答える
1

この線

         pos = pygame.mouse.get_pos()

余分なスペースがあります。それを明確に確認するには、コメントを削除すると役立ちます。

         pos = pygame.mouse.get_pos()
        self.circ.x=pos[0]
        self.circ.y=pos[1]
于 2013-04-23T12:23:17.023 に答える