add plant sunshroom
BIN
resources/graphics/Cards/card_sunshroom.png
Normal file
|
After Width: | Height: | Size: 13 KiB |
BIN
resources/graphics/Plants/SunShroom/SunShroom/SunShroom_0.png
Normal file
|
After Width: | Height: | Size: 2.5 KiB |
BIN
resources/graphics/Plants/SunShroom/SunShroom/SunShroom_1.png
Normal file
|
After Width: | Height: | Size: 2.6 KiB |
BIN
resources/graphics/Plants/SunShroom/SunShroom/SunShroom_2.png
Normal file
|
After Width: | Height: | Size: 2.6 KiB |
BIN
resources/graphics/Plants/SunShroom/SunShroom/SunShroom_3.png
Normal file
|
After Width: | Height: | Size: 2.6 KiB |
BIN
resources/graphics/Plants/SunShroom/SunShroom/SunShroom_4.png
Normal file
|
After Width: | Height: | Size: 2.6 KiB |
BIN
resources/graphics/Plants/SunShroom/SunShroom/SunShroom_5.png
Normal file
|
After Width: | Height: | Size: 2.6 KiB |
BIN
resources/graphics/Plants/SunShroom/SunShroom/SunShroom_6.png
Normal file
|
After Width: | Height: | Size: 2.7 KiB |
BIN
resources/graphics/Plants/SunShroom/SunShroom/SunShroom_7.png
Normal file
|
After Width: | Height: | Size: 2.5 KiB |
BIN
resources/graphics/Plants/SunShroom/SunShroom/SunShroom_8.png
Normal file
|
After Width: | Height: | Size: 2.5 KiB |
BIN
resources/graphics/Plants/SunShroom/SunShroom/SunShroom_9.png
Normal file
|
After Width: | Height: | Size: 2.5 KiB |
|
After Width: | Height: | Size: 3.0 KiB |
|
After Width: | Height: | Size: 3.1 KiB |
|
After Width: | Height: | Size: 3.2 KiB |
|
After Width: | Height: | Size: 3.1 KiB |
|
After Width: | Height: | Size: 3.2 KiB |
|
After Width: | Height: | Size: 3.2 KiB |
|
After Width: | Height: | Size: 3.1 KiB |
|
After Width: | Height: | Size: 3.0 KiB |
|
After Width: | Height: | Size: 3.0 KiB |
|
After Width: | Height: | Size: 2.9 KiB |
@ -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
|
||||
|
||||
|
||||
@ -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
|
||||
@ -673,3 +679,42 @@ class ScaredyShroom(Plant):
|
||||
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
|
||||
|
||||
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
|
||||
@ -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'
|
||||
|
||||
@ -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
|
||||
|
||||