コード例 #1
0
ファイル: honeypot.cpp プロジェクト: LibreGames/plee-the-bear
/**
 * \brief Check if the collision is with a player.
 * \param that The other item of the collision.
 * \param info Some informations about the collision.
 */
void ptb::honeypot::collision_check_and_apply
( bear::engine::base_item& that, bear::universe::collision_info& info )
{
  player_proxy p(&that);

  if ( p != NULL )
    {
      if ( !m_given )
        {
          create_decoration();
          m_given = true;
          level_variables::set_honeypots_found
            ( get_level(),
              level_variables::get_honeypots_found(get_level()) + 1 );
          level_variables::set_honeypot_found( get_level(), m_id, true);

          if ( level_variables::get_honeypots_found(get_level()) % 5 == 0 )
            {
              give_life(1);
              give_life(2);
            }

	  on_found(p.get_index());
	  send_notification(p.get_index());

          kill();
        }
      else
        default_collision(info);
    }
  else
    default_collision(info);
} // honeypot::collision_check_and_apply()
コード例 #2
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()
コード例 #3
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()
コード例 #4
0
ファイル: physical_item.cpp プロジェクト: LibreGames/bear
/**
 * \brief Align the other item of the collision.
 * \param info Some informations about the collision.
 */
bool bear::universe::physical_item::default_collision
( const collision_info& info )
{
  return default_collision( info, collision_align_policy() );
} // physical_item::default_collision()