加入海蘑菇
BIN
resources/graphics/Cards/card_seashroom.png
Normal file
|
After Width: | Height: | Size: 33 KiB |
BIN
resources/graphics/Plants/SeaShroom/SeaShroom/SeaShroom_0.png
Normal file
|
After Width: | Height: | Size: 1.4 KiB |
BIN
resources/graphics/Plants/SeaShroom/SeaShroom/SeaShroom_1.png
Normal file
|
After Width: | Height: | Size: 1.3 KiB |
BIN
resources/graphics/Plants/SeaShroom/SeaShroom/SeaShroom_10.png
Normal file
|
After Width: | Height: | Size: 1.2 KiB |
BIN
resources/graphics/Plants/SeaShroom/SeaShroom/SeaShroom_11.png
Normal file
|
After Width: | Height: | Size: 1.2 KiB |
BIN
resources/graphics/Plants/SeaShroom/SeaShroom/SeaShroom_12.png
Normal file
|
After Width: | Height: | Size: 1.2 KiB |
BIN
resources/graphics/Plants/SeaShroom/SeaShroom/SeaShroom_13.png
Normal file
|
After Width: | Height: | Size: 1.2 KiB |
BIN
resources/graphics/Plants/SeaShroom/SeaShroom/SeaShroom_14.png
Normal file
|
After Width: | Height: | Size: 1.3 KiB |
BIN
resources/graphics/Plants/SeaShroom/SeaShroom/SeaShroom_15.png
Normal file
|
After Width: | Height: | Size: 1.3 KiB |
BIN
resources/graphics/Plants/SeaShroom/SeaShroom/SeaShroom_16.png
Normal file
|
After Width: | Height: | Size: 1.3 KiB |
BIN
resources/graphics/Plants/SeaShroom/SeaShroom/SeaShroom_17.png
Normal file
|
After Width: | Height: | Size: 1.3 KiB |
BIN
resources/graphics/Plants/SeaShroom/SeaShroom/SeaShroom_18.png
Normal file
|
After Width: | Height: | Size: 1.3 KiB |
BIN
resources/graphics/Plants/SeaShroom/SeaShroom/SeaShroom_19.png
Normal file
|
After Width: | Height: | Size: 1.3 KiB |
BIN
resources/graphics/Plants/SeaShroom/SeaShroom/SeaShroom_2.png
Normal file
|
After Width: | Height: | Size: 1.3 KiB |
BIN
resources/graphics/Plants/SeaShroom/SeaShroom/SeaShroom_20.png
Normal file
|
After Width: | Height: | Size: 1.3 KiB |
BIN
resources/graphics/Plants/SeaShroom/SeaShroom/SeaShroom_21.png
Normal file
|
After Width: | Height: | Size: 1.3 KiB |
BIN
resources/graphics/Plants/SeaShroom/SeaShroom/SeaShroom_22.png
Normal file
|
After Width: | Height: | Size: 1.3 KiB |
BIN
resources/graphics/Plants/SeaShroom/SeaShroom/SeaShroom_23.png
Normal file
|
After Width: | Height: | Size: 1.3 KiB |
BIN
resources/graphics/Plants/SeaShroom/SeaShroom/SeaShroom_24.png
Normal file
|
After Width: | Height: | Size: 1.3 KiB |
BIN
resources/graphics/Plants/SeaShroom/SeaShroom/SeaShroom_3.png
Normal file
|
After Width: | Height: | Size: 1.3 KiB |
BIN
resources/graphics/Plants/SeaShroom/SeaShroom/SeaShroom_4.png
Normal file
|
After Width: | Height: | Size: 1.3 KiB |
BIN
resources/graphics/Plants/SeaShroom/SeaShroom/SeaShroom_5.png
Normal file
|
After Width: | Height: | Size: 1.3 KiB |
BIN
resources/graphics/Plants/SeaShroom/SeaShroom/SeaShroom_6.png
Normal file
|
After Width: | Height: | Size: 1.3 KiB |
BIN
resources/graphics/Plants/SeaShroom/SeaShroom/SeaShroom_7.png
Normal file
|
After Width: | Height: | Size: 1.2 KiB |
BIN
resources/graphics/Plants/SeaShroom/SeaShroom/SeaShroom_8.png
Normal file
|
After Width: | Height: | Size: 1.2 KiB |
BIN
resources/graphics/Plants/SeaShroom/SeaShroom/SeaShroom_9.png
Normal file
|
After Width: | Height: | Size: 1.2 KiB |
|
After Width: | Height: | Size: 1.4 KiB |
|
After Width: | Height: | Size: 1.4 KiB |
|
After Width: | Height: | Size: 1.5 KiB |
|
After Width: | Height: | Size: 1.4 KiB |
|
After Width: | Height: | Size: 1.4 KiB |
|
After Width: | Height: | Size: 1.4 KiB |
|
After Width: | Height: | Size: 1.4 KiB |
|
After Width: | Height: | Size: 1.4 KiB |
|
After Width: | Height: | Size: 1.4 KiB |
|
After Width: | Height: | Size: 1.4 KiB |
|
After Width: | Height: | Size: 1.5 KiB |
|
After Width: | Height: | Size: 1.5 KiB |
|
After Width: | Height: | Size: 1.4 KiB |
|
After Width: | Height: | Size: 1.5 KiB |
|
After Width: | Height: | Size: 1.5 KiB |
|
After Width: | Height: | Size: 1.4 KiB |
|
After Width: | Height: | Size: 1.4 KiB |
|
After Width: | Height: | Size: 1.4 KiB |
|
After Width: | Height: | Size: 1.4 KiB |
|
After Width: | Height: | Size: 1.4 KiB |
|
After Width: | Height: | Size: 1.5 KiB |
|
After Width: | Height: | Size: 1.5 KiB |
@ -49,7 +49,7 @@ class Map():
|
||||
return False
|
||||
if self.map[map_y][map_x][c.MAP_PLOT_TYPE] == c.MAP_GRASS: # 草地
|
||||
# 首先需要判断植物是否是水生植物,水生植物不能种植在陆地上
|
||||
if plantName not in {c.LILYPAD, '海蘑菇(未实现)', '缠绕水草(未实现)'}: # 这里的集合也可以换成存储在某一文件中的常数的表达
|
||||
if plantName not in {c.LILYPAD, c.SEASHROOM, '缠绕水草(未实现)'}: # 这里的集合也可以换成存储在某一文件中的常数的表达
|
||||
if not self.map[map_y][map_x][c.MAP_PLANT]: # 没有植物肯定可以种植
|
||||
return True
|
||||
elif ((self.map[map_y][map_x][c.MAP_PLANT] | {'花盆(未实现)', '南瓜头(未实现)'} == {'花盆(未实现)', '南瓜头(未实现)'})
|
||||
@ -61,7 +61,7 @@ class Map():
|
||||
return False
|
||||
elif self.map[map_y][map_x][c.MAP_PLOT_TYPE] == c.MAP_TILE: # 屋顶
|
||||
# 首先需要判断植物是否是水生植物,水生植物不能种植在陆地上
|
||||
if plantName not in {c.LILYPAD, '海蘑菇(未实现)', '缠绕水草(未实现)'}: # 这里的集合也可以换成存储在某一文件中的常数的表达
|
||||
if plantName not in {c.LILYPAD, c.SEASHROOM, '缠绕水草(未实现)'}: # 这里的集合也可以换成存储在某一文件中的常数的表达
|
||||
if '花盆(未实现)' in self.map[map_y][map_x][c.MAP_PLANT]:
|
||||
if ((self.map[map_y][map_x][c.MAP_PLANT] | {'花盆(未实现)', '南瓜头(未实现)'} == {'花盆(未实现)', '南瓜头(未实现)'})
|
||||
and (plantName not in self.map[map_y][map_x][c.MAP_PLANT])): # 例外植物:集合中填花盆和南瓜头,只要这里没有这种植物就能种植;判断方法:并集
|
||||
@ -76,7 +76,7 @@ class Map():
|
||||
else:
|
||||
return False
|
||||
elif self.map[map_y][map_x][c.MAP_PLOT_TYPE] == c.MAP_WATER: # 水里
|
||||
if plantName in {c.LILYPAD, '海蘑菇(未实现)', '缠绕水草(未实现)'}: # 是水生植物
|
||||
if plantName in {c.LILYPAD, c.SEASHROOM, '缠绕水草(未实现)'}: # 是水生植物
|
||||
if not self.map[map_y][map_x][c.MAP_PLANT]: # 只有无植物时才能在水里种植水生植物
|
||||
return True
|
||||
else:
|
||||
|
||||
@ -81,6 +81,10 @@ plantInfo = (# 元组 (植物名称, 卡片名称, 阳光, 冷却时间)
|
||||
c.CARD_TORCHWOOD,
|
||||
175,
|
||||
7500),
|
||||
(c.SEASHROOM,
|
||||
c.CARD_SEASHROOM,
|
||||
125,
|
||||
7500),
|
||||
(c.STARFRUIT,
|
||||
c.CARD_STARFRUIT,
|
||||
125,
|
||||
|
||||
@ -1189,4 +1189,37 @@ class CoffeeBean(Plant):
|
||||
plant.changeFrames(plant.idle_frames)
|
||||
self.mapContent[c.MAP_PLANT].remove(self.name)
|
||||
self.kill()
|
||||
|
||||
|
||||
|
||||
class SeaShroom(Plant):
|
||||
def __init__(self, x, y, bullet_group):
|
||||
Plant.__init__(self, x, y, c.SEASHROOM, c.PLANT_HEALTH, bullet_group)
|
||||
self.can_sleep = True
|
||||
self.shoot_timer = 0
|
||||
|
||||
def loadImages(self, name, scale):
|
||||
self.idle_frames = []
|
||||
self.sleep_frames = []
|
||||
|
||||
idle_name = name
|
||||
sleep_name = name + 'Sleep'
|
||||
|
||||
frame_list = [self.idle_frames, self.sleep_frames]
|
||||
name_list = [idle_name, sleep_name]
|
||||
|
||||
for i, name in enumerate(name_list):
|
||||
self.loadFrames(frame_list[i], name, 1)
|
||||
|
||||
self.frames = self.idle_frames
|
||||
|
||||
def attacking(self):
|
||||
if (self.current_time - self.shoot_timer) > 1400:
|
||||
self.bullet_group.add(Bullet(self.rect.right, self.rect.y + 10, self.rect.y + 10,
|
||||
c.BULLET_MUSHROOM, c.BULLET_DAMAGE_NORMAL, effect=False))
|
||||
self.shoot_timer = self.current_time
|
||||
|
||||
def canAttack(self, zombie):
|
||||
if (self.rect.x <= zombie.rect.right and
|
||||
(self.rect.x + c.GRID_X_SIZE * 3.5 >= zombie.rect.x) and (zombie.rect.left <= c.SCREEN_WIDTH + 10)):
|
||||
return True
|
||||
return False
|
||||
@ -204,6 +204,7 @@ LILYPAD = 'LilyPad'
|
||||
TORCHWOOD = 'TorchWood'
|
||||
STARFRUIT = 'StarFruit'
|
||||
COFFEEBEAN = 'CoffeeBean'
|
||||
SEASHROOM = 'SeaShroom'
|
||||
|
||||
# 植物生命值
|
||||
PLANT_HEALTH = 300
|
||||
@ -247,6 +248,7 @@ CARD_LILYPAD = 'card_lilypad'
|
||||
CARD_TORCHWOOD = 'card_torchwood'
|
||||
CARD_STARFRUIT = 'card_starfruit'
|
||||
CARD_COFFEEBEAN = 'card_coffeebean'
|
||||
CARD_SEASHROOM = 'card_seashroom'
|
||||
|
||||
# 子弹信息
|
||||
# 子弹类型
|
||||
|
||||
@ -751,6 +751,8 @@ class Level(tool.State):
|
||||
new_plant = plant.StarFruit(x, y, self.bullet_groups[map_y], self)
|
||||
elif self.plant_name == c.COFFEEBEAN:
|
||||
new_plant = plant.CoffeeBean(x, y, self.plant_groups[map_y], self.map.map[map_y][map_x])
|
||||
elif self.plant_name == c.SEASHROOM:
|
||||
new_plant = plant.SeaShroom(x, y, self.bullet_groups[map_y])
|
||||
|
||||
if new_plant.can_sleep and self.background_type in {c.BACKGROUND_DAY, c.BACKGROUND_POOL, c.BACKGROUND_ROOF, c.BACKGROUND_WALLNUTBOWLING, c.BACKGROUND_SINGLE, c.BACKGROUND_TRIPLE}:
|
||||
new_plant.setSleep()
|
||||
|
||||