コード例 #1
0
ファイル: hole.cpp プロジェクト: fcjailybo/asgp
/**
 * \brief Process a collision with an other item.
 * \param that The other item of the collision.
 * \param info Some informations about the collision.
 */
void rp::hole::collision
( bear::engine::base_item& that, bear::universe::collision_info& info )
{
  cart* p = dynamic_cast<cart*>(&that);

  if ( p != NULL )
    {
      if ( ( info.get_collision_side() == 
	     bear::universe::zone::middle_right_zone) || 
	   ( info.get_collision_side() == 
	     bear::universe::zone::middle_left_zone ) )
	default_collision(info);
      
      if ( p->get_current_action_name() != "dead" )
        {
          if ( get_width() < 100 )
            {
              util::create_hit_star
                ( *this, bear::visual::color_type("#e0e0e0"),
                  bear::visual::color_type("#12ab00"), 1 );
              p->die(false, true);
            }
          else
            p->die(false, false);
        }
    }
  else
    super::collision(that,info);
} // hole::collision()
コード例 #2
0
ファイル: passive_enemy.cpp プロジェクト: LibreGames/tunnel
/**
 * \brief Call collision_check_and_align().
 * \param that The other item of the collision.
 * \param info Some informations about the collision.
 */
void tunnel::passive_enemy::collision
( bear::engine::base_item& that, bear::universe::collision_info& info )
{
  side_type t = inactive_type;

  switch( info.get_collision_side() )
    {
    case bear::universe::zone::top_zone:
      t = m_top_side_type; break;
    case bear::universe::zone::bottom_zone:
      t = m_bottom_side_type; break;
    case bear::universe::zone::middle_left_zone:
      t = m_left_side_type; break;
    case bear::universe::zone::middle_right_zone:
      t = m_right_side_type; break;
    default:
      { }
    }

  if ( t == attack_type )
    {
      if ( collision_and_attack(that, info) )
        collision_check_and_align(that, info);
    }
  else
    collision_check_and_align(that, info);
} // passive_enemy::collision()
コード例 #3
0
ファイル: zeppelin.cpp プロジェクト: fcjailybo/asgp
/**
 * \brief Process a collision with a tar.
 * \param that The other item of the collision.
 * \param info Some informations about the collision.
 * \return Return True if the collision is with a tar.
 */
bool rp::zeppelin::collision_with_tar
( bear::engine::base_item& that, bear::universe::collision_info& info )
{ 
  bool result = false;
  tar* t = dynamic_cast<tar*>(&that);
  
  if ( t != NULL ) 
    {
      if ( ( info.get_collision_side() == bear::universe::zone::top_zone ) && 
           ( t->get_current_action_name() != "explose" ) && 
           ( t->get_current_action_name() != "on_rail" ) )
        {
          if ( t->get_combo_value() != 0 )
            set_combo_value(t->get_combo_value()+1);      
          t->explose();
          drop();
          make_dirty();
        }

      default_collision(info);
      
      result = true;
    }
  
  return result;
} // zeppelin::collision_with_tar()
コード例 #4
0
ファイル: passive_enemy.cpp プロジェクト: LibreGames/tunnel
/**
 * \brief Process a collision and attack.
 * \param that The other item of the collision.
 * \param info Some informations about the collision.
 */
bool tunnel::passive_enemy::collision_and_attack
( bear::engine::base_item& that, bear::universe::collision_info& info )
{
  if ( attack(that, info.get_collision_side()) )
    return true;
  else
    {
      super::collision(that, info);
      return false;
    }
} // passive_enemy::collision_and_attack()
コード例 #5
0
ファイル: bird_support.cpp プロジェクト: fcjailybo/asgp
/**
 * \brief Process a collision with a cart.
 * \param that The other item of the collision.
 * \param info Some informations about the collision.
 * \return Return True if the collision is with a cart.
 */
bool rp::bird_support::collision_with_cart
( bear::engine::base_item& that, bear::universe::collision_info& info )
{ 
  bool result = false;
  cart* c = dynamic_cast<cart*>(&that);
  
  if ( c != NULL ) 
    {
      if ( info.get_collision_side() == bear::universe::zone::top_zone ) 
        c->jump();

      result = true;
    }
  
  return result;
} // bird_support::collision_with_cart()