开发者

Get symbols placed on stage before runtime in array form?

I am doing a project that deals with pathfinding and other AI algorithms. I am creating a city for the AI to navigate through and I wanted to no if I add all the symbols to the stage before runtime and set it up is there a way I can access all of these symbols either in an array that the stage holds. I would like to have开发者_如何学C the AI avoid them and I just figured it would save me some time if I could do it this way instead of coding the placement of 50+ items.


My recommendation : put your placement of objects inside an xml or json file. Then load that file, parse it, and place your objects on the stage based on the values (x, y, etc.) of the items in their respective xml node.

You could have something similar to :

<map level="1">
    <enemy name="enemy1" x="100" y="100"></enemy>
    <enemy name="enemy2" x="150" y="100"></enemy>
    <enemy name="enemy3" x="200" y="100"></enemy>
    <enemy name="enemy4" x="250" y="100"></enemy>
</map>

And then, if you want to change your level, just load up a new map. Try ogmoeditor for creating a level.

Drag-and-dropping by hand is good for the first level... It gets tedious if you want to make 10 levels.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜