コード例 #1
0
/**
 * \brief The fonction called when the throwable item changes.
 * \param animation The new animation */
void ptb::throwable_item_component::on_throwable_item_changed
( const std::string& animation )
{
  m_throwable_item_animation = get_level_globals().get_animation( animation );
  update_inactive_position();
  on_throwable_item_changed();
} // throwable_item_component::on_throwable_item_changed()
コード例 #2
0
/**
 * \brief The fonction called when score changes.
 * \param s The new score.
 */
void ptb::score_component::on_score_changed(unsigned int s)
{
  std::ostringstream oss;
  oss << s;
  m_score.create(m_font, oss.str());
  m_score->set_intensity(1, 0.8, 0);

  update_inactive_position();

  claw::tween::tweener_sequence tween;

  tween.insert
    ( claw::tween::single_tweener
      (get_position().x, get_active_position().x, 0.3,
       boost::bind
       ( &ptb::status_component::on_x_position_update,
         this, _1 ), &claw::tween::easing_back::ease_out ) );

  tween.insert
    ( claw::tween::single_tweener
      (get_active_position().x, get_active_position().x, 1,
       boost::bind
       ( &ptb::status_component::on_x_position_update,
	 this, _1 ), &claw::tween::easing_back::ease_in ) );
  
  tween.insert
    ( claw::tween::single_tweener
      (get_active_position().x, get_inactive_position().x, 0.5,
       boost::bind
       ( &ptb::status_component::on_x_position_update,
	 this, _1 ), &claw::tween::easing_back::ease_in ) );
  
  add_tweener( tween );
} // score_component::on_score_changed()
コード例 #3
0
ファイル: score_component.cpp プロジェクト: fcjailybo/asgp
/**
 * \brief The fonction called when score changes.
 * \param combo The combo value.
 * \param points The points value.
 */
void rp::score_component::on_score_added(unsigned int combo, int points)
{
  int c = combo * points;
  if ( (c < 0) && ((int)game_variables::get_score() < -c) )
    game_variables::set_score( 0 );
  else
    game_variables::set_score( game_variables::get_score() + c );

  update_inactive_position();
}  // score_component::on_score_changed()
コード例 #4
0
/**
 * \brief The fonction called when .
 * \param stock The new stock.
 */
void ptb::throwable_item_component::on_throwable_item_stock_changed
( unsigned int stock)
{
  std::ostringstream oss;
  oss << stock;
  m_throwable_item.create(m_font, oss.str());
  m_throwable_item->set_intensity(1, 0.8, 0);
  
  update_inactive_position();

  on_throwable_item_changed();
} // throwable_item_component::on_throwable_item_stock_changed()
コード例 #5
0
ファイル: balloon_component.cpp プロジェクト: fcjailybo/asgp
/**
 * \brief The fonction called when number of balloon changes.
 * \param number The new balloon number.
 */
void rp::balloon_component::on_balloon_changed(unsigned int number)
{
  std::ostringstream oss;
  oss << number;
  m_balloon.create(m_font, oss.str());

  const double required( game_variables::get_required_balloons_number() );
  const double min_intensity(0.15);

  if ( number >= required )
    m_balloon->set_intensity( min_intensity, 1, min_intensity );
  else
    {
      const double ratio( (double)number / required );

      m_balloon->set_intensity
        ( 1,
          min_intensity + ratio * ( 1 - min_intensity ),
          min_intensity );
    }

  update_inactive_position();
} // balloon_component::on_balloon_changed()