I’m trying to test a game but every time I try to run it appears "invalid syntax"

Asked

Viewed 45 times

0

import pygame

def main():
    #variaveix
    pygame.init()
    tela = pygame.display.set_mode([300, 300])
    pygame.display.set_caption('THE GAME')
    relogio = pygame.time.Clock()
    branco = (255,255,255)
    azul = (0,255,255)
    verde = (0,255,0)
    sup = pygame.Surface((200,200))
    sup.fill(azul)

    sup2 = pygame.Surface((100,100))
    sup2.fill(verde)

    sair=False

    while sair !=True:
        for event in pygame.event.get():
            if event.type == pygame.QUIT:
                sair = True
            if event.type == pugame.MOUSEMOTION
                sup2 =sup2.move(10, 10)

        relogio.tick(27)
        tela.fill(branco)
        tela.blit(sup,[50,50])
        tela.blit(sup2,[70,70])
        pygame.display.update()
    pygame.quit()   

main()

1 answer

2

That line:

if event.type == pugame.MOUSEMOTION

It was meant to be:

if event.type == pygame.MOUSEMOTION:

That is, you forgot the two-point (:) and wrote pugame instead of pygame.

  • agr aparece line 25, in main sup2 =sup2.move(10, 10) Attributeerror: pygame. Surface' Object has no attribute 'move'

  • @Keddyhecky This is already a different error than what is in the question. You were asking for a syntax error and this has already been solved. As for this new mistake, really, the object Surface has not the method move, After all, a drawing area represents an array of pixels where drawings are made, it makes no sense to move it somewhere. It may make sense to redraw pixels at different positions or change the numbers you use on blit, but moving Surface itself doesn’t make sense.

  • really. _. vlw

  • @Keddyhecky Was that answer the solution to the question problem? If yes, mark it as the answer accepted

Browser other questions tagged

You are not signed in. Login or sign up in order to post.