From 021ed42f7cb1404dca79ba0959f99c3f8e57e215 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=98=9F=E5=A4=96=E4=B9=8B=E7=A5=9E?= Date: Fri, 22 Apr 2022 23:13:19 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=94=B9=E4=B8=8D=E5=8F=AF=E7=A7=8D?= =?UTF-8?q?=E6=A4=8D=E5=8C=BA=E5=9F=9F=E7=9A=84=E8=AE=BE=E5=AE=9A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- source/component/map.py | 4 ++-- source/constants.py | 3 ++- source/state/level.py | 2 +- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/source/component/map.py b/source/component/map.py index ec31160..d2e1d52 100755 --- a/source/component/map.py +++ b/source/component/map.py @@ -115,8 +115,8 @@ class Map(): return (map_x * c.GRID_X_SIZE + c.GRID_X_SIZE//2 + c.MAP_OFFSET_X, map_y * c.GRID_Y_SIZE + c.GRID_Y_SIZE//5 * 3 + c.MAP_OFFSET_Y) - def setMapGridType(self, map_x, map_y, type): - self.map[map_y][map_x] = type + def setMapGridType(self, map_x, map_y, plot_type): + self.map[map_y][map_x] = plot_type def addMapPlant(self, map_x, map_y, plantName, sleep=False): self.map[map_y][map_x][c.MAP_PLANT].add(plantName) diff --git a/source/constants.py b/source/constants.py index abc6ca2..c0da0a7 100755 --- a/source/constants.py +++ b/source/constants.py @@ -105,10 +105,11 @@ MAP_PLOT_TYPE = 'plotType' MAP_GRASS = 'grass' MAP_WATER = 'water' MAP_TILE = 'tile' # 指屋顶上的瓦片 -MAP_DAMAGED = 'damaged' +MAP_UNAVAILABLE = 'unavailable' # 指完全不能种植物的地方,包括无草皮的荒地、毁灭菇坑、冰车留下的冰 MAP_STATE_EMPTY = {MAP_PLANT:set(), MAP_SLEEP:False, MAP_PLOT_TYPE:MAP_GRASS} # 由于同一格显然不可能种两个相同的植物,所以用集合 MAP_STATE_WATER = {MAP_PLANT:set(), MAP_SLEEP:False, MAP_PLOT_TYPE:MAP_WATER} MAP_STATE_TILE = {MAP_PLANT:set(), MAP_SLEEP:False, MAP_PLOT_TYPE:MAP_TILE} +MAP_STATE_UNAVAILABLE = {MAP_PLANT:set(), MAP_SLEEP:False, MAP_PLOT_TYPE:MAP_UNAVAILABLE} # 地图相关像素数据 BACKGROUND_OFFSET_X = 220 diff --git a/source/state/level.py b/source/state/level.py index 266e3e8..b94f360 100644 --- a/source/state/level.py +++ b/source/state/level.py @@ -145,7 +145,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_STATE_TILE) # 将坚果保龄球红线右侧视为屋顶的瓦片以达到不能直接种植植物的效果 + self.map.setMapGridType(x, y, c.MAP_STATE_UNAVAILABLE) # 将坚果保龄球红线右侧设置为不可种植任何植物 def initState(self): # 小游戏才有CHOOSEBAR_TYPE