倭瓜位置判断改为重叠20像素
This commit is contained in:
parent
2c140577a1
commit
e17c16927f
@ -784,11 +784,11 @@ class Squash(Plant):
|
|||||||
# 僵尸在倭瓜右侧
|
# 僵尸在倭瓜右侧
|
||||||
if zombie.rect.x >= self.rect.x:
|
if zombie.rect.x >= self.rect.x:
|
||||||
# 重叠15%判断为可以攻击
|
# 重叠15%判断为可以攻击
|
||||||
if (self.rect.right - zombie.rect.left >= 0.15*zombie.rect.width):
|
if (self.rect.right - zombie.rect.left >= 20):
|
||||||
return True
|
return True
|
||||||
# 僵尸在倭瓜右侧
|
# 僵尸在倭瓜右侧
|
||||||
else:
|
else:
|
||||||
if (zombie.rect.right - self.rect.left >= 0.15*zombie.rect.width):
|
if (zombie.rect.right - self.rect.left >= 20):
|
||||||
return True
|
return True
|
||||||
# 碰撞检测
|
# 碰撞检测
|
||||||
if pg.sprite.collide_mask(zombie, self):
|
if pg.sprite.collide_mask(zombie, self):
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user