飞机大战游戏
一、主函数部分 1 import pygame 2 import sys 3 import traceback 4 from pygame.locals import * 5 import myplane 6 import enemy 7 import bullet 8 import supply 9 import random 10 11 pygame.init() 12 bg_size = width, height = 400, 700 13 screen = pygame.display.set_mode(bg_size) 14 pygame.display.set_caption("飞机大战") 15 16 background = pygame.image.load("images/background.png").convert() 17 18 BLACK = (0,0,0) 19 GREEN = (0, 255, 0) 20 RED = (255, 0, 0) 21 WHITE = (255,255,255) 22 23 #载入游戏音乐 24 pygame.mixer.music.load("sound/game_music.ogg") 25 pygame.mixer.music.set_volume(0.2) 26 bullet_sound = pygame