Without loading from any external files, does anyone have any suggestions as to what the best way to store a large amount of enemies' stats, name, skills, et cetera?
Printable View
Without loading from any external files, does anyone have any suggestions as to what the best way to store a large amount of enemies' stats, name, skills, et cetera?
xml?
I thought XML was only used by loading external files, am I incorrect in that assumption? I can't seem to find any examples of XML within AS files...
save where?,- if its on the internet perhaps better inside a databse like using mySql /php and flash. Or in combination AMFphp.
XML would be my choise as well if its just offline and local- because its easier to handle alone with flash.
If you are using flex you can embed xmls in your swf.
If you are using cs3, you have to create a .as containing the data. It should be possible to create a string containing the Xml data in this class.
Personally I try to keep every server side, so preferably, I'd go with a single Data class of sorts with a look up table embedded therein. If that wasn't an option (like you wanted longer-term saving) I'd go with php/MySQL 100%.
If you're storing it internally ( External xml would be a lot better, that's why everyone's mentioned it already ) and not using as3 then just store them as objects and shove them in an external .as file(s)
Squize.
TELL ME TELL ME TELL ME pleeeese how to do this :DQuote:
Originally Posted by Sietjp
Ive recently moved to flex for my dev environment and I will never go back... its awesome... now If I can learn how to embed all my xml data inline... my life will be somehow complete....
You can use this
or also the embed tag I thinkPHP Code:<mx:XML id="xmlSource" source="data.xml"/>
PHP Code:[Embed(source="data.xml")]
I would probably make an associative array and fill it with Enemies.
You know make a Enemy class with the properties you need like HP, ATTACK, etc.
enemies["imp"] = new Enemy("Imp", 100, 10, 300);
Simple and beautiful :p and useful because you can extend the Enemy class further and get everything needed with one line from the array.
I decided to go with XML for now, as it seems to do the job. Currently it's being loaded from an external file but I'm curious just for hypothetical(if I were to EVER finish a game) and I wanted to upload to a site like newgrounds, I presume they don't accept xml files separately, so my xml would have to be in a dedicated location and I'm curious if that's true, would I have to worry about bandwidth? (not that I'm saying my game would be so awesome that I'd have billions of views, just curious if its something one would have to take into consideration)
Anyways, thanks for all the input, feel free to continue discussing!
ChaseNYC
if the server is crap,- just upload the xml on your server. Be sure though to add the server policy XML file too otherwise you can't load data from other servers.