def __backoff(self, direction: Vector2): if direction == VECTOR2_NULL: direction = Vector2(1, 0) else: direction.normalize_ip() direction.y = min(direction.y, .1) direction *= EnemySettings.HandToHand.RETREAT_FORCE self.apply_force(direction)
def bulk_check(node: [Vector2], direction: Vector2, amount: float): # without points no collision if not node: return False, amount direction.normalize_ip() for p in node: for v, amount in vector_ray_iterator(p, direction, amount): if static_collision_check(v): return True, amount return False, amount
def __attack_normal(self, direction: Vector2): direction.normalize_ip() direction.y -= max(EnemySettings.HandToHand.ATTACK_MIN_JUMP, direction.y) direction *= EnemySettings.HandToHand.ATTACK_FACTOR self.apply_force(direction)