Compare commits

...

2 Commits

Author SHA1 Message Date
206530323 68042f3cfa 2021-06-15 21:33:11 +08:00
206530323 bb318dc6a0 2021-06-15 21:32:52 +08:00
20 changed files with 39 additions and 7 deletions

View File

@ -1 +1 @@
0
3600

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -1,3 +1,4 @@
# coding: UTF-8
# 创建外星人Alien类
import pygame
from pygame.sprite import Sprite

View File

@ -1,6 +1,3 @@
# coding: UTF-8
# 项目1外星人入侵
# 系统自带的类或函数
# import sys # 退出游戏----集中在game_functions.py中使用故这注释掉
import pygame # 含有开发游戏所需功能
@ -12,7 +9,7 @@ from ship import Ship # 创建飞船的类
from button import Button # 创建按钮的类
from game_stats import Game_Stats # 创建跟踪游戏统计信息的类
from scoreboard import Scoreboard # 创建得分类
from music import bg_music # 背景音乐
from musics import bg_musics # 背景音乐
import game_functions as gf # 所有的功能函

View File

@ -1,3 +1,4 @@
# coding: UTF-8
# 创建子弹Bullet类
import pygame

View File

@ -1,3 +1,4 @@
# coding: UTF-8
# 创建开启游戏的play按钮
import pygame.font

View File

@ -1,3 +1,4 @@
# coding: UTF-8
# 《外星人入侵》运行的所有函数
import sys

View File

@ -1,3 +1,4 @@
# coding: UTF-8
# 创建跟踪游戏统计信息的Game_Stats类
import json

27
music.py Normal file
View File

@ -0,0 +1,27 @@
# coding: UTF-8
# 关于游戏中各种声音效果的模块
import pygame
def voice_large():
# 外星人到达了屏幕底部或者撞到飞船的大爆炸声
explosion_large = pygame.mixer.Sound("musics/Explo_Large.wav")
explosion_large.play()
def voice_small():
# 增加子弹和外星人碰撞的小爆炸声
explosion_small = pygame.mixer.Sound("musics/Explo_Small.wav")
explosion_small.play()
def bullet_biu():
# 增加子弹射出的biu声
bullet_whiz = pygame.mixer.Sound("musics/Bullet_biu.wav")
bullet_whiz.play()
def bg_music():
# 游戏背景音乐(若游戏开始就一直播放)
pygame.mixer.music.load("musics/order_music.mp3")

View File

@ -1,3 +1,4 @@
# # coding: UTF-8
# # 创建得分Score类
import pygame
@ -44,6 +45,7 @@ class Scoreboard():
self.score_image_rect = self.score_image.get_rect()
self.score_image_rect.right = self.screen_rect.right - 20
self.score_image_rect.top = 20
def prep_high_score(self):
"""将最高得分转换为一幅渲染的图像"""
high_round_score = round(self.game_stats.high_score, -1) # 使得分为10的倍数 -1----10的倍数 -2--100的倍数 -3--1000的倍数
@ -82,5 +84,4 @@ class Scoreboard():
self.screen.blit(self.high_score_image, self.high_score_image_rect)
self.screen.blit(self.level_image, self.level_image_rect)
# 绘制飞船
self.ships.draw(self.screen)
self.ships.draw(self.screen)

View File

@ -1,3 +1,4 @@
# coding: UTF-8
# 创建Settings设置类---功能对应的设置

View File

@ -1,3 +1,4 @@
# coding: UTF-8
# 创建飞船Ship类
import pygame