减少变量名歧义

This commit is contained in:
星外之神 2022-05-04 22:21:24 +08:00
parent 33d10028ae
commit d48260636a

View File

@ -651,12 +651,12 @@ class PotatoMine(Plant):
class Squash(Plant): class Squash(Plant):
def __init__(self, x, y, mapObjSet): def __init__(self, x, y, mapPlantsSet):
Plant.__init__(self, x, y, c.SQUASH, c.PLANT_HEALTH, None) Plant.__init__(self, x, y, c.SQUASH, c.PLANT_HEALTH, None)
self.orig_pos = (x, y) self.orig_pos = (x, y)
self.aim_timer = 0 self.aim_timer = 0
self.squashing = False self.squashing = False
self.mapObjSet = mapObjSet self.mapPlantsSet = mapPlantsSet
def loadImages(self, name, scale): def loadImages(self, name, scale):
self.idle_frames = [] self.idle_frames = []
@ -707,7 +707,7 @@ class Squash(Plant):
if self.canAttack(zombie): if self.canAttack(zombie):
zombie.setDamage(1800, damageType=c.ZOMBIE_RANGE_DAMAGE) zombie.setDamage(1800, damageType=c.ZOMBIE_RANGE_DAMAGE)
self.health = 0 # 避免僵尸在原位啃食 self.health = 0 # 避免僵尸在原位啃食
self.mapObjSet.remove(c.SQUASH) self.mapPlantsSet.remove(c.SQUASH)
self.kill() self.kill()
elif self.aim_timer == 0: elif self.aim_timer == 0:
self.aim_timer = self.current_time self.aim_timer = self.current_time