优化代码结构
This commit is contained in:
parent
3e996c103d
commit
fda640ec30
@ -840,11 +840,12 @@ class Level(tool.State):
|
|||||||
rect = frame_list[0].get_rect()
|
rect = frame_list[0].get_rect()
|
||||||
width, height = rect.w, rect.h
|
width, height = rect.w, rect.h
|
||||||
|
|
||||||
if (plant_name == c.POTATOMINE or plant_name == c.SQUASH or
|
if (plant_name in { c.POTATOMINE, c.SPIKEWEED,
|
||||||
plant_name == c.SPIKEWEED or plant_name == c.JALAPENO or
|
c.JALAPENO, c.SCAREDYSHROOM,
|
||||||
plant_name == c.SCAREDYSHROOM or plant_name == c.SUNSHROOM or
|
c.SUNSHROOM, c.ICESHROOM,
|
||||||
plant_name == c.ICESHROOM or plant_name == c.HYPNOSHROOM or
|
c.HYPNOSHROOM, c.SQUASH,
|
||||||
plant_name == c.WALLNUTBOWLING or plant_name == c.REDWALLNUTBOWLING):
|
c.WALLNUTBOWLING, c.REDWALLNUTBOWLING,
|
||||||
|
}):
|
||||||
color = c.WHITE
|
color = c.WHITE
|
||||||
else:
|
else:
|
||||||
color = c.BLACK
|
color = c.BLACK
|
||||||
@ -997,7 +998,7 @@ class Level(tool.State):
|
|||||||
if not shovel:
|
if not shovel:
|
||||||
# 触发植物死亡音效
|
# 触发植物死亡音效
|
||||||
pg.mixer.Sound(os.path.join(os.path.dirname(os.path.dirname(os.path.dirname(__file__))) ,"resources", "sound", "plantDie.ogg")).play()
|
pg.mixer.Sound(os.path.join(os.path.dirname(os.path.dirname(os.path.dirname(__file__))) ,"resources", "sound", "plantDie.ogg")).play()
|
||||||
if (plant.name == c.CHERRYBOMB or plant.name == c.REDWALLNUTBOWLING):
|
if plant.name in {c.CHERRYBOMB, c.REDWALLNUTBOWLING}:
|
||||||
self.boomZombies(plant.rect.centerx, map_y, plant.explode_y_range,
|
self.boomZombies(plant.rect.centerx, map_y, plant.explode_y_range,
|
||||||
plant.explode_x_range)
|
plant.explode_x_range)
|
||||||
elif plant.name == c.JALAPENO:
|
elif plant.name == c.JALAPENO:
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user