public WorldmapSector(string Filename)
    {
        List WorldMapL = Util.Load(Filename, "supertux-worldmap");

        LispIterator iter = new LispIterator(WorldMapL);
        while(iter.MoveNext()) {
            switch(iter.Key) {
                case "properties":
                    Properties Props = new Properties(iter.List);
                    Props.Get("name", ref Name);
                    Props.Get("music", ref Music);
                    Console.WriteLine("Name: " + Name);
                    Console.WriteLine("Music: " + Music);
                    Props.PrintUnusedWarnings();
                    break;
                case "spawnpoint":
                    WorldmapSpawnPoint SpawnPoint = new WorldmapSpawnPoint();
                    SpawnPoint.Parse(iter.List);
                    SpawnPoints.Add(SpawnPoint.Name, SpawnPoint);
                    break;
                default:
                    GameObject Object = ParseObject(iter.Key, iter.List);
                    if(Object != null)
                        AddObject(Object);
                    break;
            }
        }

        Player = new WorldmapTux(this);
        AddObject(Player);
        Spawn("default");
    }
예제 #2
0
    public void Load(string Filename)
    {
        List levelLisp = Util.Load(Filename, "supertux-level");

        Properties props = new Properties(levelLisp);
        int version = 1;
        props.Get("version", ref version);
        if(version == 1)
            throw new Exception("Old Level format not supported");
        if(version > 2)
            Console.WriteLine("Warning: Level Format newer than application");

        props.Get("name", ref Name);
        props.Get("author", ref Author);

        LispIterator iter = new LispIterator(levelLisp);
        while(iter.MoveNext()) {
            switch(iter.Key) {
                case "sector":
                    Sector sector = new Sector();
                    sector.Parse(this, iter.List);
                    break;
                default:
                    Console.WriteLine("Ignoring unknown tag '" + iter.Key + "' in level");
                    break;
            }
        }
    }
예제 #3
0
    public void Parse(Level Level, List list)
    {
        this.Level = Level;

        Properties props = new Properties(list);
        props.Get("name", ref Name);
        props.Get("music", ref Music);
        props.Get("gravity", ref Gravity);

        LispIterator iter = new LispIterator(list);
        while(iter.MoveNext()) {
            switch(iter.Key) {
                case "spawnpoint":
                    SpawnPoint SpawnPoint = new SpawnPoint();
                    SpawnPoint.Parse(iter.List);
                    SpawnPoints.Add(SpawnPoint.Name, SpawnPoint);
                    break;
                default:
                    GameObject Object = ParseObject(iter.Key, iter.List);
                    if(Object != null)
                        AddObject(Object);
                    break;
            }
        }
    }
예제 #4
0
 public SpriteData(List Data, string BaseDir)
 {
     LispIterator iter = new LispIterator(Data);
     while(iter.MoveNext()) {
     if(iter.Key == "action") {
         Action Action = new Action(iter.List, BaseDir, this);
         Actions.Add(Action.Name, Action);
     } else {
         Console.WriteLine("Unknown tag in sprite: " + iter.Key);
     }
     }
 }