Hundreds of features to explore
Games made in Construct
Your questions answered
Popular & trusted by schools and Universities world-wide
Construct 3 runs in the browser & works offline
Students do not need accounts with us
Our educational partners
Free education resources to use in the classroom
World class complete documentation
Official and community submitted guides
Learn and share with other game developers
Upload and play games from the Construct community
Game development stories & opinions
Hey guys Id like to know how do I create objects with xml files.
XML Code
"<?xml version=""1.0""?> <build> <xpos>500</xpos> <ypos>500</ypos> </build> <build> <xpos>100</xpos> <ypos>200</ypos> </build> " [/code:187dx0xk] [b]The event[/b] [img="http://4.ii.gl/KcSqaN_vP.png"] [b]This are the result of this code & event.[/b] [img="http://1.ii.gl/-UWmBSaPJ.jpg"] [b]I was expecting to get this result but it fail.[/b] [img="http://3.ii.gl/ELKktlbf.jpg"] Please guide me to set things right.
You need a root element. You can only have one root element in an XML file.
"<?xml version=""1.0""?> <builds> <build> <xpos>500</xpos> <ypos>500</ypos> </build> <build> <xpos>100</xpos> <ypos>200</ypos> </build> </builds> " [/code:a3ah0qg7]
ramones Thank you for that. I fixed it with this code
"<?xml version=""1.0""?> <object> <build id=""0""> <xpos>250</xpos> <ypos>250</ypos> </build> <build id=""1""> <xpos>350</xpos> <ypos>250</ypos> </build> </object>" [/code:16q6eh65] Now I'm trying to assign the [b]object instant variable[/b] with the build id in the code above and the event below. Its not working. [img="http://4.ii.gl/T1nAIsK-.jpg"]
Develop games in your browser. Powerful, performant & highly capable.
Set oid to XML.NumberValue("@id") and put that just below the "create object Sprite" action.
Also for it to work in IE you'd need to use "xpos/text()" and "ypos/text()".