xml
I had to work most of the time since the competition started but the next few days are dedicated for pure pyweek Added some selectable options on the title screen, including a function to scan any available level files and let you choose one Wrote most of the class to load a level xml file and parse it Still using a hardcoded test level, need to switch it to the new xml format to test it out Next ----- Render the loaded xml level Add collision code for loaded objects and platforms Create a level editor for the xml files then can start adding enemies, objects and possibly objectives(log in to comment)
Comments
My only other experience with xml is the PHP library for it, which can parse Xpath expressions, I like that a bit more.
I worked a little more before sleeping and got it parsing and rendering the test level to the screen
Working on collision code now cause whatever I did last night is completely buggy
xml file: -------------- <root> <a> <b attr="xyz">abc</b> <c attr="abc">def</c> </a> </root> ----------------------- and in your code, something like: ------------------------------ from lxml import etree tree = etree.parse('./level.xml') b = tree.xpath('/root/a/b/text()') c_attr = tree.xpath('/root/a/c/@attr') ------------------------------- cheers!
richard on 2007/09/05 11:47:
Sounds like good progress!