add repeaterpea plant
BIN
resources/graphics/Cards/card_repeaterpea.png
Normal file
|
After Width: | Height: | Size: 11 KiB |
BIN
resources/graphics/Plants/RepeaterPea/RepeaterPea_0.png
Normal file
|
After Width: | Height: | Size: 4.4 KiB |
BIN
resources/graphics/Plants/RepeaterPea/RepeaterPea_1.png
Normal file
|
After Width: | Height: | Size: 4.4 KiB |
BIN
resources/graphics/Plants/RepeaterPea/RepeaterPea_10.png
Normal file
|
After Width: | Height: | Size: 4.5 KiB |
BIN
resources/graphics/Plants/RepeaterPea/RepeaterPea_11.png
Normal file
|
After Width: | Height: | Size: 4.5 KiB |
BIN
resources/graphics/Plants/RepeaterPea/RepeaterPea_12.png
Normal file
|
After Width: | Height: | Size: 4.5 KiB |
BIN
resources/graphics/Plants/RepeaterPea/RepeaterPea_13.png
Normal file
|
After Width: | Height: | Size: 4.6 KiB |
BIN
resources/graphics/Plants/RepeaterPea/RepeaterPea_14.png
Normal file
|
After Width: | Height: | Size: 4.5 KiB |
BIN
resources/graphics/Plants/RepeaterPea/RepeaterPea_2.png
Normal file
|
After Width: | Height: | Size: 4.3 KiB |
BIN
resources/graphics/Plants/RepeaterPea/RepeaterPea_3.png
Normal file
|
After Width: | Height: | Size: 4.6 KiB |
BIN
resources/graphics/Plants/RepeaterPea/RepeaterPea_4.png
Normal file
|
After Width: | Height: | Size: 4.6 KiB |
BIN
resources/graphics/Plants/RepeaterPea/RepeaterPea_5.png
Normal file
|
After Width: | Height: | Size: 4.6 KiB |
BIN
resources/graphics/Plants/RepeaterPea/RepeaterPea_6.png
Normal file
|
After Width: | Height: | Size: 4.6 KiB |
BIN
resources/graphics/Plants/RepeaterPea/RepeaterPea_7.png
Normal file
|
After Width: | Height: | Size: 4.6 KiB |
BIN
resources/graphics/Plants/RepeaterPea/RepeaterPea_8.png
Normal file
|
After Width: | Height: | Size: 4.3 KiB |
BIN
resources/graphics/Plants/RepeaterPea/RepeaterPea_9.png
Normal file
|
After Width: | Height: | Size: 4.3 KiB |
@ -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):
|
||||
|
||||
@ -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)
|
||||
|
||||
@ -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'
|
||||
|
||||
@ -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)
|
||||
|
||||