void cEato::Create_From_Stream(XMLElement* attributes) { int posx = 0, posy = 0; std::string image_dir = m_img_dir; std::string direction = Get_Direction_Name(m_start_direction); 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, "image_dir")) { image_dir = value; } else if (!strcmp(name, "direction")) { direction = value; } } Set_Pos(static_cast<float>(posx), static_cast<float>(posy), 1); Set_Image_Dir(image_dir.c_str()); Set_Direction(Get_Direction_Id(direction.c_str())); }
bool cFlyon::Editor_Image_Dir_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_Image_Dir(utf8_to_path(str_text)); return 1; }
void cEato::Init(void) { m_type = TYPE_EATO; m_player_range = 1000; m_pos_z = 0.087f; m_can_be_on_ground = 0; Set_Rotation_Affects_Rect(1); m_fire_resistant = 1; m_state = STA_STAY; Set_Image_Dir("enemy/eato/brown/"); Set_Direction(DIR_UP_LEFT); m_kill_sound = "enemy/eato/die.ogg"; m_kill_points = 150; }
cFlyon::cFlyon(XmlAttributes& attributes, cSprite_Manager* sprite_manager) : cEnemy(sprite_manager) { cFlyon::Init(); // position Set_Pos(string_to_float(attributes["posx"]), string_to_float(attributes["posy"]), true); // image directory Set_Image_Dir(utf8_to_path(attributes.fetch("image_dir", path_to_utf8(m_img_dir)))); // direction Set_Direction(Get_Direction_Id(attributes.fetch("direction", Get_Direction_Name(m_start_direction)))); // max distance Set_Max_Distance(string_to_int(attributes.fetch("max_distance", int_to_string(m_max_distance)))); // speed Set_Speed(string_to_float(attributes.fetch("speed", float_to_string(m_speed)))); }
void cFlyon::Init(void) { m_type = TYPE_FLYON; m_name = "Flyon"; m_pos_z = 0.06f; Set_Rotation_Affects_Rect(1); m_editor_pos_z = 0.089f; m_camera_range = 1000; m_can_be_on_ground = 0; m_can_be_ground = 0; m_state = STA_STAY; Set_Direction(DIR_UP); Set_Image_Dir(utf8_to_path("enemy/flyon/orange/")); Set_Max_Distance(200); Set_Speed(5.8f); m_kill_sound = "enemy/flyon/die.ogg"; m_kill_points = 100; m_wait_time = Get_Random_Float(0.0f, 70.0f); m_move_back = 0; }