如何用pygame中的定时器来实现飞机的出现,就是每隔一秒出现一个敌机.

import pygame
from random import randint

screen = pygame.display.set_mode((640, 600))
pygame.display.set_caption('可可!!!!!!!!!')
background = pygame.image.load('1111.jpg')
myplane = pygame.image.load('me1.png')
myplaneX = 300
myplaneY = 480
stepX = 0
stepY = 0
clock = pygame.time.Clock()
CREAT_ENEMY_EVENT = pygame.USEREVENT
pygame.time.set_timer(CREAT_ENEMY_EVENT, 1000)

enemy = pygame.image.load("enemy1.png")
number_of_enemies = randint(1, 15)

enemyX = randint(0, 587)
enemyY = 43
enemystep = 0.3


def showenemy():
    global enemystep, enemyY, enemyX

    screen.blit(enemy, (enemyX, enemyY))
    enemyY = enemyY + enemystep


def movemyplane():
    global myplaneX, myplaneY
    myplaneX = myplaneX + stepX
    myplaneY = myplaneY + stepY
    if myplaneY > 520:
        myplaneY = 520
    if myplaneY < 0:
        myplaneY = 0

    if myplaneX > 538:
        myplaneX = 538
    if myplaneX < 0:
        myplaneX = 0


while True:

    screen.blit(background, (0, 0))
    screen.blit(myplane, (myplaneX, myplaneY))
    for event in pygame.event.get():
        if event.type == pygame.QUIT:
            pygame.quit()
        if event.type == CREAT_ENEMY_EVENT:
            CREAT_ENEMY_EVENT=CREAT_ENEMY_EVENT+1
            showenemy()
        if event.type == pygame.KEYDOWN:
            if event.key == pygame.K_RIGHT:
                stepX = 0.5
            elif event.key == pygame.K_LEFT:
                stepX = -0.5
            if event.key == pygame.K_UP:
                stepY = -0.5
            elif event.key == pygame.K_DOWN:
                stepY = 0.5

        if event.type == pygame.KEYUP:
            stepX = 0
            stepY = 0
    movemyplane()
    showenemy()

    pygame.display.update()


Traceback (most recent call last):
  File "D:\python\主程序.py", line 14, in <module>
    pygame.time.set_timer(CREAT_ENEMY_EVENT, 1000)
pygame.error: pygame is not initialized
libpng warning: iCCP: known incorrect sRGB profile