Esempio n. 1
0
/**
 * \brief Init mark in cart_element action.
 * \param name The name of the mark.
 */
void rp::bonus::init_mark( const std::string& name )
{
    bear::engine::model_mark_placement element;

    if ( get_mark_placement( name, element ) )
        set_global_substitute
        ( name,
          new bear::visual::animation
          ( get_level_globals().auto_sprite
            ( "gfx/cart-theme/"+ game_variables::get_level_theme()+".png",
              name ) ) );
} // bonus::init_mark()
Esempio n. 2
0
/**
 * \brief Initialize the item.
 */
void rp::switching::on_enters_layer()
{
  super::on_enters_layer();

  set_model_actor( get_level_globals().get_model("model/switching.cm") );
  start_model_action(m_initial_state);
   
  bear::engine::model_mark_placement mark;

  if ( get_mark_placement("sign", mark) )
    create_interactive_item
        (*this, 0.25, 0, mark.get_position() - get_center_of_mass() );
} // rp::switching::on_enters_layer()
Esempio n. 3
0
/**
 * \brief Check if a player is visible for the gorilla.
 * \param p The player we are looking for.
 * \param left_orientation True if the orientation is toward the left.
 * \param distance The distance of scan.
 */
bool ptb::gorilla::scan_for_player
( const player_proxy& p, bool left_orientation,
  bear::universe::coordinate_type distance ) const
{
  bool result = false;
  const bool player_on_the_left
    ( p.get_horizontal_middle() <= get_horizontal_middle() );

  if ( !(player_on_the_left ^ left_orientation) )
    {
      bear::engine::model_mark_placement m;
      m.set_position( get_center_of_mass() );
      get_mark_placement("eyes", m);
      bear::universe::position_type pos(p.get_bottom_middle());
      pos.y += 1;

      result = scan_no_wall_in_direction
        ( m.get_position(), pos - m.get_position(), distance );
    }

  return result;
} // gorilla::scan_in_direction()