更新 'Alien_Invasion.py'
This commit is contained in:
parent
ca3f7b3f5f
commit
9cfba84dcb
|
@ -26,7 +26,6 @@ class AlienInvasion: # 管理游戏资源和行为的类11
|
|||
if event.type == pygame.QUIT:
|
||||
sys.exit()
|
||||
|
||||
|
||||
elif event.type == pygame.KEYDOWN:
|
||||
if event.key == pygame.K_RIGHT:
|
||||
self.ship.moving_right = True
|
||||
|
@ -40,6 +39,12 @@ class AlienInvasion: # 管理游戏资源和行为的类11
|
|||
self.ship.moving_left = False
|
||||
|
||||
|
||||
|
||||
# 背景音乐
|
||||
pygame.mixer.music.load('music/Synth_Element.ogg')
|
||||
pygame.mixer.music.play(-1) # 重复循环
|
||||
|
||||
|
||||
def _update_screen(self):
|
||||
self.screen.fill(self.settings.bg_color) # 每次循环时都重绘屏幕
|
||||
self.ship.blitme()
|
||||
|
|
Loading…
Reference in New Issue