Fix standing enemies collision

This commit is contained in:
Nikolya Andreychik
2021-04-06 01:25:25 -07:00
parent c1c439b771
commit c40653ed23
4 changed files with 26 additions and 6 deletions
+6 -2
View File
@@ -8,6 +8,7 @@ import random
import os
from Enemy import Enemy
from CollisionBox import CollisionBox
class StandingEnemy(Enemy):
@@ -73,9 +74,9 @@ class StandingEnemy(Enemy):
image.set_colorkey((255,0,255))
self.subtype = random.randint(1, len(StandingEnemy.images))
self.subtype = random.randint(0, len(StandingEnemy.images) - 1)
self.image = random.choice(StandingEnemy.images[self.subtype-1])
self.image = random.choice(StandingEnemy.images[self.subtype])
# if self.subtype == 1: self.image = pygame.Surface((32, 96))
# elif self.subtype == 2: self.image = pygame.Surface((32, 64))
@@ -91,4 +92,7 @@ class StandingEnemy(Enemy):
self.rect.center = (mainGameClass.getScreenWidth() + self.rect.width,
self.height)
collision = CollisionBox(9, 3, self.rect.w - 18, self.rect.h - 6, self.rect.center)
self.collisionBoxes.add(collision)
self.speed = self.thisGame.getGameSpeed()