diff --git a/resources/graphics/Cards/card_tallnut.png b/resources/graphics/Cards/card_tallnut.png new file mode 100644 index 0000000..b91b4c2 Binary files /dev/null and b/resources/graphics/Cards/card_tallnut.png differ diff --git a/resources/graphics/Plants/TallNut/TallNut/TallNut_0.png b/resources/graphics/Plants/TallNut/TallNut/TallNut_0.png new file mode 100644 index 0000000..4e9a143 Binary files /dev/null and b/resources/graphics/Plants/TallNut/TallNut/TallNut_0.png differ diff --git a/resources/graphics/Plants/TallNut/TallNut/TallNut_1.png b/resources/graphics/Plants/TallNut/TallNut/TallNut_1.png new file mode 100644 index 0000000..e4c9d4d Binary files /dev/null and b/resources/graphics/Plants/TallNut/TallNut/TallNut_1.png differ diff --git a/resources/graphics/Plants/TallNut/TallNut/TallNut_10.png b/resources/graphics/Plants/TallNut/TallNut/TallNut_10.png new file mode 100644 index 0000000..945d969 Binary files /dev/null and b/resources/graphics/Plants/TallNut/TallNut/TallNut_10.png differ diff --git a/resources/graphics/Plants/TallNut/TallNut/TallNut_11.png b/resources/graphics/Plants/TallNut/TallNut/TallNut_11.png new file mode 100644 index 0000000..25e4a6a Binary files /dev/null and b/resources/graphics/Plants/TallNut/TallNut/TallNut_11.png differ diff --git a/resources/graphics/Plants/TallNut/TallNut/TallNut_12.png b/resources/graphics/Plants/TallNut/TallNut/TallNut_12.png new file mode 100644 index 0000000..f8ec3fa Binary files /dev/null and b/resources/graphics/Plants/TallNut/TallNut/TallNut_12.png differ diff --git a/resources/graphics/Plants/TallNut/TallNut/TallNut_13.png b/resources/graphics/Plants/TallNut/TallNut/TallNut_13.png new file mode 100644 index 0000000..f407152 Binary files /dev/null and b/resources/graphics/Plants/TallNut/TallNut/TallNut_13.png differ diff --git a/resources/graphics/Plants/TallNut/TallNut/TallNut_2.png b/resources/graphics/Plants/TallNut/TallNut/TallNut_2.png new file mode 100644 index 0000000..47b7c93 Binary files /dev/null and b/resources/graphics/Plants/TallNut/TallNut/TallNut_2.png differ diff --git a/resources/graphics/Plants/TallNut/TallNut/TallNut_3.png b/resources/graphics/Plants/TallNut/TallNut/TallNut_3.png new file mode 100644 index 0000000..478b3f4 Binary files /dev/null and b/resources/graphics/Plants/TallNut/TallNut/TallNut_3.png differ diff --git a/resources/graphics/Plants/TallNut/TallNut/TallNut_4.png b/resources/graphics/Plants/TallNut/TallNut/TallNut_4.png new file mode 100644 index 0000000..9ba2bbd Binary files /dev/null and b/resources/graphics/Plants/TallNut/TallNut/TallNut_4.png differ diff --git a/resources/graphics/Plants/TallNut/TallNut/TallNut_5.png b/resources/graphics/Plants/TallNut/TallNut/TallNut_5.png new file mode 100644 index 0000000..cf1620f Binary files /dev/null and b/resources/graphics/Plants/TallNut/TallNut/TallNut_5.png differ diff --git a/resources/graphics/Plants/TallNut/TallNut/TallNut_6.png b/resources/graphics/Plants/TallNut/TallNut/TallNut_6.png new file mode 100644 index 0000000..4ccd77b Binary files /dev/null and b/resources/graphics/Plants/TallNut/TallNut/TallNut_6.png differ diff --git a/resources/graphics/Plants/TallNut/TallNut/TallNut_7.png b/resources/graphics/Plants/TallNut/TallNut/TallNut_7.png new file mode 100644 index 0000000..8bbb3ee Binary files /dev/null and b/resources/graphics/Plants/TallNut/TallNut/TallNut_7.png differ diff --git a/resources/graphics/Plants/TallNut/TallNut/TallNut_8.png b/resources/graphics/Plants/TallNut/TallNut/TallNut_8.png new file mode 100644 index 0000000..d7c16d8 Binary files /dev/null and b/resources/graphics/Plants/TallNut/TallNut/TallNut_8.png differ diff --git a/resources/graphics/Plants/TallNut/TallNut/TallNut_9.png b/resources/graphics/Plants/TallNut/TallNut/TallNut_9.png new file mode 100644 index 0000000..903dff2 Binary files /dev/null and b/resources/graphics/Plants/TallNut/TallNut/TallNut_9.png differ diff --git a/resources/graphics/Plants/TallNut/TallNut_cracked1/TallNut_cracked1_0.png b/resources/graphics/Plants/TallNut/TallNut_cracked1/TallNut_cracked1_0.png new file mode 100644 index 0000000..0bb61cd Binary files /dev/null and b/resources/graphics/Plants/TallNut/TallNut_cracked1/TallNut_cracked1_0.png differ diff --git a/resources/graphics/Plants/TallNut/TallNut_cracked1/TallNut_cracked1_1.png b/resources/graphics/Plants/TallNut/TallNut_cracked1/TallNut_cracked1_1.png new file mode 100644 index 0000000..d4275c8 Binary files /dev/null and b/resources/graphics/Plants/TallNut/TallNut_cracked1/TallNut_cracked1_1.png differ diff --git a/resources/graphics/Plants/TallNut/TallNut_cracked1/TallNut_cracked1_10.png b/resources/graphics/Plants/TallNut/TallNut_cracked1/TallNut_cracked1_10.png new file mode 100644 index 0000000..86e7a9e Binary files /dev/null and b/resources/graphics/Plants/TallNut/TallNut_cracked1/TallNut_cracked1_10.png differ diff --git a/resources/graphics/Plants/TallNut/TallNut_cracked1/TallNut_cracked1_11.png b/resources/graphics/Plants/TallNut/TallNut_cracked1/TallNut_cracked1_11.png new file mode 100644 index 0000000..86e7a9e Binary files /dev/null and b/resources/graphics/Plants/TallNut/TallNut_cracked1/TallNut_cracked1_11.png differ diff --git a/resources/graphics/Plants/TallNut/TallNut_cracked1/TallNut_cracked1_12.png b/resources/graphics/Plants/TallNut/TallNut_cracked1/TallNut_cracked1_12.png new file mode 100644 index 0000000..caebc74 Binary files /dev/null and b/resources/graphics/Plants/TallNut/TallNut_cracked1/TallNut_cracked1_12.png differ diff --git a/resources/graphics/Plants/TallNut/TallNut_cracked1/TallNut_cracked1_13.png b/resources/graphics/Plants/TallNut/TallNut_cracked1/TallNut_cracked1_13.png new file mode 100644 index 0000000..d1dad0d Binary files /dev/null and b/resources/graphics/Plants/TallNut/TallNut_cracked1/TallNut_cracked1_13.png differ diff --git a/resources/graphics/Plants/TallNut/TallNut_cracked1/TallNut_cracked1_14.png b/resources/graphics/Plants/TallNut/TallNut_cracked1/TallNut_cracked1_14.png new file mode 100644 index 0000000..2c69bbb Binary files /dev/null and b/resources/graphics/Plants/TallNut/TallNut_cracked1/TallNut_cracked1_14.png differ diff --git a/resources/graphics/Plants/TallNut/TallNut_cracked1/TallNut_cracked1_15.png b/resources/graphics/Plants/TallNut/TallNut_cracked1/TallNut_cracked1_15.png new file mode 100644 index 0000000..2c69bbb Binary files /dev/null and b/resources/graphics/Plants/TallNut/TallNut_cracked1/TallNut_cracked1_15.png differ diff --git a/resources/graphics/Plants/TallNut/TallNut_cracked1/TallNut_cracked1_16.png b/resources/graphics/Plants/TallNut/TallNut_cracked1/TallNut_cracked1_16.png new file mode 100644 index 0000000..82b4305 Binary files /dev/null and b/resources/graphics/Plants/TallNut/TallNut_cracked1/TallNut_cracked1_16.png differ diff --git a/resources/graphics/Plants/TallNut/TallNut_cracked1/TallNut_cracked1_2.png b/resources/graphics/Plants/TallNut/TallNut_cracked1/TallNut_cracked1_2.png new file mode 100644 index 0000000..61468ad Binary files /dev/null and b/resources/graphics/Plants/TallNut/TallNut_cracked1/TallNut_cracked1_2.png differ diff --git a/resources/graphics/Plants/TallNut/TallNut_cracked1/TallNut_cracked1_3.png b/resources/graphics/Plants/TallNut/TallNut_cracked1/TallNut_cracked1_3.png new file mode 100644 index 0000000..61468ad Binary files /dev/null and b/resources/graphics/Plants/TallNut/TallNut_cracked1/TallNut_cracked1_3.png differ diff --git a/resources/graphics/Plants/TallNut/TallNut_cracked1/TallNut_cracked1_4.png b/resources/graphics/Plants/TallNut/TallNut_cracked1/TallNut_cracked1_4.png new file mode 100644 index 0000000..c8924c2 Binary files /dev/null and b/resources/graphics/Plants/TallNut/TallNut_cracked1/TallNut_cracked1_4.png differ diff --git a/resources/graphics/Plants/TallNut/TallNut_cracked1/TallNut_cracked1_5.png b/resources/graphics/Plants/TallNut/TallNut_cracked1/TallNut_cracked1_5.png new file mode 100644 index 0000000..ac66f6e Binary files /dev/null and b/resources/graphics/Plants/TallNut/TallNut_cracked1/TallNut_cracked1_5.png differ diff --git a/resources/graphics/Plants/TallNut/TallNut_cracked1/TallNut_cracked1_6.png b/resources/graphics/Plants/TallNut/TallNut_cracked1/TallNut_cracked1_6.png new file mode 100644 index 0000000..5d3b80d Binary files /dev/null and b/resources/graphics/Plants/TallNut/TallNut_cracked1/TallNut_cracked1_6.png differ diff --git a/resources/graphics/Plants/TallNut/TallNut_cracked1/TallNut_cracked1_7.png b/resources/graphics/Plants/TallNut/TallNut_cracked1/TallNut_cracked1_7.png new file mode 100644 index 0000000..5d3b80d Binary files /dev/null and b/resources/graphics/Plants/TallNut/TallNut_cracked1/TallNut_cracked1_7.png differ diff --git a/resources/graphics/Plants/TallNut/TallNut_cracked1/TallNut_cracked1_8.png b/resources/graphics/Plants/TallNut/TallNut_cracked1/TallNut_cracked1_8.png new file mode 100644 index 0000000..d6b31f4 Binary files /dev/null and b/resources/graphics/Plants/TallNut/TallNut_cracked1/TallNut_cracked1_8.png differ diff --git a/resources/graphics/Plants/TallNut/TallNut_cracked1/TallNut_cracked1_9.png b/resources/graphics/Plants/TallNut/TallNut_cracked1/TallNut_cracked1_9.png new file mode 100644 index 0000000..cca13d8 Binary files /dev/null and b/resources/graphics/Plants/TallNut/TallNut_cracked1/TallNut_cracked1_9.png differ diff --git a/resources/graphics/Plants/TallNut/TallNut_cracked2/TallNut_cracked2_0.png b/resources/graphics/Plants/TallNut/TallNut_cracked2/TallNut_cracked2_0.png new file mode 100644 index 0000000..f0b3d67 Binary files /dev/null and b/resources/graphics/Plants/TallNut/TallNut_cracked2/TallNut_cracked2_0.png differ diff --git a/resources/graphics/Plants/TallNut/TallNut_cracked2/TallNut_cracked2_1.png b/resources/graphics/Plants/TallNut/TallNut_cracked2/TallNut_cracked2_1.png new file mode 100644 index 0000000..ad3d34d Binary files /dev/null and b/resources/graphics/Plants/TallNut/TallNut_cracked2/TallNut_cracked2_1.png differ diff --git a/resources/graphics/Plants/TallNut/TallNut_cracked2/TallNut_cracked2_10.png b/resources/graphics/Plants/TallNut/TallNut_cracked2/TallNut_cracked2_10.png new file mode 100644 index 0000000..1108346 Binary files /dev/null and b/resources/graphics/Plants/TallNut/TallNut_cracked2/TallNut_cracked2_10.png differ diff --git a/resources/graphics/Plants/TallNut/TallNut_cracked2/TallNut_cracked2_11.png b/resources/graphics/Plants/TallNut/TallNut_cracked2/TallNut_cracked2_11.png new file mode 100644 index 0000000..1108346 Binary files /dev/null and b/resources/graphics/Plants/TallNut/TallNut_cracked2/TallNut_cracked2_11.png differ diff --git a/resources/graphics/Plants/TallNut/TallNut_cracked2/TallNut_cracked2_12.png b/resources/graphics/Plants/TallNut/TallNut_cracked2/TallNut_cracked2_12.png new file mode 100644 index 0000000..8a407f0 Binary files /dev/null and b/resources/graphics/Plants/TallNut/TallNut_cracked2/TallNut_cracked2_12.png differ diff --git a/resources/graphics/Plants/TallNut/TallNut_cracked2/TallNut_cracked2_13.png b/resources/graphics/Plants/TallNut/TallNut_cracked2/TallNut_cracked2_13.png new file mode 100644 index 0000000..f4d8e63 Binary files /dev/null and b/resources/graphics/Plants/TallNut/TallNut_cracked2/TallNut_cracked2_13.png differ diff --git a/resources/graphics/Plants/TallNut/TallNut_cracked2/TallNut_cracked2_14.png b/resources/graphics/Plants/TallNut/TallNut_cracked2/TallNut_cracked2_14.png new file mode 100644 index 0000000..ebb5aa9 Binary files /dev/null and b/resources/graphics/Plants/TallNut/TallNut_cracked2/TallNut_cracked2_14.png differ diff --git a/resources/graphics/Plants/TallNut/TallNut_cracked2/TallNut_cracked2_2.png b/resources/graphics/Plants/TallNut/TallNut_cracked2/TallNut_cracked2_2.png new file mode 100644 index 0000000..ef73680 Binary files /dev/null and b/resources/graphics/Plants/TallNut/TallNut_cracked2/TallNut_cracked2_2.png differ diff --git a/resources/graphics/Plants/TallNut/TallNut_cracked2/TallNut_cracked2_3.png b/resources/graphics/Plants/TallNut/TallNut_cracked2/TallNut_cracked2_3.png new file mode 100644 index 0000000..ef73680 Binary files /dev/null and b/resources/graphics/Plants/TallNut/TallNut_cracked2/TallNut_cracked2_3.png differ diff --git a/resources/graphics/Plants/TallNut/TallNut_cracked2/TallNut_cracked2_4.png b/resources/graphics/Plants/TallNut/TallNut_cracked2/TallNut_cracked2_4.png new file mode 100644 index 0000000..96eecf8 Binary files /dev/null and b/resources/graphics/Plants/TallNut/TallNut_cracked2/TallNut_cracked2_4.png differ diff --git a/resources/graphics/Plants/TallNut/TallNut_cracked2/TallNut_cracked2_5.png b/resources/graphics/Plants/TallNut/TallNut_cracked2/TallNut_cracked2_5.png new file mode 100644 index 0000000..d1a6f54 Binary files /dev/null and b/resources/graphics/Plants/TallNut/TallNut_cracked2/TallNut_cracked2_5.png differ diff --git a/resources/graphics/Plants/TallNut/TallNut_cracked2/TallNut_cracked2_6.png b/resources/graphics/Plants/TallNut/TallNut_cracked2/TallNut_cracked2_6.png new file mode 100644 index 0000000..ec8a512 Binary files /dev/null and b/resources/graphics/Plants/TallNut/TallNut_cracked2/TallNut_cracked2_6.png differ diff --git a/resources/graphics/Plants/TallNut/TallNut_cracked2/TallNut_cracked2_7.png b/resources/graphics/Plants/TallNut/TallNut_cracked2/TallNut_cracked2_7.png new file mode 100644 index 0000000..ec8a512 Binary files /dev/null and b/resources/graphics/Plants/TallNut/TallNut_cracked2/TallNut_cracked2_7.png differ diff --git a/resources/graphics/Plants/TallNut/TallNut_cracked2/TallNut_cracked2_8.png b/resources/graphics/Plants/TallNut/TallNut_cracked2/TallNut_cracked2_8.png new file mode 100644 index 0000000..229b6d9 Binary files /dev/null and b/resources/graphics/Plants/TallNut/TallNut_cracked2/TallNut_cracked2_8.png differ diff --git a/resources/graphics/Plants/TallNut/TallNut_cracked2/TallNut_cracked2_9.png b/resources/graphics/Plants/TallNut/TallNut_cracked2/TallNut_cracked2_9.png new file mode 100644 index 0000000..816725c Binary files /dev/null and b/resources/graphics/Plants/TallNut/TallNut_cracked2/TallNut_cracked2_9.png differ diff --git a/source/component/menubar.py b/source/component/menubar.py index 8a63d17..0a67ad2 100755 --- a/source/component/menubar.py +++ b/source/component/menubar.py @@ -81,6 +81,10 @@ plantInfo = (# 元组 (植物名称, 卡片名称, 阳光, 冷却时间) c.CARD_TORCHWOOD, 175, 7500), + (c.TALLNUT, + c.CARD_TALLNUT, + 125, + 30000), (c.SEASHROOM, c.CARD_SEASHROOM, 125, diff --git a/source/component/plant.py b/source/component/plant.py index 90061de..9f6751c 100755 --- a/source/component/plant.py +++ b/source/component/plant.py @@ -188,6 +188,8 @@ class Plant(pg.sprite.Sprite): self.hit_timer = 0 # 被铲子指向时间 self.highlightTime = 0 + # 是否能被越过 + self.skipable = True def loadFrames(self, frames, name, scale, color=c.BLACK): frame_list = tool.GFX[name] @@ -1222,4 +1224,32 @@ class SeaShroom(Plant): if (self.rect.x <= zombie.rect.right and (self.rect.x + c.GRID_X_SIZE * 3.5 >= zombie.rect.x) and (zombie.rect.left <= c.SCREEN_WIDTH + 10)): return True - return False \ No newline at end of file + 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 \ No newline at end of file diff --git a/source/constants.py b/source/constants.py index b746c63..3edadc6 100755 --- a/source/constants.py +++ b/source/constants.py @@ -205,12 +205,16 @@ TORCHWOOD = 'TorchWood' STARFRUIT = 'StarFruit' COFFEEBEAN = 'CoffeeBean' SEASHROOM = 'SeaShroom' +TALLNUT = 'TallNut' # 植物生命值 PLANT_HEALTH = 300 WALLNUT_HEALTH = 4000 WALLNUT_CRACKED1_HEALTH = WALLNUT_HEALTH//3 * 2 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 @@ -249,6 +253,7 @@ CARD_TORCHWOOD = 'card_torchwood' CARD_STARFRUIT = 'card_starfruit' CARD_COFFEEBEAN = 'card_coffeebean' CARD_SEASHROOM = 'card_seashroom' +CARD_TALLNUT = 'card_tallnut' # 子弹信息 # 子弹类型 diff --git a/source/tool.py b/source/tool.py index 43170c2..7aa98a4 100755 --- a/source/tool.py +++ b/source/tool.py @@ -184,6 +184,7 @@ def load_all_gfx(directory, colorkey=c.WHITE, accept=('.png', '.jpg', '.bmp', '. return graphics # 从文件加载矩形碰撞范围 +# 用于消除文件边框影响 def loadZombieImageRect(): file_path = os.path.join(os.path.dirname(os.path.dirname(__file__)), 'resources', 'data', 'entity', 'zombie.json') f = open(file_path)