Skip to content

Commit

Permalink
修复僵尸在用铲子移除植物后还在原位啃食的bug
Browse files Browse the repository at this point in the history
  • Loading branch information
wszqkzqk committed Apr 7, 2022
1 parent b6e0961 commit 4ed1f0a
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 5 deletions.
5 changes: 0 additions & 5 deletions resources/data/map/level_0.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,6 @@
"init_sun_value":5000,
"shovel":1,
"zombie_list":[
{"time":1000, "map_y":2, "name":"BucketheadZombie"},
{"time":1000, "map_y":2, "name":"BucketheadZombie"},
{"time":1000, "map_y":2, "name":"Zombie"},
{"time":1000, "map_y":2, "name":"Zombie"},
{"time":1000, "map_y":2, "name":"Zombie"},
{"time":1000, "map_y":2, "name":"Zombie"},
{"time":2000, "map_y":2, "name":"BucketheadZombie"},
{"time":3000, "map_y":2, "name":"BucketheadZombie"},
Expand Down
2 changes: 2 additions & 0 deletions source/state/level.py
Original file line number Diff line number Diff line change
Expand Up @@ -612,6 +612,8 @@ def killPlant(self, plant):
_, map_y = self.map.getMapIndex(zombie.rect.centerx, zombie.rect.bottom)
self.zombie_groups[map_y].remove(zombie)
self.hypno_zombie_groups[map_y].add(zombie)
# 避免僵尸在用铲子移除植物后还在原位啃食
plant.health = 0
plant.kill()

def checkPlant(self, plant, i):
Expand Down

0 comments on commit 4ed1f0a

Please sign in to comment.