a(k_+A7J@Po*%
z7XbqRGSRx?P(LD?`=x;5^5x4@M~@yQkx1Zp9t!XU+J=hsI6h59_`74^1OXCRN1#y0
zMu(cvb8(#_p5sQfN5ZnGUAUMVC;!5=&1)bGFNnwj0CVcpsr{EPU!Ky_(?d;74NefE
zlp1MdO2?e0|S80az^$QP8o;>AZb93`?+qP$J-ux_C+vKOM1$KRS
z3lAZcN)tpdUuzJFEq7}P<5b48Gn7Hqq{*16G&h=#;h%dKzyPZ$+@O
z-Me>FSy=@-AYYcnwQSM};&;F3f(Auwv;d;xbZV_phQWlYDl+*Tx36F2&i-G($S^40
z1lmf#O`Dz}47H(@@{b=sPHk{%!06#I7AR6riw^>OUPGNlFpXX
z+ucL=-d%*vCjbTnc5t7}2nH}LBF{(q`I(lMtZ3ow!-tV4H;{aCJqnOuB%YH9C?pP+
znY746kW?mv7zW*4w-`9^EBv?j0w9WQ_XXx7?_G<4F9Ht(8w|jHd^PqHYf&{b5dhyu
zNgNLBOcqQNcX*g$+eMr|{f_Y6CM1TbmqE6TKk?PL!?AQSqu8Q^7lBHnJdaub2#LBS
z7?W#I`3ew0_ZJ8|uMwVaA-vE6BSXmeE5?HZ0jN{(U4*XyDFu+UQKp3;5cuGE2(cU#
zZwdSmxB&1`K$DNx1%a;-@0h1Vs8^o*Iq}>n#G*^!-zd%j2Z2^TK}tmUG-dE9>wncO
Vu}KzD6srIL002ovPDHLkV1gtSLq7lj
literal 0
HcmV?d00001
diff --git a/Images/Other/Reset.png b/Images/Other/Reset.png
new file mode 100644
index 0000000000000000000000000000000000000000..a4ea2b8b960bfdc7b7e2509eff1568dd868caf7a
GIT binary patch
literal 1268
zcmeAS@N?(olHy`uVBq!ia0vp^-awqn!3HE*U&yTiQj#UE5hcO-X(i=}MX3yqDfvmM
z3ZA)%>8U}fi7AzZCsS=07?{;ELn2Bde0{8v^K*7iAWdWaj57fJ{tG
z$}cUkRRX#c;)UD-xUqS~&|m@vn0`fKfxe-h0mw@*g}%P{mFDKcRTq~8r6Sym)!^cg
z%7Rq=pw#00(xPNw#HA^NtSYc_E=o--$uA1Y&(DE{Vn9ZINq%ugeu09sGdR=~G{Q6U
zQu51-HNkp(eXTt6ic1pnl2bihY?Xkf=w)W6SectT8o4>UTDY1!n;IIrIy#z|8(TOV
z7#O;^nz)&pTEg_YEaktaqG>U-FeLh5)Bu3onm-@;_=764S}T}0$4OT%U+-Uxty8)%Z^cmS0-m7)Y4F2(dIj9`+boFyt=akR{
E0RAh)4*&oF
literal 0
HcmV?d00001
diff --git a/Images/Other/fireball.png b/Images/Other/fireball.png
new file mode 100644
index 0000000000000000000000000000000000000000..74348e5b087adc1cf9ba91418eea3e01a4862174
GIT binary patch
literal 575
zcmV-F0>J%=P)Px$`AI}UR9HvF)<5WtVHCje&u<`;{8E6*z!{4WNa1(N&^GU>r8#Yy;#cCgWEZi5h`;-A1#l0m{+GZ*T*1i|La9JJ_0C+;zrLS=_igbd0s+poy`QxO7e_;2Bd!%Zc`x)j
zBDe8$=|C+!psxlDtbb&30t?c0n^f`ik@6i!+ipWnAb#!ZD&dj#1y2yO|+4Z&+3;a2WfC6gYuhX?Dym6^KEyVn~5r`VUMj75F_$@F?>M(@F*6e|=z5
zh1gxJE)|HaC$^tBF;1sffO{#&u%}eu2==9<^Vm9sz-C-36_}GYoAGJ;Y1)8tUSBb_
zDJVCHj;CuB@aRU!l%CeTASV#8&j^u4SW`&PE+t(Ag83MyajrmMJI>_dy9)H`Y)jpk
z&{Ft0cH>zN9^aP=M9vb#qA?fq5HcU|78h`}3%D0kBT!O58$0F#e*jytP9f2IiS7UZ
N002ovPDHLkV1i&P`f30G
literal 0
HcmV?d00001
diff --git a/bullet.py b/bullet.py
index a41264d..ae201ec 100644
--- a/bullet.py
+++ b/bullet.py
@@ -1,5 +1,6 @@
from dinosaur import *
+
class Bullet:
def __init__(self, game_speed, dinosaur):
self.game_speed = game_speed
@@ -10,5 +11,6 @@ class Bullet:
def update(self):
self.rect.x += self.game_speed
- def draw(self,SCREEN):
- SCREEN.blit(self.image, (self.rect.x, self.rect.y))
\ No newline at end of file
+
+ def draw(self, SCREEN):
+ SCREEN.blit(self.image, (self.rect.x, self.rect.y))
diff --git a/cloud.py b/cloud.py
index a6111c8..4402ac6 100644
--- a/cloud.py
+++ b/cloud.py
@@ -1,20 +1,22 @@
-from settings import *
import random
+from settings import *
+
+
class Cloud:
def __init__(self, game_speed):
# 随机设定云的x,y坐标
- self.x = SCREEN_WIDTH + random.randint(200, 500) # 云先出现在游戏画面外,然后飞入
- self.y = random.randint(50, 200) # 云的y坐标,即离上部分区域的距离
- self.image = CLOUD # image 保存云的图片
+ self.x = SCREEN_WIDTH + random.randint(200, 500) # 云先出现在游戏画面外,然后飞入
+ self.y = random.randint(50, 200) # 云的y坐标,即离上部分区域的距离
+ self.image = CLOUD # image 保存云的图片
self.width = self.image.get_width()
self.game_speed = game_speed
def update(self):
self.x -= self.game_speed
- if self.x < -self.width: # 当云从左边出界后又从右边出来
+ if self.x < -self.width: # 当云从左边出界后又从右边出来
self.x = SCREEN_WIDTH + random.randint(200, 500)
self.y = random.randint(50, 200)
def draw(self, SCREEN):
- SCREEN.blit(self.image, (self.x, self.y))
\ No newline at end of file
+ SCREEN.blit(self.image, (self.x, self.y))
diff --git a/dinosaur.py b/dinosaur.py
index 832a10e..8665e46 100644
--- a/dinosaur.py
+++ b/dinosaur.py
@@ -1,11 +1,11 @@
from settings import *
-from bullet import Bullet
+
class Dinosaur:
- X_ori = 80 # 恐龙的初始x坐标
- Y_ori = 310 # 恐龙的初始y坐标
- Y_ori_DUCK = 340 # 恐龙的初始低头y坐标
- ori_vy = 7 # 恐龙的初始跳跃速度
+ X_ori = 80 # 恐龙的初始x坐标
+ Y_ori = 310 # 恐龙的初始y坐标
+ Y_ori_DUCK = 340 # 恐龙的初始低头y坐标
+ ori_vy = 7 # 恐龙的初始跳跃速度
def __init__(self, game_speed):
# 读入setting中恐龙三种状态所属的列表图片
@@ -16,18 +16,17 @@ class Dinosaur:
self.gravity = 9.8
self.hp = 2
-
# 恐龙的三种状态:低头,奔跑,跳跃
- self.status = 1 # 状态机:0表示低头, 1表示奔跑, 2表示跳跃状态, 3表示往左移动, 4表示往右移动
+ self.status = 1 # 状态机:0表示低头, 1表示奔跑, 2表示跳跃状态, 3表示往左移动, 4表示往右移动
self.index = 0
- self.vy = self.ori_vy # 设定初始速度为ori_vy
- self.image = self.run_img[0] # 初始的跑步动作下标为0
- self.dino_rect = self.image.get_rect() # get_rect是获取图像的位置信息以及宽度高度
+ self.vy = self.ori_vy # 设定初始速度为ori_vy
+ self.image = self.run_img[0] # 初始的跑步动作下标为0
+ self.dino_rect = self.image.get_rect() # get_rect是获取图像的位置信息以及宽度高度
self.dino_rect.x = self.X_ori
self.dino_rect.y = self.Y_ori
- def update(self, userInput): # userInput <== 键盘输入
+ def update(self, userInput): # userInput <== 键盘输入
# 三种状态不断切换
if self.status == 0:
self.duck()
@@ -64,9 +63,9 @@ class Dinosaur:
self.image = self.jump_img
if self.status == 2:
# 抛物线公式
- self.dino_rect.y -= self.vy * 4 # 在空中下降,注意y轴是向下的,所以需要是-=
- self.vy -= 0.5 # 加速度为-0.5
- if self.vy < - self.ori_vy: # 恢复初始跳跃速度
+ self.dino_rect.y -= self.vy * 4 # 在空中下降,注意y轴是向下的,所以需要是-=
+ self.vy -= 0.5 # 加速度为-0.5
+ if self.vy < - self.ori_vy: # 恢复初始跳跃速度
self.status = 1
self.vy = self.ori_vy
@@ -75,7 +74,7 @@ class Dinosaur:
SCREEN.blit(self.image, (self.dino_rect.x, self.dino_rect.y))
# 死亡动画
- def draw_death(self,SCREEN):
+ def draw_death(self, SCREEN):
SCREEN.blit(DEAD, (self.dino_rect.x, self.dino_rect.y))
def showHp(self):
@@ -91,4 +90,4 @@ class Dinosaur:
def showDead(self):
font = pygame.font.SysFont(['方正粗黑宋简体', 'microsoftsansserif'], 30)
text = font.render("TAT", True, (0, 0, 0))
- SCREEN.blit(text, (self.dino_rect.x, self.dino_rect.y - 50))
\ No newline at end of file
+ SCREEN.blit(text, (self.dino_rect.x, self.dino_rect.y - 50))
diff --git a/main.py b/main.py
index 0705656..a4e2f56 100644
--- a/main.py
+++ b/main.py
@@ -3,26 +3,27 @@ import sys
import pygame.time
-from settings import *
-from dinosaur import Dinosaur
-from cloud import Cloud
from bullet import Bullet
+from cloud import Cloud
+from dinosaur import Dinosaur
+from settings import *
+pygame.init() # 初始化pygame
+pygame.display.set_caption('谷歌小游戏(小恐龙快跑)') # 设置标题
-pygame.init() # 初始化pygame
-pygame.display.set_caption('谷歌小游戏(小恐龙快跑)') # 设置标题
-class Barrier: # 定义一个障碍物基类, 后面的各个障碍物都是Barrier的子类
+class Barrier: # 定义一个障碍物基类, 后面的各个障碍物都是Barrier的子类
def __init__(self, image, type):
self.image = image
self.type = type
self.rect = self.image[self.type].get_rect()
- self.rect.x = SCREEN_WIDTH # 先把障碍物放到地图的右下角,然后出来
+ self.rect.x = SCREEN_WIDTH # 先把障碍物放到地图的右下角,然后出来
self.game_speed = game_speed
- self.hp = 100 # 血量
+ self.hp = 100 # 血量
+
def update(self):
- self.rect.x -= self.game_speed # x坐标向左移动,即障碍物向左移动
- if self.rect.x < -self.rect.width or self.hp <= 0: # 还需要判断障碍物是否移出了边界,如果越界的话我们要把该障碍物释放掉
+ self.rect.x -= self.game_speed # x坐标向左移动,即障碍物向左移动
+ if self.rect.x < -self.rect.width or self.hp <= 0: # 还需要判断障碍物是否移出了边界,如果越界的话我们要把该障碍物释放掉
barriers.pop()
def draw(self, SCREEN):
@@ -30,7 +31,7 @@ class Barrier: # 定义一个障碍物基类, 后面的各个障碍物都是Ba
# 头顶显示血量
def showHp(self):
- font = pygame.font.SysFont(['方正粗黑宋简体','microsoftsansserif'], 30)
+ font = pygame.font.SysFont(['方正粗黑宋简体', 'microsoftsansserif'], 30)
text = font.render("Hp: " + str(self.hp), True, (0, 0, 0))
SCREEN.blit(text, (self.rect.x, self.rect.y - 20))
@@ -38,19 +39,23 @@ class Barrier: # 定义一个障碍物基类, 后面的各个障碍物都是Ba
font = pygame.font.SysFont(['方正粗黑宋简体', 'microsoftsansserif'], 30)
text = font.render("┗|`O'|┛", True, (0, 0, 0))
SCREEN.blit(text, (self.rect.x, self.rect.y - 70))
+
+
# barriers的子类
class SmallCactus(Barrier):
def __init__(self, image):
- self.type = random.randint(0, 2) #随机生成0-2下标,即随机生成3种小仙人掌中的一个
- super().__init__(image, self.type) # super调用父类对象的方法
+ self.type = random.randint(0, 2) # 随机生成0-2下标,即随机生成3种小仙人掌中的一个
+ super().__init__(image, self.type) # super调用父类对象的方法
self.rect.y = 325
+
class LargeCactus(Barrier):
def __init__(self, image):
self.type = random.randint(0, 2)
super().__init__(image, self.type)
self.rect.y = 300
+
class Bird(Barrier):
def __init__(self, image):
self.type = 0
@@ -65,9 +70,10 @@ class Bird(Barrier):
self.index = 0
SCREEN.blit(self.image[self.index // 5], self.rect)
self.index += 1
- def update(self): # 多态实现鸟的上下移动
+
+ def update(self): # 多态实现鸟的上下移动
self.rect.x -= self.game_speed
- if self.rect.x < -self.rect.width or self.hp <= 0: # 还需要判断障碍物是否移出了边界,如果越界的话我们要把该障碍物释放掉
+ if self.rect.x < -self.rect.width or self.hp <= 0: # 还需要判断障碍物是否移出了边界,如果越界的话我们要把该障碍物释放掉
barriers.pop()
self.rect.y -= self.vy * 3
self.vy -= 0.5
@@ -76,43 +82,44 @@ class Bird(Barrier):
self.vy = -self.vy
elif self.rect.y >= SCREEN_HEIGHT - 250:
self.vy = 10
+
+
def menu(death_cnt):
- global points, max_score# 引入points, max_score全局变量
+ global points, max_score # 引入points, max_score全局变量
run = True
while run:
- SCREEN.fill((255, 255, 255)) # 背景色设置为白色
- font = pygame.font.SysFont('microsoftyahei', 50)# 微软雅黑
-
-
+ SCREEN.fill((255, 255, 255)) # 背景色设置为白色
+ font = pygame.font.SysFont('microsoftyahei', 50) # 微软雅黑
if death_cnt == 0:
text = font.render("按任意键开始", True, (0, 0, 0))
elif death_cnt > 0:
text = font.render("按任意键重新启动", True, (0, 0, 0))
- score = font.render("你的分数: " + str(points), True, (0, 0, 0)) # 分数
+ score = font.render("你的分数: " + str(points), True, (0, 0, 0)) # 分数
if death_cnt == 1:
max_score = points
else:
max_score = max(max_score, points)
- maxScore = font.render("最高分: " + str(max_score), True, (0, 0, 0)) # 最高分
+ maxScore = font.render("最高分: " + str(max_score), True, (0, 0, 0)) # 最高分
scoreRect = score.get_rect()
- scoreRect.center = (SCREEN_WIDTH // 2, SCREEN_HEIGHT // 2 + 50) # 将分数显示在游戏屏幕中间
- SCREEN.blit(GAMEOVER, (SCREEN_WIDTH // 2 - 200, SCREEN_HEIGHT // 2 - 200)) # 显示GAMEOVER图片
- SCREEN.blit(score, scoreRect) # 显示分数
- SCREEN.blit(maxScore, (SCREEN_WIDTH // 2 - 170, SCREEN_HEIGHT // 2 + 70)) # 显示最高分数
+ scoreRect.center = (SCREEN_WIDTH // 2, SCREEN_HEIGHT // 2 + 50) # 将分数显示在游戏屏幕中间
+ SCREEN.blit(GAMEOVER, (SCREEN_WIDTH // 2 - 200, SCREEN_HEIGHT // 2 - 200)) # 显示GAMEOVER图片
+ SCREEN.blit(score, scoreRect) # 显示分数
+ SCREEN.blit(maxScore, (SCREEN_WIDTH // 2 - 170, SCREEN_HEIGHT // 2 + 70)) # 显示最高分数
textRect = text.get_rect()
textRect.center = (SCREEN_WIDTH // 2, SCREEN_HEIGHT // 2)
SCREEN.blit(text, textRect)
- SCREEN.blit(RUNNING[0], (SCREEN_WIDTH // 2 - 50, SCREEN_HEIGHT // 2 - 140)) #把恐龙的图片显示在菜单界面
+ SCREEN.blit(RUNNING[0], (SCREEN_WIDTH // 2 - 50, SCREEN_HEIGHT // 2 - 140)) # 把恐龙的图片显示在菜单界面
# 添加作者信息
- author_font = pygame.font.SysFont('microsoftyahei', 30)# 创建一个字体对象,使用 'microsoftyahei' 字体,字号大小为 30
- author_text = author_font.render("作者: 袁恒", True, (0, 0, 0)) # render 方法的参数依次是:文本内容,是否开启抗锯齿(True 开启),文本颜色(黑色)
+ author_font = pygame.font.SysFont('microsoftyahei', 30) # 创建一个字体对象,使用 'microsoftyahei' 字体,字号大小为 30
+ author_text = author_font.render("作者: 袁恒", True,
+ (0, 0, 0)) # render 方法的参数依次是:文本内容,是否开启抗锯齿(True 开启),文本颜色(黑色)
author_text_rect = author_text.get_rect()
- author_text_rect.center = (SCREEN_WIDTH // 2, SCREEN_HEIGHT // 2 + 150) # 设置文本矩形的中心位置
- SCREEN.blit(author_text, author_text_rect) # 使用 blit 方法将渲染后的文本表面绘制到屏幕上
+ author_text_rect.center = (SCREEN_WIDTH // 2, SCREEN_HEIGHT // 2 + 150) # 设置文本矩形的中心位置
+ SCREEN.blit(author_text, author_text_rect) # 使用 blit 方法将渲染后的文本表面绘制到屏幕上
- pygame.display.update() # 更新画面
+ pygame.display.update() # 更新画面
# 判断各个事件, 开始游戏
for event in pygame.event.get():
if event.type == pygame.QUIT:
@@ -129,7 +136,7 @@ def main():
clock = pygame.time.Clock()
game_speed = 5 # 游戏的速度
- player = Dinosaur(game_speed) # 实例化对象
+ player = Dinosaur(game_speed) # 实例化对象
cloud = Cloud(game_speed)
@@ -137,7 +144,7 @@ def main():
x_ori_bg = 0
y_ori_bg = 380
points = 0
- font = pygame.font.SysFont(['方正粗黑宋简体','microsoftsansserif'], 20) # 分数的字体
+ font = pygame.font.SysFont(['方正粗黑宋简体', 'microsoftsansserif'], 20) # 分数的字体
# 设置障碍物列表
barriers = []
@@ -147,10 +154,10 @@ def main():
def score():
global points, game_speed
points += 1
- if points % 150 == 0: # 分数每过150速度加1,时间越长速度越快
+ if points % 150 == 0: # 分数每过150速度加1,时间越长速度越快
game_speed += 1
- text = font.render("score: " + str(points), True, (0, 0, 0)) # render(内容,是否抗锯齿,字体颜色,字体背景颜色)
+ text = font.render("score: " + str(points), True, (0, 0, 0)) # render(内容,是否抗锯齿,字体颜色,字体背景颜色)
textRect = text.get_rect()
textRect.center = (550, 40)
SCREEN.blit(text, textRect)
@@ -159,27 +166,26 @@ def main():
global x_ori_bg, y_ori_bg
image_width = BG.get_width()
SCREEN.blit(BG, (x_ori_bg, y_ori_bg))
- SCREEN.blit(BG, (image_width + x_ori_bg, y_ori_bg)) # 保证图片连续
- if x_ori_bg <= -image_width: # 越界
+ SCREEN.blit(BG, (image_width + x_ori_bg, y_ori_bg)) # 保证图片连续
+ if x_ori_bg <= -image_width: # 越界
SCREEN.blit(BG, (image_width + x_ori_bg, y_ori_bg))
x_ori_bg = 0
- x_ori_bg -= game_speed # 背景图片每帧往左移game_speed个单位
+ x_ori_bg -= game_speed # 背景图片每帧往左移game_speed个单位
flag_hit = 0 # 标记恐龙是否被击中过
death_cnt = 0 # 记录死亡次数,death_cnt = 0显示开始界面,大于0的就会显示重开界面
last_timestamp = 0 # 记录时钟记录的上一个时刻
- last_timestamp_hit = 0 # 记录恐龙受到伤害时钟记录的上一个时刻
- last_timestamp_barr_hit = 0 # 记录障碍物受到伤害时钟记录的上一个时刻
- flag_barr_hit = 0 # 记录障碍物有没有受得伤害
-
+ last_timestamp_hit = 0 # 记录恐龙受到伤害时钟记录的上一个时刻
+ last_timestamp_barr_hit = 0 # 记录障碍物受到伤害时钟记录的上一个时刻
+ flag_barr_hit = 0 # 记录障碍物有没有受得伤害
while run:
for event in pygame.event.get():
if event.type == pygame.QUIT:
run = False
- SCREEN.fill((255, 255, 255)) # 背景填充为白色
- userInput = pygame.key.get_pressed() # 从键盘读入按键
+ SCREEN.fill((255, 255, 255)) # 背景填充为白色
+ userInput = pygame.key.get_pressed() # 从键盘读入按键
# 3s内显示血量的简单逻辑
@@ -189,9 +195,6 @@ def main():
if pygame.time.get_ticks() - last_timestamp_hit > 3000:
flag_hit = 0
-
-
-
background() # 画出背景
cloud.draw(SCREEN) # 画出云的图像
@@ -211,16 +214,16 @@ def main():
# 随机等可能生成障碍物
if random.randint(0, 2) == 0:
- barriers.append(SmallCactus(SMALL_CACTUS)) # 向列表添加障碍物元素
+ barriers.append(SmallCactus(SMALL_CACTUS)) # 向列表添加障碍物元素
elif random.randint(0, 2) == 1:
barriers.append(LargeCactus(LARGE_CACTUS))
elif random.randint(0, 2) == 2:
barriers.append(Bird(BIRD))
for barrier in barriers:
- barrier.draw(SCREEN) # 调用barrier类的draw函数,渲染画面
+ barrier.draw(SCREEN) # 调用barrier类的draw函数,渲染画面
barrier.update()
- barrier.showHp() # 显示血量
+ barrier.showHp() # 显示血量
if flag_barr_hit == 1:
if barrier.hp < 100 and pygame.time.get_ticks() - last_timestamp_barr_hit <= 3000:
@@ -228,7 +231,7 @@ def main():
if pygame.time.get_ticks() - last_timestamp_barr_hit > 3000:
flag_barr_hit = 0
- if player.dino_rect.colliderect(barrier.rect): # pygame的一个方法colliderect检测两个物体是否碰撞
+ if player.dino_rect.colliderect(barrier.rect): # pygame的一个方法colliderect检测两个物体是否碰撞
last_timestamp_hit = pygame.time.get_ticks()
player.hp -= 1 # 被击中生命值减1
flag_hit = 1
@@ -239,13 +242,13 @@ def main():
player.update(userInput) # 调用dinosaur的update函数每次渲染都判断一次是否按下相应的键位
player.showHp()
- if player.hp == 0: # 血量为0时
+ if player.hp == 0: # 血量为0时
player.showDead()
player.draw_death(SCREEN)
- pygame.display.update() # 显示死亡动画
+ pygame.display.update() # 显示死亡动画
pygame.time.delay(1000)
death_cnt += 1
- menu(death_cnt) # 调出死亡界面
+ menu(death_cnt) # 调出死亡界面
# 子弹击中障碍物部分
for bullet in bullets:
@@ -263,14 +266,15 @@ def main():
points += 50
barriers.remove(barrier)
-
# 发射子弹, 并且保证每个子弹的发射间隔小于200毫秒
- if (userInput[pygame.K_SPACE] and pygame.time.get_ticks() - last_timestamp >= 200) or (userInput[pygame.K_SPACE] and last_timestamp == 0):
- last_timestamp = pygame.time.get_ticks() # 更新当前时间
+ if (userInput[pygame.K_SPACE] and pygame.time.get_ticks() - last_timestamp >= 200) or (
+ userInput[pygame.K_SPACE] and last_timestamp == 0):
+ last_timestamp = pygame.time.get_ticks() # 更新当前时间
bullets.append(Bullet(game_speed, player))
pygame.display.update()
+
if __name__ == '__main__':
- menu(death_cnt = 0)
+ menu(death_cnt=0)
main()
diff --git a/settings.py b/settings.py
index be4602a..90b2c19 100644
--- a/settings.py
+++ b/settings.py
@@ -1,6 +1,7 @@
-import pygame
import os
+import pygame
+
# 设置游戏界面大小,保存每一个类的图像数据
SCREEN_HEIGHT = 600
SCREEN_WIDTH = 1100
@@ -32,4 +33,4 @@ RESET = pygame.image.load(os.path.join("Images/Other", "Reset.png"))
BG = pygame.image.load(os.path.join("Images/Other", "BackGround.png"))
-BULLET = pygame.image.load(os.path.join("Images/Other", "ProjectileSnowPea.png"))
\ No newline at end of file
+BULLET = pygame.image.load(os.path.join("Images/Other", "ProjectileSnowPea.png"))