diff --git a/classes/Sound.py b/classes/Sound.py index 1bf7d260..3affb798 100644 --- a/classes/Sound.py +++ b/classes/Sound.py @@ -20,6 +20,7 @@ def __init__(self): self.brick_bump = mixer.Sound("./sfx/brick-bump.ogg") self.powerup = mixer.Sound('./sfx/powerup.ogg') self.powerup_appear = mixer.Sound('./sfx/powerup_appears.ogg') + self.pipe = mixer.Sound('./sfx/pipe.ogg') def play_sfx(self, sfx): if self.allowSFX: diff --git a/entities/Koopa.py b/entities/Koopa.py index 3e05b252..387739b1 100644 --- a/entities/Koopa.py +++ b/entities/Koopa.py @@ -38,8 +38,6 @@ def update(self, camera): self.checkEntityCollision() elif self.alive == "shellBouncing": self.shellBouncing(camera) - elif self.alive is False: - self.die(camera) def drawKoopa(self, camera): if self.leftrightTrait.direction == -1: @@ -59,33 +57,6 @@ def shellBouncing(self, camera): self.drawKoopa(camera) self.leftrightTrait.update() - def die(self, camera): - if self.timer == 0: - self.textPos = Vec2D(self.rect.x + 3, self.rect.y - 32) - if self.timer < self.timeAfterDeath: - self.textPos.y += -0.5 - self.textPos = Vec2D(self.rect.x + 3, self.rect.y - 32) - self.dashboard.drawText("100", self.textPos.x + camera.x, self.textPos.y, 8) - self.vel.y -= 0.5 - self.rect.y += self.vel.y - self.screen.blit( - self.spriteCollection.get("koopa-hiding").image, - (self.rect.x + camera.x, self.rect.y - 32), - ) - else: - self.vel.y += 0.3 - self.rect.y += self.vel.y - self.textPos.y += -0.5 - self.dashboard.drawText("100", self.textPos.x + camera.x, self.textPos.y, 8) - self.screen.blit( - self.spriteCollection.get("koopa-hiding").image, - (self.rect.x + camera.x, self.rect.y - 32), - ) - if self.timer > 500: - # delete entity - self.alive = None - self.timer += 6 - def sleepingInShell(self, camera): if self.timer < self.timeAfterDeath: self.screen.blit( diff --git a/entities/Mario.py b/entities/Mario.py index 5a37acef..65752458 100644 --- a/entities/Mario.py +++ b/entities/Mario.py @@ -99,7 +99,7 @@ def _onCollisionWithBlock(self, block): block.triggered = True def _onCollisionWithMob(self, mob, collisionState): - if isinstance(mob, RedMushroom): + if isinstance(mob, RedMushroom) and mob.alive: self.powerup(1) self.killEntity(mob) self.sound.play_sfx(self.sound.powerup) @@ -133,6 +133,7 @@ def _onCollisionWithMob(self, mob, collisionState): x, y = self.rect.x, self.rect.y self.rect = pygame.Rect(x, y + 32, 32, 32) self.invincibilityFrames = 60 + self.sound.play_sfx(self.sound.pipe) def bounce(self): self.traits["bounceTrait"].jump = True diff --git a/entities/Mushroom.py b/entities/Mushroom.py index 2088d836..60d04734 100644 --- a/entities/Mushroom.py +++ b/entities/Mushroom.py @@ -54,13 +54,4 @@ def movePointsTextUpAndDraw(self, camera): self.dashboard.drawText("100", self.textPos.x + camera.x, self.textPos.y, 8) def checkEntityCollision(self): - for ent in self.levelObj.entityList: - collisionState = self.EntityCollider.check(ent) - if collisionState.isColliding: - if ent.type == "Mob": - self._onCollisionWithMob(ent, collisionState) - - def _onCollisionWithMob(self, mob, collisionState): - if collisionState.isColliding and mob.alive == "shellBouncing": - self.alive = False - self.sound.play_sfx(self.sound.brick_bump) + pass diff --git a/sfx/pipe.ogg b/sfx/pipe.ogg new file mode 100644 index 00000000..e3396e78 Binary files /dev/null and b/sfx/pipe.ogg differ