I'm currently writing the Level class for our game and has the following structure so far:
public string name; //level name
public List<List<Vector2>> playerClip; //List of lists of coordinates for all player clip
public List<Vector2> magnets; //list of magnets throughout level
public Vector2 magnetHead; //initial magnet head spawn
public Vector2 playerSpawn; //initial player spawn
Serializing this object into XNA intermediate format looks something like this:
<?xml version="1.0" encoding="utf-8" ?>
<XnaContent>
<Asset Type="DataTypes.Level">
<name>TestLevel</name>
<playerClip>
<Item>x y x y....</Item>
<Item>x y x y...</Item>
</playerClip>
<magnets>x y x y...</magnets>
<magnetHead>x y</magnetHead>
<playerSpawn>x y </playerSpawn>
</Asset>
</XnaContent>
Yeah, Vector2's are space-seperated (who does that?) and a List within a List is stored in separate bins tagged with <Item>. It also 'compiles' the xml files, just checking for any syntax errors at compile time. Yeah, it's....odd.
No comments:
Post a Comment