Example #1
0
        public TMXTilesetTest()
        {
            CCTMXTiledMap map = new CCTMXTiledMap("TileMaps/orthogonal-test5");

            AddChild(map, 0, kTagTileMap);

            CCSize s = map.ContentSize;

            CCTMXLayer layer;

            layer = map.LayerNamed("Layer 0");
            layer.IsAntialiased = true;

            layer = map.LayerNamed("Layer 1");
            layer.IsAntialiased = true;

            layer = map.LayerNamed("Layer 2");
            layer.IsAntialiased = true;
        }
Example #2
0
        public TMXIsoVertexZ()
        {
            map = new CCTMXTiledMap("TileMaps/iso-test-vertexz");
            AddChild(map, 0, kTagTileMap);

            // because I'm lazy, I'm reusing a tile as an sprite, but since this method uses vertexZ, you
            // can use any CCSprite and it will work OK.
            CCTMXLayer layer = map.LayerNamed("Trees");

            m_tamara = layer.TileAt(29, 29);
        }
Example #3
0
        public TMXOrthoVertexZ()
        {
            CCTMXTiledMap map = new CCTMXTiledMap("TileMaps/orthogonal-test-vertexz");

            AddChild(map, 0, kTagTileMap);

            // because I'm lazy, I'm reusing a tile as an sprite, but since this method uses vertexZ, you
            // can use any CCSprite and it will work OK.
            CCTMXLayer layer = map.LayerNamed("trees");

            m_tamara = layer.TileAt(0, 11);
            CCLog.Log("tamara vertexZ: {0}", m_tamara.VertexZ);
        }
Example #4
0
        public TMXReadWriteTest()
        {
            m_gid = 0;

            CCTMXTiledMap map = new CCTMXTiledMap("TileMaps/orthogonal-test2");

            AddChild(map, 0, kTagTileMap);

            CCTMXLayer layer = map.LayerNamed("Layer 0");

            layer.IsAntialiased = true;

            map.Scale = (1);

            CCSprite tile0 = layer.TileAt(new CCPoint(1, 63));
            CCSprite tile1 = layer.TileAt(new CCPoint(2, 63));
            CCSprite tile2 = layer.TileAt(new CCPoint(3, 62)); //new CCPoint(1,62));
            CCSprite tile3 = layer.TileAt(new CCPoint(2, 62));

            tile0.AnchorPoint = (new CCPoint(0.5f, 0.5f));
            tile1.AnchorPoint = (new CCPoint(0.5f, 0.5f));
            tile2.AnchorPoint = (new CCPoint(0.5f, 0.5f));
            tile3.AnchorPoint = (new CCPoint(0.5f, 0.5f));

            CCMoveBy    move      = new CCMoveBy(0.5f, new CCPoint(0, 160));
            CCRotateBy  rotate    = new CCRotateBy(2, 360);
            CCScaleBy   scale     = new CCScaleBy(2, 5);
            CCFadeOut   opacity   = new CCFadeOut(2);
            CCFadeIn    fadein    = new CCFadeIn(2);
            CCScaleTo   scaleback = new CCScaleTo(1, 1);
            CCCallFuncN finish    = new CCCallFuncN(removeSprite);
            CCSequence  sequence  = new CCSequence(move, rotate, scale, opacity, fadein, scaleback, finish);

            tile0.RunAction(sequence);
            tile1.RunAction(sequence);
            tile2.RunAction(sequence);
            tile3.RunAction(sequence);


            m_gid = layer.TileGIDAt(new CCPoint(0, 63));
            ////----UXLOG("Tile GID at:(0,63) is: %d", m_gid);

            Schedule(updateCol, 2.0f);
            Schedule(repaintWithGID, 2.0f);
            Schedule(removeTiles, 1.0f);

            ////----UXLOG("++++atlas quantity: %d", layer.textureAtlas().getTotalQuads());
            ////----UXLOG("++++children: %d", layer.getChildren().count() );

            m_gid2 = 0;
        }
Example #5
0
        public TMXResizeTest()
        {
            CCTMXTiledMap map = new CCTMXTiledMap("TileMaps/orthogonal-test5");

            AddChild(map, 0, kTagTileMap);

            CCSize s = map.ContentSize;

            CCTMXLayer layer;

            layer = map.LayerNamed("Layer 0");

            CCSize ls = layer.LayerSize;

            for (uint y = 0; y < ls.Height; y++)
            {
                for (uint x = 0; x < ls.Width; x++)
                {
                    layer.SetTileGID(1, new CCPoint(x, y));
                }
            }
        }
Example #6
0
        public TMXBug987()
        {
            CCTMXTiledMap map = new CCTMXTiledMap("TileMaps/orthogonal-test6");

            AddChild(map, 0, kTagTileMap);

            /*
             * CCArray* childs = map.getChildren();
             * CCTMXLayer* node;
             * object* pObject = NULL;
             * CCARRAY_FOREACH(childs, pObject)
             * {
             *  node = (CCTMXLayer*) pObject;
             *  CC_BREAK_IF(!node);
             *  node.Texture.setAntiAliasTexParameters();
             * }
             */

            map.AnchorPoint = CCPoint.AnchorLowerLeft;
            CCTMXLayer layer = map.LayerNamed("Tile Layer 1");

            layer.SetTileGID(3, new CCPoint(2, 2));
        }
Example #7
0
        public TMXOrthoTest4()
        {
            CCTMXTiledMap map = new CCTMXTiledMap("TileMaps/orthogonal-test4");

            AddChild(map, 0, kTagTileMap);

            map.AnchorPoint = CCPoint.AnchorLowerLeft;

            CCTMXLayer layer = map.LayerNamed("Layer 0");
            CCSize     s     = layer.LayerSize;

            CCSprite sprite;

            sprite       = layer.TileAt(0, 0);
            sprite.Scale = 2;
            sprite       = layer.TileAt(s.Width - 1, 0);
            sprite.Scale = 2;
            sprite       = layer.TileAt(0, s.Height - 1);
            sprite.Scale = 2;
            sprite       = layer.TileAt(s.Width - 1, s.Height - 1);
            sprite.Scale = 2;

            Schedule(removeSprite, 2);
        }