internal void loadMap(string mapName) { this.clearMap(); this.LoadTMX("Maps/" + mapName); tilemap = (FTilemap)(getLayerNamed("Tilemap")); for (int x = 0; x < 3; x++) { otherTilemaps[x] = new FTilemap(tilemap.BaseElementName + "_" + (x + 1), 1); otherTilemaps[x].LoadText(tilemap.dataString, false); } tilemapCollision = (FTilemap)(getLayerNamed("Meta")); objectGroup = (FContainer)(getLayerNamed("Objects")); foreach (XMLNode xml in this.objects) { switch (xml.attributes["type"]) { case "Spawn": FNode spawnPoint = new FNode(); spawnPoint.SetPosition(int.Parse(xml.attributes["x"]) + 8, -int.Parse(xml.attributes["y"]) + 8); spawnPoints.Add(spawnPoint); player.SetPosition(spawnPoint.GetPosition()); break; case "Warp": int warpX = 0; int warpY = 0; XMLNode propertiesNode = (XMLNode)xml.children[0]; foreach (XMLNode property in propertiesNode.children) { switch (property.attributes["name"]) { case "warpTileX": warpX = int.Parse(property.attributes["value"]); break; case "warpTileY": warpY = int.Parse(property.attributes["value"]); break; } } WarpPoint warpPoint = new WarpPoint(warpX, warpY, xml.attributes["name"], int.Parse(xml.attributes["x"]) + 8, -int.Parse(xml.attributes["y"]) + 8); warpPoints.Add(warpPoint); break; } } for (int x = 0; x < 100; x++) { Scientist s = new Scientist(tilemap.width * RXRandom.Float(), -tilemap.height * RXRandom.Float()); while (BaseGameObject.isWalkable(tilemap, s.x, s.y)) { s.SetPosition(tilemap.width * RXRandom.Float(), -tilemap.height * RXRandom.Float()); } addEnemy(s); } backgroundLayer.AddChild(tilemap); foreach (FTilemap f in otherTilemaps) { backgroundLayer.AddChild(f); } backgroundLayer.AddChild(tilemapCollision); backgroundLayer.AddChild(objectGroup); player.setMap(this); playerLayer.AddChild(player); }