进度
完成【墓碑】系统其余部分:
功能a有所修改,墓碑只提供放置僵尸的功能
a.僵尸需要费用才能制造
b.僵尸方想放置僵尸,只能从墓碑处点击,然后生成僵尸
c.墓碑可以被植物攻击,血量为0被摧毁
d.僵尸方可以建造墓碑,但必须右侧有已有墓碑
e.开局每行草坪右侧是免费墓碑
今天实现功能a、d
def insert_lock(self, i, j):
ZBid = GameData['card_data2'][0]
# 选的是墓碑
if ZBid == 0:
if j < 9 and not isinstance(self.all_GRs[i].PLs[j+1], Grave):
print("建墓碑必须确保右侧有墓碑!")
return
if self.all_GRs[i].PLs[j] is not None:
print("该格已有其他对象!")
return
# 选的是僵尸
if ZBid > 0:
if not isinstance(self.all_GRs[i].PLs[j], Grave):
print("只能在墓碑上生产僵尸!")
return
if GameData['card_data2'][ZBid+1]: # 确保充能完成
if GameData['money'] >= ZBs[ZBid].cost: # 确保阳光充足
# x, y = self.topleft
# c_w, c_h = Cell_size
# pos = x+(j+0.5)*c_w, y+(i+0.5)*c_h
# 建墓碑和造僵尸主体
if ZBid == 0:
self.all_GRs[i].buildgv(j)
else:
self.all_ZCs[i].insert(j)
GameData['money'] -= ZBs[ZBid].cost
GameData['card_data2'][ZBid+1] = False
else:
Thread(target=play_music('assets/音乐音效/error_cost.wav')).start()
else:
Thread(target=play_music('assets/音乐音效/error_cold.mp3')).start()