更新 'game_functions.py'

This commit is contained in:
206530211 2021-06-19 12:24:23 +08:00
parent ea205e8753
commit dc6669ca90
1 changed files with 13 additions and 1 deletions

View File

@ -9,3 +9,15 @@ from alien import Alien
def check_keydown_events(event, ai_settings, screen, ship, bullets):
"""响应按键"""
if event.key == pygame.K_RIGHT:
ship.moving_right = True
elif event.key == pygame.K_LEFT:
ship.moving_left = True
elif event.key == pygame.K_UP:
ship.moving_up = True
elif event.key == pygame.K_DOWN:
ship.moving_down = True
elif event.key == pygame.K_SPACE:
fire_bullet(ai_settings, screen, ship, bullets)
elif event.key == pygame.K_q:
sys.exit()