Example #1
0
void cFlyon::Set_Image_Dir(fs::path dir)
{
    if (dir.empty()) {
        return;
    }

    // if not image directory
    if (!File_Exists(pResource_Manager->Get_Game_Pixmaps_Directory() / dir / utf8_to_path("closed_1.settings")) && !File_Exists(pResource_Manager->Get_Game_Pixmaps_Directory() / dir / utf8_to_path("closed_1.png"))) {
        std::cerr   << "Warning: Flyon image files not found; does the flyon directory "
                    << path_to_utf8(dir) << " exist?" << std::endl;
        return;
    }

    m_img_dir = dir;

    // clear images
    Clear_Images();
    // set images
    Add_Image(pVideo->Get_Surface(m_img_dir / utf8_to_path("closed_1.png")));
    Add_Image(pVideo->Get_Surface(m_img_dir / utf8_to_path("closed_2.png")));
    Add_Image(pVideo->Get_Surface(m_img_dir / utf8_to_path("open_1.png")));
    Add_Image(pVideo->Get_Surface(m_img_dir / utf8_to_path("open_2.png")));
    // set start image
    Set_Image_Num(0, 1);

    Set_Animation(1);
    Set_Animation_Image_Range(0, 3);
    Set_Time_All(130, 1);
    Reset_Animation();
}
Example #2
0
void cSpikeball :: Set_Moving_State( Moving_state new_state )
{
	if( new_state == m_state )
	{
		return;
	}

	if( new_state == STA_STAY )
	{
		m_counter_walk = 0.0f;
		Set_Animation( 0 );
	}
	else if( new_state == STA_WALK )
	{
		m_counter_running = 0.0f;
		m_counter_walk = Get_Random_Float( 0.0f, 80.0f );

		Set_Animation( 1 );
		Set_Animation_Image_Range( 0, 7 );
		Set_Time_All( 130, 1 );
		Reset_Animation();
	}
	else if( new_state == STA_RUN )
	{
		m_counter_stay = 0.0f;

		Set_Animation( 1 );
		Set_Animation_Image_Range( 0, 7 );
		Set_Time_All( 60, 1 );
		Reset_Animation();
	}

	m_state = new_state;

	Update_Velocity_Max();
	// if in the first part of the turn around animation
	Update_Rotation_Hor();
}
Example #3
0
void cRokko::Init(void)
{
    m_type = TYPE_ROKKO;
    m_name = "Rokko";
    m_massive_type = MASS_PASSIVE;
    m_pos_z = 0.03f;
    m_gravity_max = 0;
    m_editor_pos_z = 0.09f;
    m_can_be_on_ground = 0;
    m_camera_range = 4000;
    Set_Rotation_Affects_Rect(1);
    Set_Active(0);

    m_fire_resistant = 1;
    m_ice_resistance = 1;
    m_can_be_hit_from_shell = 0;

    Set_Direction(DIR_LEFT);
    Set_Speed(8.5f);
    m_min_distance_front = 200;
    Set_Max_Distance_Front(1000);
    Set_Max_Distance_Sides(400);
    m_state = STA_STAY;
    m_manual = false;

    m_smoke_counter = 0;

    m_kill_sound = "enemy/rokko/hit.wav";
    m_kill_points = 250;

    Add_Image(pVideo->Get_Surface("enemy/rokko/yellow/fly_1.png"));
    Add_Image(pVideo->Get_Surface("enemy/rokko/yellow/fly_2.png"));
    Add_Image(pVideo->Get_Surface("enemy/rokko/yellow/fly_3.png"));
    Add_Image(pVideo->Get_Surface("enemy/rokko/yellow/break_1.png"));
    Add_Image(pVideo->Get_Surface("enemy/rokko/yellow/break_2.png"));
    Add_Image(pVideo->Get_Surface("enemy/rokko/yellow/break_3.png"));
    Set_Image_Num(0, true);
    Set_Animation(true);
    Set_Animation_Image_Range(0, 2);
    Set_Time_All(130, true);
}
Example #4
0
void cEato::Set_Image_Dir(std::string dir)
{
    if (dir.empty())
    {
        return;
    }

    if (dir.find(DATA_DIR "/" GAME_PIXMAPS_DIR "/") == 0)
    {
        dir.erase(0, strlen(DATA_DIR "/" GAME_PIXMAPS_DIR "/"));
    }

    if (*(dir.end() - 1) != '/')
    {
        dir.insert(dir.length(), "/");
    }

    if (!File_Exists(DATA_DIR "/" GAME_PIXMAPS_DIR "/" + dir + "1.png") && !File_Exists(DATA_DIR "/" GAME_PIXMAPS_DIR "/" + dir + "1.settings"))
    {
        printf("Warning : Eato image dir does not exist %s\n", dir.c_str());
        return;
    }

    m_img_dir = dir;

    Clear_Images();

    Add_Image(pVideo->Get_Surface(m_img_dir + "1.png"));
    Add_Image(pVideo->Get_Surface(m_img_dir + "2.png"));
    Add_Image(pVideo->Get_Surface(m_img_dir + "3.png"));
    Add_Image(pVideo->Get_Surface(m_img_dir + "2.png"));

    Set_Image_Num(0, 1);

    Set_Animation(1);
    Set_Animation_Image_Range(0, 3);
    Set_Time_All(180, 1);
    Reset_Animation();

    Create_Name();
}
Example #5
0
 void cBaseBox::Set_Animation_Type(const std::string& new_anim_type)
 {
     if (anim_type.compare(new_anim_type) == 0)
     {
         return;
     }
     
     Clear_Images();
     anim_type = new_anim_type;
     
     if (anim_type.compare("Bonus") == 0)
     {
         Add_Image(pVideo->Get_Surface("game/box/brown1_1.png"));
         
         Add_Image(pVideo->Get_Surface("game/box/yellow/bonus/1.png"));
         Add_Image(pVideo->Get_Surface("game/box/yellow/bonus/2.png"));
         Add_Image(pVideo->Get_Surface("game/box/yellow/bonus/3.png"));
         Add_Image(pVideo->Get_Surface("game/box/yellow/bonus/4.png"));
         Add_Image(pVideo->Get_Surface("game/box/yellow/bonus/5.png"));
         Add_Image(pVideo->Get_Surface("game/box/yellow/bonus/6.png"));
         
         Set_Animation(1);
         Set_Animation_Image_Range(1, 6);
         Set_Time_All(90, 1);
     }
     else if (anim_type.compare("Default") == 0)
     {
         Add_Image(pVideo->Get_Surface("game/box/brown1_1.png"));
         
         Add_Image(pVideo->Get_Surface("game/box/yellow/default.png"));
         
         Set_Animation(0);
         Set_Animation_Image_Range(1, 1);
     }
     else if (anim_type.compare("Power") == 0)
     {
         Add_Image(pVideo->Get_Surface("game/box/brown1_1.png"));
         
         Add_Image(pVideo->Get_Surface("game/box/yellow/power_1.png"));
         
         Set_Animation(0);
         Set_Animation_Image_Range(1, 1);
     }
     else if (anim_type.compare("Spin") == 0)
     {
         Add_Image(pVideo->Get_Surface("game/box/yellow/spin/disabled.png"));
         
         Add_Image(pVideo->Get_Surface("game/box/yellow/default.png"));
         Add_Image(pVideo->Get_Surface("game/box/yellow/spin/1.png"));
         Add_Image(pVideo->Get_Surface("game/box/yellow/spin/2.png"));
         Add_Image(pVideo->Get_Surface("game/box/yellow/spin/3.png"));
         Add_Image(pVideo->Get_Surface("game/box/yellow/spin/4.png"));
         Add_Image(pVideo->Get_Surface("game/box/yellow/spin/5.png"));
         
         Set_Animation(0);
         Set_Animation_Image_Range(1, 6);
         Set_Time_All(80, 1);
     }
     else
     {
         printf("Warning : Unknown Box Animation Type %s\n", anim_type.c_str());
         Set_Animation_Type("Bonus");
     }
     
     Reset_Animation();
     
     Set_Image_Num(m_anim_img_start, 1, 0);
 }