add plant Jalapeno
BIN
resources/graphics/Cards/card_jalapeno.png
Normal file
|
After Width: | Height: | Size: 13 KiB |
BIN
resources/graphics/Plants/Jalapeno/Jalapeno/Jalapeno_0.png
Normal file
|
After Width: | Height: | Size: 4.4 KiB |
BIN
resources/graphics/Plants/Jalapeno/Jalapeno/Jalapeno_1.png
Normal file
|
After Width: | Height: | Size: 4.7 KiB |
BIN
resources/graphics/Plants/Jalapeno/Jalapeno/Jalapeno_2.png
Normal file
|
After Width: | Height: | Size: 4.9 KiB |
BIN
resources/graphics/Plants/Jalapeno/Jalapeno/Jalapeno_3.png
Normal file
|
After Width: | Height: | Size: 5.0 KiB |
BIN
resources/graphics/Plants/Jalapeno/Jalapeno/Jalapeno_4.png
Normal file
|
After Width: | Height: | Size: 5.3 KiB |
BIN
resources/graphics/Plants/Jalapeno/Jalapeno/Jalapeno_5.png
Normal file
|
After Width: | Height: | Size: 5.4 KiB |
BIN
resources/graphics/Plants/Jalapeno/Jalapeno/Jalapeno_6.png
Normal file
|
After Width: | Height: | Size: 5.6 KiB |
BIN
resources/graphics/Plants/Jalapeno/Jalapeno/Jalapeno_7.png
Normal file
|
After Width: | Height: | Size: 6.0 KiB |
|
After Width: | Height: | Size: 19 KiB |
|
After Width: | Height: | Size: 22 KiB |
|
After Width: | Height: | Size: 21 KiB |
|
After Width: | Height: | Size: 22 KiB |
|
After Width: | Height: | Size: 18 KiB |
|
After Width: | Height: | Size: 13 KiB |
|
After Width: | Height: | Size: 6.8 KiB |
|
After Width: | Height: | Size: 2.0 KiB |
@ -12,13 +12,15 @@ CARD_LIST_NUM = 8
|
|||||||
|
|
||||||
card_name_list = [c.CARD_SUNFLOWER, c.CARD_PEASHOOTER, c.CARD_SNOWPEASHOOTER, c.CARD_WALLNUT,
|
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_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,
|
plant_name_list = [c.SUNFLOWER, c.PEASHOOTER, c.SNOWPEASHOOTER, c.WALLNUT,
|
||||||
c.CHERRYBOMB, c.THREEPEASHOOTER, c.REPEATERPEA, c.CHOMPER,
|
c.CHERRYBOMB, c.THREEPEASHOOTER, c.REPEATERPEA, c.CHOMPER,
|
||||||
c.PUFFMUSHROOM, c.POTATOMINE, c.SQUASH, c.SPIKEWEED]
|
c.PUFFMUSHROOM, c.POTATOMINE, c.SQUASH, c.SPIKEWEED,
|
||||||
plant_sun_list = [50, 100, 175, 50, 150, 325, 200, 150, 0, 25, 50, 100]
|
c.JALAPENO]
|
||||||
plant_frozen_time_list = [0, 5000, 5000, 10000, 5000, 5000, 5000, 5000, 8000, 8000, 8000, 8000]
|
plant_sun_list = [50, 100, 175, 50, 150, 325, 200, 150, 0, 25, 50, 100, 125]
|
||||||
all_card_list = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11]
|
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):
|
def getSunValueImage(sun_value):
|
||||||
font = pg.font.SysFont(None, 22)
|
font = pg.font.SysFont(None, 22)
|
||||||
|
|||||||
@ -570,7 +570,6 @@ class Spikeweed(Plant):
|
|||||||
|
|
||||||
def loadImages(self, name, scale):
|
def loadImages(self, name, scale):
|
||||||
self.loadFrames(self.frames, name, 0.9, c.WHITE)
|
self.loadFrames(self.frames, name, 0.9, c.WHITE)
|
||||||
self.select_image = self.frames[0]
|
|
||||||
|
|
||||||
def setIdle(self):
|
def setIdle(self):
|
||||||
print('spikeweed idle')
|
print('spikeweed idle')
|
||||||
@ -594,4 +593,42 @@ class Spikeweed(Plant):
|
|||||||
self.attack_timer = self.current_time
|
self.attack_timer = self.current_time
|
||||||
for zombie in self.zombie_group:
|
for zombie in self.zombie_group:
|
||||||
if self.canAttack(zombie):
|
if self.canAttack(zombie):
|
||||||
zombie.setDamage(1, False)
|
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]
|
||||||
@ -77,6 +77,7 @@ PUFFMUSHROOM = 'PuffMushroom'
|
|||||||
POTATOMINE = 'PotatoMine'
|
POTATOMINE = 'PotatoMine'
|
||||||
SQUASH = 'Squash'
|
SQUASH = 'Squash'
|
||||||
SPIKEWEED = 'Spikeweed'
|
SPIKEWEED = 'Spikeweed'
|
||||||
|
JALAPENO = 'Jalapeno'
|
||||||
|
|
||||||
PLANT_HEALTH = 5
|
PLANT_HEALTH = 5
|
||||||
WALLNUT_HEALTH = 30
|
WALLNUT_HEALTH = 30
|
||||||
@ -103,6 +104,7 @@ CARD_PUFFMUSHROOM = 'card_puffmushroom'
|
|||||||
CARD_POTATOMINE = 'card_potatomine'
|
CARD_POTATOMINE = 'card_potatomine'
|
||||||
CARD_SQUASH = 'card_squash'
|
CARD_SQUASH = 'card_squash'
|
||||||
CARD_SPIKEWEED = 'card_spikeweed'
|
CARD_SPIKEWEED = 'card_spikeweed'
|
||||||
|
CARD_JALAPENO = 'card_jalapeno'
|
||||||
|
|
||||||
#BULLET INFO
|
#BULLET INFO
|
||||||
BULLET_PEA = 'PeaNormal'
|
BULLET_PEA = 'PeaNormal'
|
||||||
|
|||||||
@ -202,6 +202,8 @@ class Level(tool.State):
|
|||||||
self.plant_groups[map_y].add(plant.Squash(x, y))
|
self.plant_groups[map_y].add(plant.Squash(x, y))
|
||||||
elif self.plant_name == c.SPIKEWEED:
|
elif self.plant_name == c.SPIKEWEED:
|
||||||
self.plant_groups[map_y].add(plant.Spikeweed(x, y))
|
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.decreaseSunValue(self.plant_cost)
|
||||||
self.menubar.setCardFrozenTime(self.plant_name)
|
self.menubar.setCardFrozenTime(self.plant_name)
|
||||||
@ -238,7 +240,8 @@ class Level(tool.State):
|
|||||||
rect = frame_list[0].get_rect()
|
rect = frame_list[0].get_rect()
|
||||||
width, height = rect.w, rect.h
|
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
|
color = c.WHITE
|
||||||
else:
|
else:
|
||||||
color = c.BLACK
|
color = c.BLACK
|
||||||
@ -298,7 +301,7 @@ class Level(tool.State):
|
|||||||
x, y = plant.getPosition()
|
x, y = plant.getPosition()
|
||||||
map_x, map_y = self.map.getMapIndex(x, y)
|
map_x, map_y = self.map.getMapIndex(x, y)
|
||||||
self.map.setMapGridType(map_x, map_y, c.MAP_EMPTY)
|
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)):
|
(plant.name == c.POTATOMINE and not plant.is_init)):
|
||||||
self.boomZombies(plant.rect.centerx, map_y, plant.explode_y_range,
|
self.boomZombies(plant.rect.centerx, map_y, plant.explode_y_range,
|
||||||
plant.explode_x_range)
|
plant.explode_x_range)
|
||||||
|
|||||||