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 or "Enemy" in other.tags: if side == BOTTOM_SIDE or side == TOP_SIDE: cancelVelocity(self.physics, side) else: inverseXVelocity(self.physics, side) return True return False
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)
def onCollisionEnter(self, other, side): if "Block" in other.tags: if side == LEFT_SIDE or side == RIGHT_SIDE: other.hit() inverseXVelocity(self.koopaTroopa.physics, side) return True else: return super(KoopaTroopa, self.koopaTroopa).onCollisionEnter(other, side) elif "Player" in other.tags: if side == TOP_SIDE: cancelVelocity(other.physics, TOTAL_SIDES - side) other.physics.addForce(Vector2(0, -7)) # self.gameObject.removeScript(self) self.koopaTroopa.state = StompedKoopaTroopaState( self.koopaTroopa) # self.koopaTroopa.addScript(InverseVelocity) # Reverse special rules # self.koopaTroopa.removeScript(self) else: print("kill") # if self.koopaTroopa.physics.velocity.dot(other.physics.velocity) < other.hit(self, TOTAL_SIDES - side) return False elif "Enemy" in other.tags: other.state = FlipDeathBehaviour(other) return False else: return super(KoopaTroopa, self.koopaTroopa).onCollisionEnter(other, side)
def onCollisionEnter(self, other, side): if "Block" in other.tags: cancelVelocity(self.gameObject.getComponent(Physics), side) return True return False
def onCollisionEnter(self, other, side): if "Player" in other.tags: cancelVelocity(other.physics, TOTAL_SIDES - side) return True