Python编程驾驶飞船游戏。

python新手小白,在学《Python编程从入门到实践》

编写‘驾驶飞船’游戏## 主程序 alien_invasion :

import sys
import pygame
import game_functions as gf
from settings import Settings
from ship import Ship
def run_game():
    pygame.init()
    ai_settings = Settings()
    screen = pygame.display.set_mode(
        (ai_settings.screen_width,ai_settings.screen_height))
    ship = Ship(screen)
    pygame.display.set_caption("Alien Invasion")
    while True:
        gf.check_events(ship)
        gf.update_screen(ai_settings,screen,ship)
        pygame.display.flip()
run_game()

调用的game_functions:

import sys
import pygame
def check_events(ship):
    for event in pygame.event.get():
        if event.type == pygame.QUIT:
            sys.exit()
        elif event.type == pygame.KEYDOWM:
            if event.key == pygame.K_RIGHT:
                ship.rect.centerx += 1

def update_screen(ai_settings,screen,ship):
    screen.fill(ai_settings.bg_color)
    ship.blitme()

运行的时候,显示调用的函数有问题,错误代码: AttributeError module ‘pygame’ have no attribute ‘KEYDOWN’,翻来覆去不知道为啥,请路过的大神解答,指点迷津

elif event.type == pygame.KEYDOWM:
改成KEYDOWN