diff --git a/resources/graphics/Cards/card_jalapeno.png b/resources/graphics/Cards/card_jalapeno.png new file mode 100644 index 0000000..5f9486a Binary files /dev/null and b/resources/graphics/Cards/card_jalapeno.png differ diff --git a/resources/graphics/Plants/Jalapeno/Jalapeno/Jalapeno_0.png b/resources/graphics/Plants/Jalapeno/Jalapeno/Jalapeno_0.png new file mode 100644 index 0000000..1ca68e1 Binary files /dev/null and b/resources/graphics/Plants/Jalapeno/Jalapeno/Jalapeno_0.png differ diff --git a/resources/graphics/Plants/Jalapeno/Jalapeno/Jalapeno_1.png b/resources/graphics/Plants/Jalapeno/Jalapeno/Jalapeno_1.png new file mode 100644 index 0000000..7d3ff8f Binary files /dev/null and b/resources/graphics/Plants/Jalapeno/Jalapeno/Jalapeno_1.png differ diff --git a/resources/graphics/Plants/Jalapeno/Jalapeno/Jalapeno_2.png b/resources/graphics/Plants/Jalapeno/Jalapeno/Jalapeno_2.png new file mode 100644 index 0000000..7bab3fd Binary files /dev/null and b/resources/graphics/Plants/Jalapeno/Jalapeno/Jalapeno_2.png differ diff --git a/resources/graphics/Plants/Jalapeno/Jalapeno/Jalapeno_3.png b/resources/graphics/Plants/Jalapeno/Jalapeno/Jalapeno_3.png new file mode 100644 index 0000000..1ec8d13 Binary files /dev/null and b/resources/graphics/Plants/Jalapeno/Jalapeno/Jalapeno_3.png differ diff --git a/resources/graphics/Plants/Jalapeno/Jalapeno/Jalapeno_4.png b/resources/graphics/Plants/Jalapeno/Jalapeno/Jalapeno_4.png new file mode 100644 index 0000000..9da902b Binary files /dev/null and b/resources/graphics/Plants/Jalapeno/Jalapeno/Jalapeno_4.png differ diff --git a/resources/graphics/Plants/Jalapeno/Jalapeno/Jalapeno_5.png b/resources/graphics/Plants/Jalapeno/Jalapeno/Jalapeno_5.png new file mode 100644 index 0000000..6569ebd Binary files /dev/null and b/resources/graphics/Plants/Jalapeno/Jalapeno/Jalapeno_5.png differ diff --git a/resources/graphics/Plants/Jalapeno/Jalapeno/Jalapeno_6.png b/resources/graphics/Plants/Jalapeno/Jalapeno/Jalapeno_6.png new file mode 100644 index 0000000..92825b9 Binary files /dev/null and b/resources/graphics/Plants/Jalapeno/Jalapeno/Jalapeno_6.png differ diff --git a/resources/graphics/Plants/Jalapeno/Jalapeno/Jalapeno_7.png b/resources/graphics/Plants/Jalapeno/Jalapeno/Jalapeno_7.png new file mode 100644 index 0000000..1c97550 Binary files /dev/null and b/resources/graphics/Plants/Jalapeno/Jalapeno/Jalapeno_7.png differ diff --git a/resources/graphics/Plants/Jalapeno/JalapenoExplode/JalapenoExplode_0.png b/resources/graphics/Plants/Jalapeno/JalapenoExplode/JalapenoExplode_0.png new file mode 100644 index 0000000..519f6aa Binary files /dev/null and b/resources/graphics/Plants/Jalapeno/JalapenoExplode/JalapenoExplode_0.png differ diff --git a/resources/graphics/Plants/Jalapeno/JalapenoExplode/JalapenoExplode_1.png b/resources/graphics/Plants/Jalapeno/JalapenoExplode/JalapenoExplode_1.png new file mode 100644 index 0000000..31388a2 Binary files /dev/null and b/resources/graphics/Plants/Jalapeno/JalapenoExplode/JalapenoExplode_1.png differ diff --git a/resources/graphics/Plants/Jalapeno/JalapenoExplode/JalapenoExplode_2.png b/resources/graphics/Plants/Jalapeno/JalapenoExplode/JalapenoExplode_2.png new file mode 100644 index 0000000..6c94c57 Binary files /dev/null and b/resources/graphics/Plants/Jalapeno/JalapenoExplode/JalapenoExplode_2.png differ diff --git a/resources/graphics/Plants/Jalapeno/JalapenoExplode/JalapenoExplode_3.png b/resources/graphics/Plants/Jalapeno/JalapenoExplode/JalapenoExplode_3.png new file mode 100644 index 0000000..c34e9fd Binary files /dev/null and b/resources/graphics/Plants/Jalapeno/JalapenoExplode/JalapenoExplode_3.png differ diff --git a/resources/graphics/Plants/Jalapeno/JalapenoExplode/JalapenoExplode_4.png b/resources/graphics/Plants/Jalapeno/JalapenoExplode/JalapenoExplode_4.png new file mode 100644 index 0000000..20d21af Binary files /dev/null and b/resources/graphics/Plants/Jalapeno/JalapenoExplode/JalapenoExplode_4.png differ diff --git a/resources/graphics/Plants/Jalapeno/JalapenoExplode/JalapenoExplode_5.png b/resources/graphics/Plants/Jalapeno/JalapenoExplode/JalapenoExplode_5.png new file mode 100644 index 0000000..10308a3 Binary files /dev/null and b/resources/graphics/Plants/Jalapeno/JalapenoExplode/JalapenoExplode_5.png differ diff --git a/resources/graphics/Plants/Jalapeno/JalapenoExplode/JalapenoExplode_6.png b/resources/graphics/Plants/Jalapeno/JalapenoExplode/JalapenoExplode_6.png new file mode 100644 index 0000000..ee8a4eb Binary files /dev/null and b/resources/graphics/Plants/Jalapeno/JalapenoExplode/JalapenoExplode_6.png differ diff --git a/resources/graphics/Plants/Jalapeno/JalapenoExplode/JalapenoExplode_7.png b/resources/graphics/Plants/Jalapeno/JalapenoExplode/JalapenoExplode_7.png new file mode 100644 index 0000000..45701ed Binary files /dev/null and b/resources/graphics/Plants/Jalapeno/JalapenoExplode/JalapenoExplode_7.png differ diff --git a/source/component/menubar.py b/source/component/menubar.py index 4bd74f1..0b36777 100644 --- a/source/component/menubar.py +++ b/source/component/menubar.py @@ -12,13 +12,15 @@ CARD_LIST_NUM = 8 card_name_list = [c.CARD_SUNFLOWER, c.CARD_PEASHOOTER, c.CARD_SNOWPEASHOOTER, c.CARD_WALLNUT, c.CARD_CHERRYBOMB, c.CARD_THREEPEASHOOTER, c.CARD_REPEATERPEA, c.CARD_CHOMPER, - c.CARD_PUFFMUSHROOM, c.CARD_POTATOMINE, c.CARD_SQUASH, c.CARD_SPIKEWEED] + c.CARD_PUFFMUSHROOM, c.CARD_POTATOMINE, c.CARD_SQUASH, c.CARD_SPIKEWEED, + c.CARD_JALAPENO] plant_name_list = [c.SUNFLOWER, c.PEASHOOTER, c.SNOWPEASHOOTER, c.WALLNUT, c.CHERRYBOMB, c.THREEPEASHOOTER, c.REPEATERPEA, c.CHOMPER, - c.PUFFMUSHROOM, c.POTATOMINE, c.SQUASH, c.SPIKEWEED] -plant_sun_list = [50, 100, 175, 50, 150, 325, 200, 150, 0, 25, 50, 100] -plant_frozen_time_list = [0, 5000, 5000, 10000, 5000, 5000, 5000, 5000, 8000, 8000, 8000, 8000] -all_card_list = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11] + c.PUFFMUSHROOM, c.POTATOMINE, c.SQUASH, c.SPIKEWEED, + c.JALAPENO] +plant_sun_list = [50, 100, 175, 50, 150, 325, 200, 150, 0, 25, 50, 100, 125] +plant_frozen_time_list = [0, 5000, 5000, 10000, 5000, 5000, 5000, 5000, 8000, 8000, 8000, 8000, 8000] +all_card_list = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12] def getSunValueImage(sun_value): font = pg.font.SysFont(None, 22) diff --git a/source/component/plant.py b/source/component/plant.py index bec8e23..cc6ffda 100644 --- a/source/component/plant.py +++ b/source/component/plant.py @@ -570,7 +570,6 @@ class Spikeweed(Plant): def loadImages(self, name, scale): self.loadFrames(self.frames, name, 0.9, c.WHITE) - self.select_image = self.frames[0] def setIdle(self): print('spikeweed idle') @@ -594,4 +593,42 @@ class Spikeweed(Plant): self.attack_timer = self.current_time for zombie in self.zombie_group: if self.canAttack(zombie): - zombie.setDamage(1, False) \ No newline at end of file + zombie.setDamage(1, False) + +class Jalapeno(Plant): + def __init__(self, x, y): + Plant.__init__(self, x, y, c.JALAPENO, c.PLANT_HEALTH, None) + self.state = c.ATTACK + self.start_explode = False + self.explode_y_range = 0 + self.explode_x_range = 377 + + def loadImages(self, name, scale): + self.explode_frames = [] + explode_name = name + 'Explode' + self.loadFrames(self.explode_frames, explode_name, 1, c.WHITE) + + self.loadFrames(self.frames, name, 1, c.WHITE) + + def setExplode(self): + self.changeFrames(self.explode_frames) + self.animate_timer = self.current_time + self.rect.x = c.MAP_OFFSET_X + self.start_explode = True + + def animation(self): + if self.start_explode: + if(self.current_time - self.animate_timer) > 100: + self.frame_index += 1 + if self.frame_index >= self.frame_num: + self.health = 0 + return + self.animate_timer = self.current_time + else: + if (self.current_time - self.animate_timer) > 100: + self.frame_index += 1 + if self.frame_index >= self.frame_num: + self.setExplode() + return + self.animate_timer = self.current_time + self.image = self.frames[self.frame_index] \ No newline at end of file diff --git a/source/constants.py b/source/constants.py index b55b9a6..2954a60 100644 --- a/source/constants.py +++ b/source/constants.py @@ -77,6 +77,7 @@ PUFFMUSHROOM = 'PuffMushroom' POTATOMINE = 'PotatoMine' SQUASH = 'Squash' SPIKEWEED = 'Spikeweed' +JALAPENO = 'Jalapeno' PLANT_HEALTH = 5 WALLNUT_HEALTH = 30 @@ -103,6 +104,7 @@ CARD_PUFFMUSHROOM = 'card_puffmushroom' CARD_POTATOMINE = 'card_potatomine' CARD_SQUASH = 'card_squash' CARD_SPIKEWEED = 'card_spikeweed' +CARD_JALAPENO = 'card_jalapeno' #BULLET INFO BULLET_PEA = 'PeaNormal' diff --git a/source/state/level.py b/source/state/level.py index ff810ce..6478056 100644 --- a/source/state/level.py +++ b/source/state/level.py @@ -202,6 +202,8 @@ class Level(tool.State): self.plant_groups[map_y].add(plant.Squash(x, y)) elif self.plant_name == c.SPIKEWEED: self.plant_groups[map_y].add(plant.Spikeweed(x, y)) + elif self.plant_name == c.JALAPENO: + self.plant_groups[map_y].add(plant.Jalapeno(x, y)) self.menubar.decreaseSunValue(self.plant_cost) self.menubar.setCardFrozenTime(self.plant_name) @@ -238,7 +240,8 @@ class Level(tool.State): rect = frame_list[0].get_rect() width, height = rect.w, rect.h - if plant_name == c.POTATOMINE or plant_name == c.SQUASH or plant_name == c.SPIKEWEED: + if (plant_name == c.POTATOMINE or plant_name == c.SQUASH or + plant_name == c.SPIKEWEED or plant_name == c.JALAPENO): color = c.WHITE else: color = c.BLACK @@ -298,7 +301,7 @@ class Level(tool.State): x, y = plant.getPosition() map_x, map_y = self.map.getMapIndex(x, y) self.map.setMapGridType(map_x, map_y, c.MAP_EMPTY) - if (plant.name == c.CHERRYBOMB or + if (plant.name == c.CHERRYBOMB or plant.name == c.JALAPENO or (plant.name == c.POTATOMINE and not plant.is_init)): self.boomZombies(plant.rect.centerx, map_y, plant.explode_y_range, plant.explode_x_range)