Ejemplo n.º 1
0
        public static CCPoint GetTilePosition(CCTMXTiledMap tileMap, string tileName)
        {
            CCTMXObjectGroup objectGroup = tileMap.ObjectGroupNamed("Objects");
            if (objectGroup == null)
            {
                CCLog("tile map has no objects object layer");
                return CCPoint.Zero;
            }

            var spawnPoint = objectGroup.ObjectNamed(tileName);
            string x;
            spawnPoint.TryGetValue("x", out x);
            string y;
            spawnPoint.TryGetValue("y", out y);

            return new CCPoint((float)Convert.ToDouble(x), (float)Convert.ToDouble(y));
        }
Ejemplo n.º 2
0
        private void InitializeTileMap()
        {
            _tileMap = new CCTMXTiledMap("TileMap.tmx");
            _background = _tileMap.LayerNamed("Background");
            _foreground = _tileMap.LayerNamed("Foreground");

            _meta = _tileMap.LayerNamed("Meta");

            AddChild(_tileMap, -5);

            CCTMXObjectGroup objectGroup = _tileMap.ObjectGroupNamed("Objects");
            if (objectGroup == null)
            {
                CCLog("tile map has no objects object layer");
            }

            var spawnPoint = objectGroup.ObjectNamed("SpawnPoint");

            int x = int.Parse(spawnPoint["x"]);//.intValue();
            int y = int.Parse(spawnPoint["y"]); //spawnPoint->valueForKey("y")).intValue();
        }