Skip to content

Commit

Permalink
shellbouncing fix
Browse files Browse the repository at this point in the history
  • Loading branch information
mx0c committed Oct 16, 2018
1 parent b1eb29d commit 0735f4d
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
6 changes: 4 additions & 2 deletions entities/Mario.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ def _onCollisionWithBlock(self, block):
block.triggered = True

def _onCollisionWithMob(self, mob, collisionState):
if collisionState.isTop and (mob.alive is True or mob.alive == "shellBouncing"):
if collisionState.isTop and (mob.alive or mob.alive == "shellBouncing"):
self.sound.play_sfx(self.sound.stomp)
self.rect.bottom = mob.rect.top
self.bounce()
Expand All @@ -92,10 +92,12 @@ def _onCollisionWithMob(self, mob, collisionState):
mob.timer = 0
self.bounce()
mob.alive = False
elif collisionState.isTop and mob.alive == "sleeping":
elif collisionState.isColliding and mob.alive == "sleeping":
if mob.rect.x < self.rect.x:
mob.leftrightTrait.direction = -1
mob.rect.move(10,0)
else:
mob.rect.move(-10,0)
mob.leftrightTrait.direction = 1
mob.alive = "shellBouncing"
elif collisionState.isColliding and mob.alive:
Expand Down
2 changes: 1 addition & 1 deletion traits/bounce.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
class bounceTrait:
def __init__(self, entity):
self.vel = 15
self.vel = 5
self.jump = False
self.entity = entity

Expand Down

0 comments on commit 0735f4d

Please sign in to comment.