Compare commits
2 Commits
c26b775c96
...
68042f3cfa
Author | SHA1 | Date |
---|---|---|
|
68042f3cfa | |
|
bb318dc6a0 |
|
@ -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.
Binary file not shown.
Binary file not shown.
1
alien.py
1
alien.py
|
@ -1,3 +1,4 @@
|
|||
# coding: UTF-8
|
||||
# 创建外星人Alien类
|
||||
import pygame
|
||||
from pygame.sprite import Sprite
|
||||
|
|
|
@ -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 # 所有的功能函
|
||||
|
||||
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
# coding: UTF-8
|
||||
# 《外星人入侵》运行的所有函数
|
||||
|
||||
import sys
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
# coding: UTF-8
|
||||
# 创建跟踪游戏统计信息的Game_Stats类
|
||||
|
||||
import json
|
||||
|
|
|
@ -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")
|
|
@ -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)
|
|
@ -1,3 +1,4 @@
|
|||
# coding: UTF-8
|
||||
# 创建Settings设置类---功能对应的设置
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue