xml/stage1.xml
Code: Select all
<?xml version="1.0" encoding="UTF-8"?>
<root name="stage1">
<background>
<image>Mountains_And_Sky.png</image>
<x>52</x>
<y>21</y>
</background>
</root>xml_loader.pi
We have to take care with the 'TAG_NAME_' coded in xml_loader.pi
Code: Select all
properties:
TAG_NAME_LIST = "list";
TAG_NAME_TEXT = "text";source : viewtopic.php?f=4&t=496
test.pi
We have to use the same 'TAG_NAME_' coded in xml_loader, when the mapped object (_data) is accessed to extract the information.
Code: Select all
//-----------------------------------------------------------------------------
// XMLTest Script
// based on
// TMX_Loader by Alberto De Hoyo Nebot
// VR-Script modifications: Javi
//-----------------------------------------------------------------------------
class XMLTest implements DOS_Program
{
virtual Start()
{
xml_loader = new XML_Loader();
_ok = xml_loader.Load(GetEngine(), "xml/stage1.xml", this);
delete xml_loader;
End(0);
::Start();
}
function AddActor(console, _data)
{
_root = _data.rootList[0];
_name = _root.name;
_background = _root.backgroundList[0];
_filename = _background.imageText;
_x = _background.xText;
_y = _background.yText;
console.PrintLn("root name = " + _name);
console.PrintLn("filename = " + _filename);
console.PrintLn("x = " + _x);
console.PrintLn("y = " + _y);
console.Input("", null, 1);
return true;
}
}