更改卡片间距

This commit is contained in:
星外之神 2022-04-17 11:22:39 +08:00
parent 124ccc0e15
commit bb6f9a8b10
4 changed files with 5 additions and 3 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 27 KiB

After

Width:  |  Height:  |  Size: 23 KiB

View File

@ -9,7 +9,7 @@ class Map():
self.height = height
# 要把记录信息改成元组的话这里又得改
# 而且不同场地还不一样
self.map = [[0 for x in range(self.width)] for y in range(self.height)]
self.map = [[c.MAP_EMPTY for x in range(self.width)] for y in range(self.height)]
def isValid(self, map_x, map_y):
if (map_x < 0 or map_x >= self.width or
@ -21,13 +21,14 @@ class Map():
def isMovable(self, map_x, map_y):
# 目前没有南瓜头,所以用是否为空判断
# 可将南瓜头新定义一个状态2基于此进一步判断
# 应当改成元组,保存南瓜头、花盆、睡莲等状态
# 应当改成元组,保存南瓜头、花盆、睡莲等状态(字典也可,还更方便)
# 当然,不用元组的话字符串也行,但是得把判断植物写在母函数中,并且需要更多参数
# 这样返回的就是一个具体信息而非bool值了
# 到时候还要改一下变量名还叫isMovable不合适
return (self.map[map_y][map_x] == c.MAP_EMPTY)
def getMapIndex(self, x, y):
# 引入新地图后需要增加这里的内容
x -= c.MAP_OFFSET_X
y -= c.MAP_OFFSET_Y
return (x // c.GRID_X_SIZE, y // c.GRID_Y_SIZE)

View File

@ -6,7 +6,7 @@ from .. import constants as c
PANEL_Y_START = 87
PANEL_X_START = 22
PANEL_Y_INTERNAL = 74
PANEL_Y_INTERNAL = 67
PANEL_X_INTERNAL = 53
# 以后可以增加到10并且增加解锁功能
CARD_LIST_NUM = 8

View File

@ -16,6 +16,7 @@ class Level(tool.State):
self.persist = self.game_info
self.game_info[c.CURRENT_TIME] = current_time
self.map_y_len = c.GRID_Y_LEN
# 可以给map加一个地图类型参数
self.map = map.Map(c.GRID_X_LEN, self.map_y_len)
# 暂停状态