mercredi 6 février 2019

How to correct Syntax error with my elif, if statement. what am I doing wrong?

import sys

import pygame


def check_events(ship):

    elif event.type == pygame.KEYDOWN:
        if event.key == pygame.K_RIGHT:
            # Move the ship to the right.
            ship.moving_right = True

    elif event.type == pygame.KEYUP:
        if event.key == pygame.K_RIGHT:
            ship.moving_right = False

def update_screen(ai_settings, screen, ship):
    '''Update images on the screen and flip to the new screen.'''

Error:

File "/home/mark/python_work/game_functions.py", line 8
        elif event.type == pygame.KEYDOWN:
           ^
    SyntaxError: invalid syntax
    [Finished in 0.2s with exit code 1]

Aucun commentaire:

Enregistrer un commentaire