Skip to content

Commit

Permalink
重构
Browse files Browse the repository at this point in the history
  • Loading branch information
wszqkzqk committed Aug 9, 2022
1 parent 08ec7e2 commit 777e937
Showing 1 changed file with 14 additions and 12 deletions.
26 changes: 14 additions & 12 deletions source/component/plant.py
Original file line number Diff line number Diff line change
Expand Up @@ -1279,18 +1279,20 @@ def __init__(self, x, y, bullet_group):

def idling(self):
for i in self.bullet_group:
if i.name == c.BULLET_PEA:
if i.passed_torchwood_x != self.rect.centerx:
if abs(i.rect.centerx - self.rect.centerx) <= 20:
self.bullet_group.add(Bullet(i.rect.x, i.rect.y, i.dest_y,
c.BULLET_FIREBALL, c.BULLET_DAMAGE_FIREBALL_BODY, effect=c.BULLET_EFFECT_UNICE, passed_torchwood_x=self.rect.centerx))
i.kill()
elif i.name == c.BULLET_PEA_ICE:
if i.passed_torchwood_x != self.rect.centerx:
if abs(i.rect.centerx - self.rect.centerx) <= 20:
self.bullet_group.add(Bullet(i.rect.x, i.rect.y, i.dest_y,
c.BULLET_PEA, c.BULLET_DAMAGE_NORMAL, effect=None, passed_torchwood_x=self.rect.centerx))
i.kill()
if (i.name == c.BULLET_PEA
and i.passed_torchwood_x != self.rect.centerx
and abs(i.rect.centerx - self.rect.centerx) <= 20):
self.bullet_group.add(Bullet(i.rect.x, i.rect.y, i.dest_y,
c.BULLET_FIREBALL, c.BULLET_DAMAGE_FIREBALL_BODY,
effect=c.BULLET_EFFECT_UNICE, passed_torchwood_x=self.rect.centerx))
i.kill()
elif (i.name == c.BULLET_PEA_ICE
and i.passed_torchwood_x != self.rect.centerx
and abs(i.rect.centerx - self.rect.centerx)):
self.bullet_group.add(Bullet(i.rect.x, i.rect.y, i.dest_y,
c.BULLET_PEA, c.BULLET_DAMAGE_NORMAL,
effect=None, passed_torchwood_x=self.rect.centerx))
i.kill()

class StarFruit(Plant):
def __init__(self, x, y, bullet_group, level):
Expand Down

0 comments on commit 777e937

Please sign in to comment.