Example #1
0
bool cStaticEnemy :: Editor_Path_Identifier_Text_Changed( const CEGUI::EventArgs &event )
{
	const CEGUI::WindowEventArgs &windowEventArgs = static_cast<const CEGUI::WindowEventArgs&>( event );
	std::string str_text = static_cast<CEGUI::Editbox *>( windowEventArgs.window )->getText().c_str();

	Set_Path_Identifier( str_text );

	return 1;
}
Example #2
0
void cStaticEnemy :: Create_From_Stream( CEGUI::XMLAttributes &attributes )
{
	// position
	Set_Pos( static_cast<float>(attributes.getValueAsInteger( "posx" )), static_cast<float>(attributes.getValueAsInteger( "posy" )), 1 );
	// rotation speed
	Set_Rotation_Speed( static_cast<float>( attributes.getValueAsFloat( "rotation_speed", -7.5f ) ) );
	// image
	Set_Static_Image( attributes.getValueAsString( "image", "enemy/static/saw/default.png" ).c_str() );
    // path
    Set_Path_Identifier( attributes.getValueAsString( "path", "" ).c_str() );
    // movement speed
    Set_Speed( static_cast<float>( attributes.getValueAsFloat( "speed", m_speed ) ) );
	// fire resistant
	m_fire_resistant = attributes.getValueAsBool( "fire_resistant", m_fire_resistant );
	// ice resistance
	m_ice_resistance = static_cast<float>( attributes.getValueAsFloat( "ice_resistance", m_ice_resistance ) );
}
Example #3
0
 void cStaticEnemy::Create_From_Stream(XMLElement* attributes)
 {
     int _posx, _posy;
     float _rotation_speed = -7.5f;
     std::string _image = "enemy/static/saw/default.png";
     std::string _path = "";
     float _speed = m_speed;
     bool _fire_resistant = m_fire_resistant;
     float _ice_resistance = m_ice_resistance;
     
     for (XMLElement* node = attributes->FirstChildElement(); node; node = node->NextSiblingElement())
     {
         const char* name = node->Attribute("name");
         const char* value = node->Attribute("value");
         
         if (!strcmp(name, "posx"))
         {
             _posx = atoi(value);
         }
         else if (!strcmp(name, "posy"))
         {
             _posy = atoi(value);
         }
         else if (!strcmp(name, "rotation_speed"))
         {
             _rotation_speed = atof(value);
         }
         else if (!strcmp(name, "image"))
         {
             _image = value;
         }
         else if (!strcmp(name, "path"))
         {
             _path = value;
         }
         else if (!strcmp(name, "speed"))
         {
             _speed = atof(value);
         }
         else if (!strcmp(name, "fire_resistatnt"))
         {
             if (value[0] == '0')
             {
                 _fire_resistant = false;
             }
             else if (value[0] == '1')
             {
                 _fire_resistant = true;
             }
         }
         else if (!strcmp(name, "ice_resistance"))
         {
             _ice_resistance = atof(value);
         }
     }
     
     Set_Pos(static_cast<float>(_posx), static_cast<float>(_posy), 1);
     Set_Rotation_Speed(static_cast<float>(_rotation_speed));
     Set_Static_Image(_image.c_str());
     Set_Path_Identifier(_path.c_str());
     Set_Speed(static_cast<float>(_speed));
     m_fire_resistant = _fire_resistant;
     m_ice_resistance = _ice_resistance;
 }