dragon_sleep = False
clock = pygame.time.Clock()
def Dragon():
global dragon_count
global x_dragon
global y_dragon
global dragon_sleep
MOVE_DOWN_DELAY = 1000
MOVE_DOWN_EVENT = pygame.USEREVENT + 1 # событие
if dragon_count == 25:
dragon_count = 0
if dragon_sleep == False:
x_dragon += 8
y_dragon -= 1
screen.blit(dragon_anim[dragon_count // 5], (x_dragon, y_dragon))
dragon_count += 1 # увеличиваем
if x_dragon >= 1000 + gragon_size:
x_dragon = -240
y_dragon = 300
dragon_sleep = True
pygame.time.set_timer(MOVE_DOWN_EVENT, MOVE_DOWN_DELAY)
for e in pygame.event.get():
if e.type == MOVE_DOWN_EVENT:
dragon_sleep = False