铲子指向多个植物时只高亮将移除的那一个

This commit is contained in:
星外之神 2022-04-19 00:47:56 +08:00
parent 8d513fab5d
commit b1941820c6
2 changed files with 4 additions and 1 deletions

View File

@ -80,6 +80,8 @@ class Zombie(pg.sprite.Sprite):
self.health -= (self.current_time - self.losthead_timer) / 40 self.health -= (self.current_time - self.losthead_timer) / 40
self.losthead_timer = self.current_time self.losthead_timer = self.current_time
return False return False
else:
return False
def walking(self): def walking(self):
if self.checkToDie(self.losthead_walk_frames): if self.checkToDie(self.losthead_walk_frames):

View File

@ -828,11 +828,12 @@ class Level(tool.State):
self.shovel_rect.centery = y self.shovel_rect.centery = y
# 铲子接近植物时会高亮提示 # 铲子接近植物时会高亮提示
map_x, map_y = self.map.getMapIndex(x, y) map_x, map_y = self.map.getMapIndex(x, y)
surface.blit(self.shovel, self.shovel_rect)
for i in self.plant_groups[map_y]: for i in self.plant_groups[map_y]:
if (x >= i.rect.x and x <= i.rect.right and if (x >= i.rect.x and x <= i.rect.right and
y >= i.rect.y and y <= i.rect.bottom): y >= i.rect.y and y <= i.rect.bottom):
i.highlightTime = self.current_time i.highlightTime = self.current_time
surface.blit(self.shovel, self.shovel_rect) return
def drawZombieFreezeTrap(self, i, surface): def drawZombieFreezeTrap(self, i, surface):
for zombie in self.zombie_groups[i]: for zombie in self.zombie_groups[i]: