加入高坚果

This commit is contained in:
星外之神 2022-05-07 23:28:15 +08:00
parent 4444ec2fa8
commit 9b020e1b57
51 changed files with 41 additions and 1 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 37 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.0 KiB

View File

@ -81,6 +81,10 @@ plantInfo = (# 元组 (植物名称, 卡片名称, 阳光, 冷却时间)
c.CARD_TORCHWOOD, c.CARD_TORCHWOOD,
175, 175,
7500), 7500),
(c.TALLNUT,
c.CARD_TALLNUT,
125,
30000),
(c.SEASHROOM, (c.SEASHROOM,
c.CARD_SEASHROOM, c.CARD_SEASHROOM,
125, 125,

View File

@ -188,6 +188,8 @@ class Plant(pg.sprite.Sprite):
self.hit_timer = 0 self.hit_timer = 0
# 被铲子指向时间 # 被铲子指向时间
self.highlightTime = 0 self.highlightTime = 0
# 是否能被越过
self.skipable = True
def loadFrames(self, frames, name, scale, color=c.BLACK): def loadFrames(self, frames, name, scale, color=c.BLACK):
frame_list = tool.GFX[name] frame_list = tool.GFX[name]
@ -1223,3 +1225,31 @@ class SeaShroom(Plant):
(self.rect.x + c.GRID_X_SIZE * 3.5 >= zombie.rect.x) and (zombie.rect.left <= c.SCREEN_WIDTH + 10)): (self.rect.x + c.GRID_X_SIZE * 3.5 >= zombie.rect.x) and (zombie.rect.left <= c.SCREEN_WIDTH + 10)):
return True return True
return False return False
class TallNut(Plant):
def __init__(self, x, y):
Plant.__init__(self, x, y, c.TALLNUT, c.TALLNUT_HEALTH, None)
self.load_images()
self.cracked1 = False
self.cracked2 = False
# 高坚果不能被撑杆跳僵尸和海豚骑士僵尸跳过,虽然目前还没有引入撑杆跳僵尸和海豚骑士僵尸
self.skipable = False
def load_images(self):
self.cracked1_frames = []
self.cracked2_frames = []
cracked1_frames_name = self.name + '_cracked1'
cracked2_frames_name = self.name + '_cracked2'
self.loadFrames(self.cracked1_frames, cracked1_frames_name, 1)
self.loadFrames(self.cracked2_frames, cracked2_frames_name, 1)
def idling(self):
if not self.cracked1 and self.health <= c.TALLNUT_CRACKED1_HEALTH:
self.changeFrames(self.cracked1_frames)
self.cracked1 = True
elif not self.cracked2 and self.health <= c.TALLNUT_CRACKED2_HEALTH:
self.changeFrames(self.cracked2_frames)
self.cracked2 = True

View File

@ -205,12 +205,16 @@ TORCHWOOD = 'TorchWood'
STARFRUIT = 'StarFruit' STARFRUIT = 'StarFruit'
COFFEEBEAN = 'CoffeeBean' COFFEEBEAN = 'CoffeeBean'
SEASHROOM = 'SeaShroom' SEASHROOM = 'SeaShroom'
TALLNUT = 'TallNut'
# 植物生命值 # 植物生命值
PLANT_HEALTH = 300 PLANT_HEALTH = 300
WALLNUT_HEALTH = 4000 WALLNUT_HEALTH = 4000
WALLNUT_CRACKED1_HEALTH = WALLNUT_HEALTH//3 * 2 WALLNUT_CRACKED1_HEALTH = WALLNUT_HEALTH//3 * 2
WALLNUT_CRACKED2_HEALTH = WALLNUT_HEALTH//3 WALLNUT_CRACKED2_HEALTH = WALLNUT_HEALTH//3
TALLNUT_HEALTH = 8000
TALLNUT_CRACKED1_HEALTH = TALLNUT_HEALTH//3 * 2
TALLNUT_CRACKED2_HEALTH = TALLNUT_HEALTH//3
# 坚果保龄球攻击伤害 # 坚果保龄球攻击伤害
WALLNUT_BOWLING_DAMAGE = 550 WALLNUT_BOWLING_DAMAGE = 550
@ -249,6 +253,7 @@ CARD_TORCHWOOD = 'card_torchwood'
CARD_STARFRUIT = 'card_starfruit' CARD_STARFRUIT = 'card_starfruit'
CARD_COFFEEBEAN = 'card_coffeebean' CARD_COFFEEBEAN = 'card_coffeebean'
CARD_SEASHROOM = 'card_seashroom' CARD_SEASHROOM = 'card_seashroom'
CARD_TALLNUT = 'card_tallnut'
# 子弹信息 # 子弹信息
# 子弹类型 # 子弹类型

View File

@ -184,6 +184,7 @@ def load_all_gfx(directory, colorkey=c.WHITE, accept=('.png', '.jpg', '.bmp', '.
return graphics return graphics
# 从文件加载矩形碰撞范围 # 从文件加载矩形碰撞范围
# 用于消除文件边框影响
def loadZombieImageRect(): def loadZombieImageRect():
file_path = os.path.join(os.path.dirname(os.path.dirname(__file__)), 'resources', 'data', 'entity', 'zombie.json') file_path = os.path.join(os.path.dirname(os.path.dirname(__file__)), 'resources', 'data', 'entity', 'zombie.json')
f = open(file_path) f = open(file_path)