diff --git a/resources/graphics/Cards/card_sunshroom.png b/resources/graphics/Cards/card_sunshroom.png new file mode 100644 index 0000000..d869b38 Binary files /dev/null and b/resources/graphics/Cards/card_sunshroom.png differ diff --git a/resources/graphics/Plants/SunShroom/SunShroom/SunShroom_0.png b/resources/graphics/Plants/SunShroom/SunShroom/SunShroom_0.png new file mode 100644 index 0000000..fe25d94 Binary files /dev/null and b/resources/graphics/Plants/SunShroom/SunShroom/SunShroom_0.png differ diff --git a/resources/graphics/Plants/SunShroom/SunShroom/SunShroom_1.png b/resources/graphics/Plants/SunShroom/SunShroom/SunShroom_1.png new file mode 100644 index 0000000..28fb904 Binary files /dev/null and b/resources/graphics/Plants/SunShroom/SunShroom/SunShroom_1.png differ diff --git a/resources/graphics/Plants/SunShroom/SunShroom/SunShroom_2.png b/resources/graphics/Plants/SunShroom/SunShroom/SunShroom_2.png new file mode 100644 index 0000000..f6fbc61 Binary files /dev/null and b/resources/graphics/Plants/SunShroom/SunShroom/SunShroom_2.png differ diff --git a/resources/graphics/Plants/SunShroom/SunShroom/SunShroom_3.png b/resources/graphics/Plants/SunShroom/SunShroom/SunShroom_3.png new file mode 100644 index 0000000..0245c04 Binary files /dev/null and b/resources/graphics/Plants/SunShroom/SunShroom/SunShroom_3.png differ diff --git a/resources/graphics/Plants/SunShroom/SunShroom/SunShroom_4.png b/resources/graphics/Plants/SunShroom/SunShroom/SunShroom_4.png new file mode 100644 index 0000000..28f49f7 Binary files /dev/null and b/resources/graphics/Plants/SunShroom/SunShroom/SunShroom_4.png differ diff --git a/resources/graphics/Plants/SunShroom/SunShroom/SunShroom_5.png b/resources/graphics/Plants/SunShroom/SunShroom/SunShroom_5.png new file mode 100644 index 0000000..4eaca99 Binary files /dev/null and b/resources/graphics/Plants/SunShroom/SunShroom/SunShroom_5.png differ diff --git a/resources/graphics/Plants/SunShroom/SunShroom/SunShroom_6.png b/resources/graphics/Plants/SunShroom/SunShroom/SunShroom_6.png new file mode 100644 index 0000000..818348b Binary files /dev/null and b/resources/graphics/Plants/SunShroom/SunShroom/SunShroom_6.png differ diff --git a/resources/graphics/Plants/SunShroom/SunShroom/SunShroom_7.png b/resources/graphics/Plants/SunShroom/SunShroom/SunShroom_7.png new file mode 100644 index 0000000..871bc62 Binary files /dev/null and b/resources/graphics/Plants/SunShroom/SunShroom/SunShroom_7.png differ diff --git a/resources/graphics/Plants/SunShroom/SunShroom/SunShroom_8.png b/resources/graphics/Plants/SunShroom/SunShroom/SunShroom_8.png new file mode 100644 index 0000000..dfcea90 Binary files /dev/null and b/resources/graphics/Plants/SunShroom/SunShroom/SunShroom_8.png differ diff --git a/resources/graphics/Plants/SunShroom/SunShroom/SunShroom_9.png b/resources/graphics/Plants/SunShroom/SunShroom/SunShroom_9.png new file mode 100644 index 0000000..be9ba3f Binary files /dev/null and b/resources/graphics/Plants/SunShroom/SunShroom/SunShroom_9.png differ diff --git a/resources/graphics/Plants/SunShroom/SunShroomBig/SunShroomBig_0.png b/resources/graphics/Plants/SunShroom/SunShroomBig/SunShroomBig_0.png new file mode 100644 index 0000000..77cd737 Binary files /dev/null and b/resources/graphics/Plants/SunShroom/SunShroomBig/SunShroomBig_0.png differ diff --git a/resources/graphics/Plants/SunShroom/SunShroomBig/SunShroomBig_1.png b/resources/graphics/Plants/SunShroom/SunShroomBig/SunShroomBig_1.png new file mode 100644 index 0000000..220a0e5 Binary files /dev/null and b/resources/graphics/Plants/SunShroom/SunShroomBig/SunShroomBig_1.png differ diff --git a/resources/graphics/Plants/SunShroom/SunShroomBig/SunShroomBig_2.png b/resources/graphics/Plants/SunShroom/SunShroomBig/SunShroomBig_2.png new file mode 100644 index 0000000..0d57e91 Binary files /dev/null and b/resources/graphics/Plants/SunShroom/SunShroomBig/SunShroomBig_2.png differ diff --git a/resources/graphics/Plants/SunShroom/SunShroomBig/SunShroomBig_3.png b/resources/graphics/Plants/SunShroom/SunShroomBig/SunShroomBig_3.png new file mode 100644 index 0000000..6fbb5e7 Binary files /dev/null and b/resources/graphics/Plants/SunShroom/SunShroomBig/SunShroomBig_3.png differ diff --git a/resources/graphics/Plants/SunShroom/SunShroomBig/SunShroomBig_4.png b/resources/graphics/Plants/SunShroom/SunShroomBig/SunShroomBig_4.png new file mode 100644 index 0000000..948089a Binary files /dev/null and b/resources/graphics/Plants/SunShroom/SunShroomBig/SunShroomBig_4.png differ diff --git a/resources/graphics/Plants/SunShroom/SunShroomBig/SunShroomBig_5.png b/resources/graphics/Plants/SunShroom/SunShroomBig/SunShroomBig_5.png new file mode 100644 index 0000000..b7efcd1 Binary files /dev/null and b/resources/graphics/Plants/SunShroom/SunShroomBig/SunShroomBig_5.png differ diff --git a/resources/graphics/Plants/SunShroom/SunShroomBig/SunShroomBig_6.png b/resources/graphics/Plants/SunShroom/SunShroomBig/SunShroomBig_6.png new file mode 100644 index 0000000..b98ef3b Binary files /dev/null and b/resources/graphics/Plants/SunShroom/SunShroomBig/SunShroomBig_6.png differ diff --git a/resources/graphics/Plants/SunShroom/SunShroomBig/SunShroomBig_7.png b/resources/graphics/Plants/SunShroom/SunShroomBig/SunShroomBig_7.png new file mode 100644 index 0000000..e103723 Binary files /dev/null and b/resources/graphics/Plants/SunShroom/SunShroomBig/SunShroomBig_7.png differ diff --git a/resources/graphics/Plants/SunShroom/SunShroomBig/SunShroomBig_8.png b/resources/graphics/Plants/SunShroom/SunShroomBig/SunShroomBig_8.png new file mode 100644 index 0000000..15acadc Binary files /dev/null and b/resources/graphics/Plants/SunShroom/SunShroomBig/SunShroomBig_8.png differ diff --git a/resources/graphics/Plants/SunShroom/SunShroomBig/SunShroomBig_9.png b/resources/graphics/Plants/SunShroom/SunShroomBig/SunShroomBig_9.png new file mode 100644 index 0000000..40e4e28 Binary files /dev/null and b/resources/graphics/Plants/SunShroom/SunShroomBig/SunShroomBig_9.png differ diff --git a/source/component/menubar.py b/source/component/menubar.py index 1fd3ae1..432ffa9 100644 --- a/source/component/menubar.py +++ b/source/component/menubar.py @@ -13,15 +13,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_JALAPENO, c.CARD_SCAREDYSHROOM] + c.CARD_JALAPENO, c.CARD_SCAREDYSHROOM, c.CARD_SUNSHROOM] 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, - c.JALAPENO, c.SCAREDYSHROOM] -plant_sun_list = [50, 100, 175, 50, 150, 325, 200, 150, 0, 25, 50, 100, 125, 25] + c.JALAPENO, c.SCAREDYSHROOM, c.SUNSHROOM] +plant_sun_list = [50, 100, 175, 50, 150, 325, 200, 150, 0, 25, 50, 100, 125, 25, 25] plant_frozen_time_list = [7500, 7500, 7500, 30000, 50000, 7500, 7500, 7500, 7500, 30000, - 30000, 7500, 50000, 7500] -all_card_list = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13] + 30000, 7500, 50000, 7500, 7500] +all_card_list = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14] def getSunValueImage(sun_value): font = pg.font.SysFont(None, 22) @@ -106,7 +106,7 @@ class Card(): return image def update(self, sun_value, current_time): - if (current_time - self.refresh_timer) >= 500: + if (current_time - self.refresh_timer) >= 250: self.image = self.createShowImage(sun_value, current_time) self.refresh_timer = current_time diff --git a/source/component/plant.py b/source/component/plant.py index 59cd30c..07ec95e 100644 --- a/source/component/plant.py +++ b/source/component/plant.py @@ -210,8 +210,14 @@ class Plant(pg.sprite.Sprite): return self.rect.centerx, self.rect.bottom class Sun(Plant): - def __init__(self, x, y, dest_x, dest_y): - Plant.__init__(self, x, y, c.SUN, 0, None, 0.9) + def __init__(self, x, y, dest_x, dest_y, is_big=True): + if is_big: + scale = 0.9 + self.sun_value = c.SUN_VALUE + else: + scale = 0.6 + self.sun_value = 12 + Plant.__init__(self, x, y, c.SUN, 0, None, scale) self.move_speed = 1 self.dest_x = dest_x self.dest_y = dest_y @@ -672,4 +678,43 @@ class ScaredyShroom(Plant): if (self.current_time - self.shoot_timer) > 2000: self.bullet_group.add(Bullet(self.rect.right, self.rect.y + 40, self.rect.y + 40, c.BULLET_MUSHROOM, c.BULLET_DAMAGE_NORMAL, True)) - self.shoot_timer = self.current_time \ No newline at end of file + self.shoot_timer = self.current_time + +class SunShroom(Plant): + def __init__(self, x, y, sun_group): + Plant.__init__(self, x, y, c.SUNSHROOM, c.PLANT_HEALTH, None) + self.animate_interval = 200 + self.sun_timer = 0 + self.sun_group = sun_group + self.is_big = False + self.change_timer = 0 + + def loadImages(self, name, scale): + self.idle_frames = [] + self.big_frames = [] + + idle_name = name + big_name = name + 'Big' + + frame_list = [self.idle_frames, self.big_frames] + name_list = [idle_name, big_name] + + for i, name in enumerate(name_list): + self.loadFrames(frame_list[i], name, 1, c.WHITE) + + self.frames = self.idle_frames + + def idling(self): + if not self.is_big: + if self.change_timer == 0: + self.change_timer = self.current_time + elif (self.current_time - self.change_timer) > 25000: + self.changeFrames(self.big_frames) + self.is_big = True + + if self.sun_timer == 0: + self.sun_timer = self.current_time - (c.FLOWER_SUN_INTERVAL - 6000) + elif (self.current_time - self.sun_timer) > c.FLOWER_SUN_INTERVAL: + self.sun_group.add(Sun(self.rect.centerx, self.rect.bottom, self.rect.right, + self.rect.bottom + self.rect.h // 2, self.is_big)) + self.sun_timer = self.current_time \ No newline at end of file diff --git a/source/constants.py b/source/constants.py index d268222..2f4f27d 100644 --- a/source/constants.py +++ b/source/constants.py @@ -79,6 +79,7 @@ SQUASH = 'Squash' SPIKEWEED = 'Spikeweed' JALAPENO = 'Jalapeno' SCAREDYSHROOM = 'ScaredyShroom' +SUNSHROOM = 'SunShroom' PLANT_HEALTH = 5 WALLNUT_HEALTH = 30 @@ -107,6 +108,7 @@ CARD_SQUASH = 'card_squash' CARD_SPIKEWEED = 'card_spikeweed' CARD_JALAPENO = 'card_jalapeno' CARD_SCAREDYSHROOM = 'card_scaredyshroom' +CARD_SUNSHROOM = 'card_sunshroom' #BULLET INFO BULLET_PEA = 'PeaNormal' diff --git a/source/state/level.py b/source/state/level.py index 19695d9..2fc9d86 100644 --- a/source/state/level.py +++ b/source/state/level.py @@ -139,7 +139,7 @@ class Level(tool.State): if not self.drag_plant and mouse_pos and mouse_click[0]: for sun in self.sun_group: if sun.checkCollision(mouse_pos[0], mouse_pos[1]): - self.menubar.increaseSunValue(c.SUN_VALUE) + self.menubar.increaseSunValue(sun.sun_value) for car in self.cars: car.update(self.game_info) @@ -206,6 +206,8 @@ class Level(tool.State): self.plant_groups[map_y].add(plant.Jalapeno(x, y)) elif self.plant_name == c.SCAREDYSHROOM: self.plant_groups[map_y].add(plant.ScaredyShroom(x, y, self.bullet_groups[map_y])) + elif self.plant_name == c.SUNSHROOM: + self.plant_groups[map_y].add(plant.SunShroom(x, y, self.sun_group)) self.menubar.decreaseSunValue(self.plant_cost) self.menubar.setCardFrozenTime(self.plant_name) @@ -244,7 +246,7 @@ class Level(tool.State): if (plant_name == c.POTATOMINE or plant_name == c.SQUASH or plant_name == c.SPIKEWEED or plant_name == c.JALAPENO or - plant_name == c.SCAREDYSHROOM): + plant_name == c.SCAREDYSHROOM or plant_name == c.SUNSHROOM): color = c.WHITE else: color = c.BLACK