Fix standing enemies collision
This commit is contained in:
+8
-4
@@ -178,10 +178,11 @@ class Drakora():
|
||||
|
||||
if self.drawBoxes:
|
||||
for player in self.players:
|
||||
for collision in self.player.getCollisionBoxes():
|
||||
for collision in player.getCollisionBoxes():
|
||||
pygame.draw.rect(self.screen, (255, 0, 0), collision.rect, 1)
|
||||
for enemy in self.enemies:
|
||||
pygame.draw.rect(self.screen, (255, 0, 0), enemy.rect, 1)
|
||||
for collision in enemy.getCollisionBoxes():
|
||||
pygame.draw.rect(self.screen, (255, 0, 0), collision.rect, 1)
|
||||
for floor in self.floors:
|
||||
pygame.draw.rect(self.screen, (255, 0, 0), floor.rect, 1)
|
||||
|
||||
@@ -241,8 +242,11 @@ class Drakora():
|
||||
return 300
|
||||
|
||||
def collideCheck(self):
|
||||
if pygame.sprite.groupcollide(self.player.getCollisionBoxes(), self.enemies, None, None):
|
||||
if not self.isGodmode: self.isGameOver = True
|
||||
for enemy in self.enemies:
|
||||
if pygame.sprite.groupcollide(self.player.getCollisionBoxes(), enemy.getCollisionBoxes(), None, None):
|
||||
if not self.isGodmode:
|
||||
self.isGameOver = True
|
||||
break
|
||||
|
||||
if self.player.isOnFloor:
|
||||
self.player.rect.y += 1
|
||||
|
||||
Reference in New Issue
Block a user