Example #1
0
 void cMoon::Update(void)
 {
     if (!m_valid_update || !Is_Visible_On_Screen())
     {
         return;
     }
     
     Update_Animation();
     
     particle_counter += pFramerate->m_speed_factor;
     
     if (particle_counter > 15.0f)
     {
         cParticle_Emitter* anim = new cParticle_Emitter();
         anim->Set_Pos(m_pos_x + Get_Random_Float(28.0f, 40.0f), m_pos_y + Get_Random_Float(10.0f, 30.0f));
         anim->Set_Pos_Z(m_pos_z - 0.0001f);
         anim->Set_Image(pVideo->Get_Surface("animation/particles/light.png"));
         anim->Set_Speed(0.2f, 0.2f);
         anim->Set_Scale(0.2f);
         anim->Set_Time_to_Live(0.9f);
         anim->Set_Color(Color(static_cast<Uint8>(200), 200, 0));
         anim->Set_Blending(BLEND_ADD);
         
         pAnimation_Manager->Add(anim);
         
         particle_counter = 0.0f;
     }
 }
Example #2
0
 bool cPath::Is_Draw_Valid(void)
 {
     if (!editor_enabled && !game_debug)
     {
         return 0;
     }
     
     if (!m_active || (!Is_Visible_On_Screen() && pMouseCursor->m_active_object != this))
     {
         return 0;
     }
     
     return 1;
 }
Example #3
0
bool cRandom_Sound::Is_Draw_Valid(void)
{
    // if editor not enabled
    if (!editor_enabled) {
        return 0;
    }

    // if not active on the screen or not mouse object
    if (!m_active || (!Is_Visible_On_Screen() && pMouseCursor->m_active_object != this)) {
        return 0;
    }

    return 1;
}
Example #4
0
bool cEnemyStopper :: Is_Draw_Valid( void )
{
	// if editor not enabled
	if( !editor_enabled )
	{
		return 0;
	}

	// if not active or not on the screen
	if( !m_active || !Is_Visible_On_Screen() )
	{
		return 0;
	}

	return 1;
}
Example #5
0
void cFirePlant :: Update( void )
{
	if( !m_valid_update || !Is_Visible_On_Screen() )
	{
		return;
	}

	counter += pFramerate->m_speed_factor;

	if( counter > speedfactor_fps * 2.5f )
	{
		// if no direction image set
		if( m_curr_img == 0 )
		{
			Set_Image_Num( 1 + ( rand() % 2 ), 0, 0 );
		}
		// direction image is set
		else
		{
			Set_Image_Num( 0, 0, 0 );
		}

		counter = 0.0f;
	}

	// particle animation
	particle_counter += pFramerate->m_speed_factor * 0.8f;

	while( particle_counter > 1 )
	{
		cParticle_Emitter *anim = new cParticle_Emitter();
		anim->Set_Pos( m_col_rect.m_x + Get_Random_Float( 0.0f, m_col_rect.m_w ), m_col_rect.m_y + Get_Random_Float( 0.0f, m_col_rect.m_h * 0.5f ) );
		anim->Set_Pos_Z( m_pos_z + 0.000001f );
		anim->Set_Direction_Range( 180.0f, 180.0f );
		anim->Set_Scale( 0.4f, 0.1f );
		anim->Set_Time_to_Live( 0.4f );
		anim->Set_Color( Color( static_cast<Uint8>(255), 50 + ( rand() % 50 ), 0 ) );
		anim->Set_Speed( 0.2f, 0.1f );
		anim->Set_Blending( BLEND_ADD );
		
		anim->Set_Image( pVideo->Get_Surface( "animation/particles/light.png" ) );

		pAnimation_Manager->Add( anim );

		particle_counter--;
	}
}
Example #6
0
 void cBaseBox::Handle_Collision_Player(cObjectCollision* collision)
 {
     if (collision->direction == DIR_BOTTOM && pPlayer->m_state != STA_FLY)
     {
         if (useable_count != 0)
         {
             Activate_Collision(Get_Opposite_Direction(collision->direction));
         }
         else 
         {
             if (Is_Visible_On_Screen())
             {
                 pAudio->Play_Sound("wall_hit.wav", RID_MARYO_WALL_HIT);
             }
         }
     }
 }
Example #7
0
 void cBaseBox::Handle_Collision_Enemy(cObjectCollision* collision)
 {
     cEnemy* enemy = static_cast<cEnemy*>(pActive_Sprite_Manager->Get_Pointer(collision->number));
     
     if (enemy->m_type == TYPE_TURTLE)
     {
         cTurtle *turtle = static_cast<cTurtle*>(enemy);
         
         if (turtle->m_turtle_state != TURTLE_SHELL_RUN && turtle->m_turtle_state != TURTLE_SHELL_STAND)
         {
             return;
         }
     }
     else if (enemy->m_type == TYPE_TURTLE_BOSS)
     {
         cTurtleBoss *turtleboss = static_cast<cTurtleBoss*>(enemy);
         
         if (turtleboss->m_turtle_state != TURTLEBOSS_SHELL_RUN && turtleboss->m_turtle_state != TURTLEBOSS_SHELL_STAND)
         {
             return;
         }
     }
     else
     {
         return;
     }
     
     if (collision->direction == DIR_RIGHT || collision->direction == DIR_LEFT || collision->direction == DIR_BOTTOM)
     {
         if (useable_count != 0 && m_type != TYPE_TEXT_BOX)
         {
             Activate_Collision(Get_Opposite_Direction(collision->direction));
         }
         else
         {
             if (Is_Visible_On_Screen())
             {
                 pAudio->Play_Sound("wall_hit.wav");
             }
         }
     }
 }
Example #8
0
 bool cBaseBox::Is_Draw_Valid(void)
 {
     if (!editor_enabled)
     {
         if (!m_active || !m_image)
         {
             return 0;
         }
         
         if (box_invisible == BOX_GHOST)
         {
             if (pPlayer->maryo_type != MARYO_GHOST)
             {
                 return 0;
             }
         }
     }
     else
     {
         if (m_auto_destroy)
         {
             return 0;
         }
         
         if (!m_start_image && !box_invisible)
         {
             return 0;
         }
     }
     
     if (!Is_Visible_On_Screen())
     {
         return 0;
     }
     
     return 1;
 }