马上注册,结交更多好友,享用更多功能^_^
您需要 登录 才可以下载或查看,没有账号?立即注册
x
代码:import pygame
import os
import sys
import traceback
from pygame.locals import *
pygame.init()
pygame.mixer.init()
bg_size = width, height = 480, 700
screen = pygame.display.set_mode(bg_size)
pygame.display.set_caption("飞机大战—改进版")
# backgroung = pygame.image.load("images/background.png").convert()
backgroung = pygame.image.load(os.path.join('./images/', 'background.png')).convert()
pygame.mixer.music.load("sound/game_music.ogg")
pygame.mixer.music.set_volume(0.2)
bullet_sound = pygame.mixer.Sound("sound/bullet.wav")
bullet_sound.set_volume(0.2)
bomb_sound = pygame.mixer.Sound("sound/use_bomb.wav")
bomb_sound.set_volume(0.2)
supply_sound = pygame.mixer.Sound("sound/supply.wav")
supply_sound.set_volume(0.2)
def main():
pygame.mixer.music.play(-1)
clock = pygame.time.Clock()
running = True
while running:
for event in pygame.event.get():
if event.type == pygame.QUIT:
pygame.quit()
sys.exit()
screen.blit(backgroung, (0, 0))
pygame.display.flip()
clock.tick(60)
if __name__ == '__main__':
main()
弹出的错误:Traceback (most recent call last):
File "F:/python/飞机大战YC/main.py", line 18, in <module>
pygame.mixer.music.load("sound/game_music.ogg")
pygame.error: Failed loading libvorbisfile-3.dll: 找不到指定的模块。
Process finished with exit code 1
和视频上的一样啊,就减少了重复的添加的音乐。很郁闷。。。
|