Got tired of moving the tracks around manually to test different scenarios. Knew I would have to make a tile-based level-editor eventually... maybe someday, this will be a fun part of the game too: making one's own maps to play on. I use external XML files to store the saved maps and load them in when it's time to play. That was totally new to me, and took some learnin'.
Here, as a key example, is a line of code that collects the contents of any tags named "T" in the whole XML document and puts them into an ordered list called "types". My program then refers to the list when deciding what track to put at what square. Handy!
Here, as a key example, is a line of code that collects the contents of any tags named "T" in the whole XML document and puts them into an ordered list called "types". My program then refers to the list when deciding what track to put at what square. Handy!
string[] types = xmlDoc.Descendants("T").Select(element => element.Value).ToArray();
About 400 lines of code for the map maker, 200 for the train motion so far. As we learned on Starbounder, working out a good user interface is much harder than the actual game.
53 hours in.

No comments:
Post a Comment