存储项目的大部分函数
This commit is contained in:
parent
207298ec36
commit
82e22c4a7a
|
@ -46,3 +46,16 @@ def check_keyup_events(event, ship):
|
|||
ship.moving_up = False
|
||||
elif event.key == pygame.K_DOWN:
|
||||
ship.moving_down = False
|
||||
def check_events(ai_settings, screen, stats, sb, play_button, ship, aliens, bullets):
|
||||
"""响应按键和鼠标事件"""
|
||||
for event in pygame.event.get():
|
||||
if event.type == pygame.QUIT:
|
||||
sys.exit()
|
||||
elif event.type == pygame.KEYDOWN:
|
||||
check_keydown_events(event, ai_settings, screen, ship, bullets)
|
||||
elif event.type == pygame.KEYUP:
|
||||
check_keyup_events(event, ship)
|
||||
elif event.type == pygame.MOUSEBUTTONDOWN:
|
||||
mouse_x, mouse_y = pygame.mouse.get_pos()
|
||||
|
||||
check_play_button(ai_settings, screen, stats, sb, play_button, ship, aliens, bullets, mouse_x, mouse_y)
|
||||
|
|
Loading…
Reference in New Issue