修复爆炸后僵尸黑色不显示

This commit is contained in:
星外之神 2022-04-12 00:15:44 +08:00
parent 9dc66c1b7a
commit 19fc29009d
3 changed files with 10 additions and 3 deletions

View File

@ -8,6 +8,8 @@ class Map():
def __init__(self, width, height):
self.width = width
self.height = height
# 要把记录信息改成元组的话这里又得改
# 而且不同场地还不一样
self.map = [[0 for x in range(self.width)] for y in range(self.height)]
def isValid(self, map_x, map_y):
@ -16,9 +18,13 @@ class Map():
return False
return True
# 判断能否种植
def isMovable(self, map_x, map_y):
# 目前没有南瓜头,所以用是否为空判断
# 可将南瓜头新定义一个状态2基于此进一步判断
# 应当改成元组,保存南瓜头、花盆、睡莲等状态
# 当然,不用元组的话字符串也行,但是得把判断植物写在母函数中,并且需要更多参数
# 这样返回的就是一个具体信息而非bool值了
return (self.map[map_y][map_x] == c.MAP_EMPTY)
def getMapIndex(self, x, y):

View File

@ -67,13 +67,14 @@ INIT_SUN_NAME = 'init_sun_value'
ZOMBIE_LIST = 'zombie_list'
MAP_EMPTY = 0
MAP_EXIST = 1
MAP_COMMON_PLANT = 1
# 只有南瓜头
MAP_PUMPKIN_ONLY = 2
# 有南瓜头和其他植物
MAP_PUMPKIN_WITH = 3
# 可能还需要给咖啡豆定义一个状态,但是这个最好是在种植的时候判断那里是否有睡眠的蘑菇
# 睡莲与花盆更为特殊,可能需要更复杂的定义
# 可能可以用元组或者字符串
BACKGROUND_OFFSET_X = 220
MAP_OFFSET_X = 35

View File

@ -140,7 +140,7 @@ class Level(tool.State):
print('initBowlingMap')
for x in range(3, self.map.width):
for y in range(self.map.height):
self.map.setMapGridType(x, y, c.MAP_EXIST)
self.map.setMapGridType(x, y, c.MAP_COMMON_PLANT)
def initState(self):
# 小游戏才有CHOOSEBAR_TYPE
@ -524,7 +524,7 @@ class Level(tool.State):
self.menubar.deleateCard(self.select_plant)
if self.bar_type != c.CHOSSEBAR_BOWLING:
self.map.setMapGridType(map_x, map_y, c.MAP_EXIST)
self.map.setMapGridType(map_x, map_y, c.MAP_COMMON_PLANT)
self.removeMouseImage()
#print('addPlant map[%d,%d], grid pos[%d, %d] pos[%d, %d]' % (map_x, map_y, x, y, pos[0], pos[1]))