PDA

View Full Version : [AS2] Just a general question


ImOnCloudNine69
04-19-2009, 04:28 AM
Hey all. So i have a game, and it all works fine and what not. anyways it has a large amount of enemies that come after you. right now i keep track the the enemy starting positions and ending positions in a notpad file which i read into arrays. anyways. i have no idea if this is the most effective way, also with all games, you get a mass amount of enemies and obviously if they come at the same time each time, when they come is set in advance. im wondering how you would go about keeping track of hundreds of enemies start times and how you would call the function that would load in an move the enemy?

i dont neccisarily need specific code, just an idea of what to look into. XML is something i havnt even looked at, but i keep seeing questions about it, im not sure if thats an option.

im a begginer to AS, any help/ideas are really appreciated. thanks.

rrh
04-21-2009, 03:44 PM
I like the XML parsing tools in AS3 better than in AS2.

If you're going to do a lot with level editing, you might want to make a level editor that will output XML.

I've also made a game where levels were defined by a series of .push() statements that pushed the elements into an array. Then I could throw in the occasional bit where a pile of enemies were pushed into the array with positions dictated by a math formula or a random range.

I also made one where I edited the levels in Flash itself, and then put something in the constructor that looped through all the children and turned it into a level.

So, I guess there's a lot of ways to do it, and what makes sense to you is the most important rule.

bluemagica
04-22-2009, 06:58 AM
what makes sense to you is the most important rule.
Lol yeh, that's the main thing! every programmer has his own way of doing things....just do whatever you are most comfortable with! However, generally i try to create a formula/algorithm when dealing with these types of situation! Just think, if you are placing hundreds of instances, which are not just randomly placed, then there must be a pattern to this placing, and if theres a pattern, there will be rules defining it! If you can figure out these rules, the program can do all the thinking for you!

Also if you are working with as3, and do not need to store levels or data after game is published(i.e you don't need MySql)....xml would be the best choice.