def onCollisionEnter(self, other, side): if "Player" in other.tags: self.timer.stop() if side == TOP_SIDE: cancelVelocity(other.physics, TOTAL_SIDES - side) bouncePlayer(other) self.koopaTroopa.state = StompedKoopaTroopaState( self.koopaTroopa) return True else: if other.collider.worldRect.centerX < self.koopaTroopa.collider.worldRect.centerX: hitSide = LEFT_SIDE else: hitSide = RIGHT_SIDE self.koopaTroopa.state = BowlingKoopaTroopaState( self.koopaTroopa, hitSide) return False else: # return False return super(KoopaTroopa, self.koopaTroopa).onCollisionEnter(other, side)
def onCollisionEnter(self, other, side): # if "Block" in other.tags: # self.destroy() if "Player" in other.tags: if side == TOP_SIDE: cancelVelocity(other.physics, TOTAL_SIDES - side) bouncePlayer(other) self.dead = True else: other.hit(self, TOTAL_SIDES - side) return False return False
def onCollisionEnter(self, other, side): if "Player" in other.tags: if side == TOP_SIDE: cancelVelocity(other.physics, TOTAL_SIDES - side) bouncePlayer(other) self.Death().transform.position = self.transform.position self.destroy() else: other.hit(self, TOTAL_SIDES - side) return False else: return super().onCollisionEnter(other, side)
def onCollisionEnter(self, other, side): if "Player" in other.tags: if side == TOP_SIDE: cancelVelocity(other.physics, TOTAL_SIDES - side) bouncePlayer(other) # self.gameObject.removeScript(self) self.koopaTroopa.state = StompedKoopaTroopaState( self.koopaTroopa) else: other.hit(self, TOTAL_SIDES - side) return False else: # print(other.tags) return super(KoopaTroopa, self.koopaTroopa).onCollisionEnter(other, side)
def onCollisionEnter(self, other, side): if "Player" in other.tags: if side == TOP_SIDE: cancelVelocity(other.physics, TOTAL_SIDES - side) cancelVelocity(self.koopaParatroopa.physics, side) bouncePlayer(other) self.koopaParatroopa.state = WalkingKoopaTroopaState( self.koopaParatroopa) # self.koopaParatroopa.removeScript(self) self.koopaParatroopa.removeScript(Bouncing) else: other.hit(self, TOTAL_SIDES - side) return False return super(KoopaTroopa, self.koopaParatroopa).onCollisionEnter(other, side)