修改音效播放设定,修改刷新设定,加入报纸僵尸暴走音效,优化游戏速度倍率设定
This commit is contained in:
parent
1e28521f66
commit
39a98e3848
@ -5,7 +5,8 @@
|
||||
"spawn_zombies":"list",
|
||||
"zombie_list":[
|
||||
{"time":0, "map_y":4, "name":"ScreenDoorZombie"},
|
||||
{"time":0, "map_y":1, "name":"NewspaperZombie"},
|
||||
{"time":0, "map_y":2, "name":"ConeheadDuckyTubeZombie"},
|
||||
{"time":60000, "map_y":2, "name":"Zombie"}
|
||||
{"time":80000, "map_y":2, "name":"ConeheadDuckyTubeZombie"}
|
||||
]
|
||||
}
|
||||
BIN
resources/sound/newspaperZombieAngry.ogg
Normal file
BIN
resources/sound/newspaperZombieAngry.ogg
Normal file
Binary file not shown.
@ -361,6 +361,8 @@ class Panel():
|
||||
if delete_card:
|
||||
self.selected_cards.remove(delete_card)
|
||||
self.selected_num -= 1
|
||||
# 播放点击音效
|
||||
pg.mixer.Sound(os.path.join(os.path.dirname(os.path.dirname(os.path.dirname(__file__))) ,"resources", "sound", "tap.ogg")).play()
|
||||
|
||||
if self.selected_num >= c.CARD_MAX_NUM:
|
||||
return
|
||||
@ -369,6 +371,8 @@ class Panel():
|
||||
if card.checkMouseClick(mouse_pos):
|
||||
if card.canSelect():
|
||||
self.addCard(card)
|
||||
# 播放点击音效
|
||||
pg.mixer.Sound(os.path.join(os.path.dirname(os.path.dirname(os.path.dirname(__file__))) ,"resources", "sound", "tap.ogg")).play()
|
||||
break
|
||||
|
||||
def addCard(self, card):
|
||||
|
||||
@ -141,7 +141,8 @@ class StarBullet(Bullet):
|
||||
self.rect.x += 7
|
||||
self.rect.y += 7
|
||||
elif self.direction == c.STAR_UPWARD:
|
||||
self.rect.y -= 10
|
||||
# 实际上不知道为什么向上飞的看起来要快一些,所以拟合的时候把速度调小了一点
|
||||
self.rect.y -= 9
|
||||
elif self.direction == c.STAR_DOWNWARD:
|
||||
self.rect.y += 10
|
||||
else:
|
||||
@ -412,7 +413,7 @@ class SnowPeaShooter(Plant):
|
||||
# 播放发射音效
|
||||
pg.mixer.Sound(os.path.join(os.path.dirname(os.path.dirname(os.path.dirname(__file__))) ,"resources", "sound", "shoot.ogg")).play()
|
||||
# 播放冰子弹音效
|
||||
pg.mixer.Sound(os.path.join(os.path.dirname(os.path.dirname(os.path.dirname(__file__))) ,"resources", "sound", "snowPeaSparkles")).play()
|
||||
pg.mixer.Sound(os.path.join(os.path.dirname(os.path.dirname(os.path.dirname(__file__))) ,"resources", "sound", "snowPeaSparkles.ogg")).play()
|
||||
|
||||
|
||||
class WallNut(Plant):
|
||||
@ -1150,10 +1151,12 @@ class StarFruit(Plant):
|
||||
if (self.rect.x >= zombie.rect.x) and (self.map_y == zombieMapY): # 对于同行且在杨桃后的僵尸
|
||||
return True
|
||||
# 斜向上,理想直线方程为:f(zombie.rect.x) = -0.75*(zombie.rect.x - (self.rect.right - 5)) + self.rect.y - 10
|
||||
elif -100 <= (zombie.rect.y - (-0.75*(zombie.rect.x - (self.rect.right - 5)) + self.rect.y - 10)) <= 70 and (zombie.rect.left <= c.SCREEN_WIDTH):
|
||||
# 注意实际上为射线
|
||||
elif -100 <= (zombie.rect.y - (-0.75*(zombie.rect.x - (self.rect.right - 5)) + self.rect.y - 10)) <= 70 and (zombie.rect.left <= c.SCREEN_WIDTH) and (zombie.rect.x >= self.rect.x):
|
||||
return True
|
||||
# 斜向下,理想直线方程为:f(zombie.rect.x) = zombie.rect.x + self.rect.y - self.rect.right - 15
|
||||
elif abs(zombie.rect.y - (zombie.rect.x + self.rect.y - self.rect.right - 15)) <= 70 and (zombie.rect.left <= c.SCREEN_WIDTH):
|
||||
# 注意实际上为射线
|
||||
elif abs(zombie.rect.y - (zombie.rect.x + self.rect.y - self.rect.right - 15)) <= 70 and (zombie.rect.left <= c.SCREEN_WIDTH) and (zombie.rect.x >= self.rect.x):
|
||||
return True
|
||||
elif zombie.rect.left <= self.rect.x <= zombie.rect.right:
|
||||
return True
|
||||
|
||||
@ -105,7 +105,7 @@ class Zombie(pg.sprite.Sprite):
|
||||
# 在右侧岸左
|
||||
if self.rect.right <= c.MAP_POOL_FRONT_X:
|
||||
# 在左侧岸右,左侧岸位置为预估
|
||||
if self.rect.x >= c.MAP_POOL_OFFSET_X:
|
||||
if self.rect.right - 25 >= c.MAP_POOL_OFFSET_X:
|
||||
# 还未进入游泳状态
|
||||
if not self.swimming:
|
||||
self.swimming = True
|
||||
@ -183,6 +183,8 @@ class Zombie(pg.sprite.Sprite):
|
||||
self.helmetType2 = False
|
||||
if self.name == c.NEWSPAPER_ZOMBIE:
|
||||
self.speed = 2.5
|
||||
# 触发报纸僵尸暴走音效
|
||||
pg.mixer.Sound(os.path.join(os.path.dirname(os.path.dirname(os.path.dirname(__file__))) ,"resources", "sound", "newspaperZombieAngry.ogg")).play()
|
||||
if (self.current_time - self.walk_timer) > (c.ZOMBIE_WALK_INTERVAL * self.getTimeRatio()):
|
||||
self.walk_timer = self.current_time
|
||||
if self.is_hypno:
|
||||
|
||||
@ -288,8 +288,6 @@ class Level(tool.State):
|
||||
self.panel.checkCardClick(mouse_pos)
|
||||
if self.panel.checkStartButtonClick(mouse_pos):
|
||||
self.initPlay(self.panel.getSelectedCards())
|
||||
# 播放点击音效
|
||||
pg.mixer.Sound(os.path.join(os.path.dirname(os.path.dirname(os.path.dirname(__file__))) ,"resources", "sound", "tap.ogg")).play()
|
||||
|
||||
def initPlay(self, card_list):
|
||||
|
||||
|
||||
@ -34,7 +34,7 @@ class Control():
|
||||
self.screen = pg.display.get_surface()
|
||||
self.done = False
|
||||
self.clock = pg.time.Clock() # 创建一个对象来帮助跟踪时间
|
||||
self.fps = 30
|
||||
self.fps = 50 * c.GAME_RATE
|
||||
self.keys = pg.key.get_pressed()
|
||||
self.mouse_pos = None
|
||||
self.mouse_click = [False, False] # value:[left mouse click, right mouse click]
|
||||
@ -89,7 +89,7 @@ class Control():
|
||||
elif event.type == pg.MOUSEBUTTONDOWN:
|
||||
self.mouse_pos = pg.mouse.get_pos()
|
||||
self.mouse_click[0], _, self.mouse_click[1] = pg.mouse.get_pressed()
|
||||
print('pos:', self.mouse_pos, ' mouse:', self.mouse_click)
|
||||
print('pos:', self.mouse_pos)
|
||||
|
||||
|
||||
def run(self):
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user