diff --git a/resources/graphics/Cards/card_repeaterpea.png b/resources/graphics/Cards/card_repeaterpea.png new file mode 100644 index 0000000..f595c09 Binary files /dev/null and b/resources/graphics/Cards/card_repeaterpea.png differ diff --git a/resources/graphics/Plants/RepeaterPea/RepeaterPea_0.png b/resources/graphics/Plants/RepeaterPea/RepeaterPea_0.png new file mode 100644 index 0000000..c376653 Binary files /dev/null and b/resources/graphics/Plants/RepeaterPea/RepeaterPea_0.png differ diff --git a/resources/graphics/Plants/RepeaterPea/RepeaterPea_1.png b/resources/graphics/Plants/RepeaterPea/RepeaterPea_1.png new file mode 100644 index 0000000..aa8b38a Binary files /dev/null and b/resources/graphics/Plants/RepeaterPea/RepeaterPea_1.png differ diff --git a/resources/graphics/Plants/RepeaterPea/RepeaterPea_10.png b/resources/graphics/Plants/RepeaterPea/RepeaterPea_10.png new file mode 100644 index 0000000..749d9aa Binary files /dev/null and b/resources/graphics/Plants/RepeaterPea/RepeaterPea_10.png differ diff --git a/resources/graphics/Plants/RepeaterPea/RepeaterPea_11.png b/resources/graphics/Plants/RepeaterPea/RepeaterPea_11.png new file mode 100644 index 0000000..752d75f Binary files /dev/null and b/resources/graphics/Plants/RepeaterPea/RepeaterPea_11.png differ diff --git a/resources/graphics/Plants/RepeaterPea/RepeaterPea_12.png b/resources/graphics/Plants/RepeaterPea/RepeaterPea_12.png new file mode 100644 index 0000000..a89d8d8 Binary files /dev/null and b/resources/graphics/Plants/RepeaterPea/RepeaterPea_12.png differ diff --git a/resources/graphics/Plants/RepeaterPea/RepeaterPea_13.png b/resources/graphics/Plants/RepeaterPea/RepeaterPea_13.png new file mode 100644 index 0000000..af71e75 Binary files /dev/null and b/resources/graphics/Plants/RepeaterPea/RepeaterPea_13.png differ diff --git a/resources/graphics/Plants/RepeaterPea/RepeaterPea_14.png b/resources/graphics/Plants/RepeaterPea/RepeaterPea_14.png new file mode 100644 index 0000000..a851368 Binary files /dev/null and b/resources/graphics/Plants/RepeaterPea/RepeaterPea_14.png differ diff --git a/resources/graphics/Plants/RepeaterPea/RepeaterPea_2.png b/resources/graphics/Plants/RepeaterPea/RepeaterPea_2.png new file mode 100644 index 0000000..ef88c16 Binary files /dev/null and b/resources/graphics/Plants/RepeaterPea/RepeaterPea_2.png differ diff --git a/resources/graphics/Plants/RepeaterPea/RepeaterPea_3.png b/resources/graphics/Plants/RepeaterPea/RepeaterPea_3.png new file mode 100644 index 0000000..3389119 Binary files /dev/null and b/resources/graphics/Plants/RepeaterPea/RepeaterPea_3.png differ diff --git a/resources/graphics/Plants/RepeaterPea/RepeaterPea_4.png b/resources/graphics/Plants/RepeaterPea/RepeaterPea_4.png new file mode 100644 index 0000000..59a82d9 Binary files /dev/null and b/resources/graphics/Plants/RepeaterPea/RepeaterPea_4.png differ diff --git a/resources/graphics/Plants/RepeaterPea/RepeaterPea_5.png b/resources/graphics/Plants/RepeaterPea/RepeaterPea_5.png new file mode 100644 index 0000000..80dd8ae Binary files /dev/null and b/resources/graphics/Plants/RepeaterPea/RepeaterPea_5.png differ diff --git a/resources/graphics/Plants/RepeaterPea/RepeaterPea_6.png b/resources/graphics/Plants/RepeaterPea/RepeaterPea_6.png new file mode 100644 index 0000000..319a72f Binary files /dev/null and b/resources/graphics/Plants/RepeaterPea/RepeaterPea_6.png differ diff --git a/resources/graphics/Plants/RepeaterPea/RepeaterPea_7.png b/resources/graphics/Plants/RepeaterPea/RepeaterPea_7.png new file mode 100644 index 0000000..b2dc541 Binary files /dev/null and b/resources/graphics/Plants/RepeaterPea/RepeaterPea_7.png differ diff --git a/resources/graphics/Plants/RepeaterPea/RepeaterPea_8.png b/resources/graphics/Plants/RepeaterPea/RepeaterPea_8.png new file mode 100644 index 0000000..e47a9b7 Binary files /dev/null and b/resources/graphics/Plants/RepeaterPea/RepeaterPea_8.png differ diff --git a/resources/graphics/Plants/RepeaterPea/RepeaterPea_9.png b/resources/graphics/Plants/RepeaterPea/RepeaterPea_9.png new file mode 100644 index 0000000..f247a7b Binary files /dev/null and b/resources/graphics/Plants/RepeaterPea/RepeaterPea_9.png differ diff --git a/source/component/menubar.py b/source/component/menubar.py index d10d746..64a8a92 100644 --- a/source/component/menubar.py +++ b/source/component/menubar.py @@ -4,10 +4,12 @@ import pygame as pg from .. import tool from .. import constants as c -card_name_list = [c.CARD_SUNFLOWER, c.CARD_PEASHOOTER, c.CARD_SNOWPEASHOOTER, c.CARD_WALLNUT, c.CARD_CHERRYBOMB, c.CARD_THREEPEASHOOTER] -plant_name_list = [c.SUNFLOWER, c.PEASHOOTER, c.SNOWPEASHOOTER, c.WALLNUT, c.CHERRYBOMB, c.THREEPEASHOOTER] -plant_sun_list = [50, 100, 175, 50, 150, 325] -card_list = [0, 1, 2, 3, 4, 5] +card_name_list = [c.CARD_SUNFLOWER, c.CARD_PEASHOOTER, c.CARD_SNOWPEASHOOTER, c.CARD_WALLNUT, + c.CARD_CHERRYBOMB, c.CARD_THREEPEASHOOTER, c.CARD_REPEATERPEA] +plant_name_list = [c.SUNFLOWER, c.PEASHOOTER, c.SNOWPEASHOOTER, c.WALLNUT, + c.CHERRYBOMB, c.THREEPEASHOOTER, c.REPEATERPEA] +plant_sun_list = [50, 100, 175, 50, 150, 325, 200] +card_list = [0, 1, 2, 3, 4, 5, 6] class Card(): def __init__(self, x, y, name_index): @@ -77,7 +79,7 @@ class MenuBar(): x = self.card_offset_x y = 7 for index in card_list: - x += 55 + x += 51 self.card_list.append(Card(x, y, index)) def checkCardClick(self, mouse_pos): diff --git a/source/component/plant.py b/source/component/plant.py index 9d2531e..8a3e099 100644 --- a/source/component/plant.py +++ b/source/component/plant.py @@ -14,7 +14,7 @@ class Bullet(pg.sprite.Sprite): self.load_images() self.image = self.frames[self.frame_index] self.rect = self.image.get_rect() - self.rect.x = x - 40 + self.rect.x = x - 50 self.rect.y = start_y self.dest_y = dest_y self.y_vel = 4 if (dest_y > start_y) else -4 @@ -196,6 +196,22 @@ class PeaShooter(Plant): def setAttack(self): self.state = c.ATTACK +class RepeaterPea(Plant): + def __init__(self, x, y, bullet_group): + Plant.__init__(self, x, y, c.REPEATERPEA, c.PLANT_HEALTH, bullet_group) + self.shoot_timer = 0 + + def attacking(self): + if (self.current_time - self.shoot_timer) > 2000: + self.bullet_group.add(Bullet(self.rect.right, self.rect.y, self.rect.y, + c.BULLET_PEA, c.BULLET_DAMAGE_NORMAL, False)) + self.bullet_group.add(Bullet(self.rect.right + 40, self.rect.y, self.rect.y, + c.BULLET_PEA, c.BULLET_DAMAGE_NORMAL, False)) + self.shoot_timer = self.current_time + + def setAttack(self): + self.state = c.ATTACK + class ThreePeaShooter(Plant): def __init__(self, x, y, bullet_groups, map_y): Plant.__init__(self, x, y, c.THREEPEASHOOTER, c.PLANT_HEALTH, None) diff --git a/source/constants.py b/source/constants.py index 5f32bbc..7c689eb 100644 --- a/source/constants.py +++ b/source/constants.py @@ -65,6 +65,7 @@ SNOWPEASHOOTER = 'SnowPea' WALLNUT = 'WallNut' CHERRYBOMB = 'CherryBomb' THREEPEASHOOTER = 'Threepeater' +REPEATERPEA = 'RepeaterPea' CHERRY_BOOM_IMAGE = 'Boom' PLANT_HEALTH = 5 @@ -86,6 +87,7 @@ CARD_SNOWPEASHOOTER = 'card_snowpea' CARD_WALLNUT = 'card_wallnut' CARD_CHERRYBOMB = 'card_cherrybomb' CARD_THREEPEASHOOTER = 'card_threepeashooter' +CARD_REPEATERPEA = 'card_repeaterpea' #BULLET INFO BULLET_PEA = 'PeaNormal' diff --git a/source/state/level.py b/source/state/level.py index f7d41c1..100d603 100644 --- a/source/state/level.py +++ b/source/state/level.py @@ -157,6 +157,8 @@ class Level(tool.State): self.plant_groups[map_y].add(plant.CherryBomb(x, y)) elif self.plant_name == c.THREEPEASHOOTER: self.plant_groups[map_y].add(plant.ThreePeaShooter(x, y, self.bullet_groups, map_y)) + elif self.plant_name == c.REPEATERPEA: + self.plant_groups[map_y].add(plant.RepeaterPea(x, y, self.bullet_groups[map_y])) self.menubar.decreaseSunValue(self.plant_cost) self.map.setMapGridType(map_x, map_y, c.MAP_EXIST)