示例#1
0
    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)
示例#2
0
    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
示例#3
0
    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)
示例#4
0
    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)
示例#5
0
    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)