Example #1
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 #2
0
        public TMXIsoVertexZ()
        {
            CCTMXTiledMap map = new CCTMXTiledMap("TileMaps/iso-test-vertexz");
            AddChild(map, 0, kTagTileMap);

            CCSize s = map.ContentSize;
            map.Position = new CCPoint(-s.Width / 2, 0);

            // 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(new CCPoint(29, 29));

            CCMoveBy move = new CCMoveBy (10, new CCPoint(300, 250) * (1f / CCMacros.CCContentScaleFactor()));
            CCFiniteTimeAction back = move.Reverse();
            CCSequence seq = new CCSequence(move, back);
            m_tamara.RunAction(new CCRepeatForever (seq));

            Schedule(repositionSprite);
        }
Example #3
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 #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 seq0 = new CCSequence(move, rotate, scale, opacity, fadein, scaleback, finish);
            var seq1 = (CCActionInterval) (seq0.Copy());
            var seq2 = (CCActionInterval) (seq0.Copy());
            var seq3 = (CCActionInterval) (seq0.Copy());

            tile0.RunAction(seq0);
            tile1.RunAction(seq1);
            tile2.RunAction(seq2);
            tile3.RunAction(seq3);


            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 TMXOrthoTest4()
        {
            CCTMXTiledMap map = new CCTMXTiledMap("TileMaps/orthogonal-test4");
            AddChild(map, 0, kTagTileMap);

            /*
            CCArray* pChildrenArray = map.getChildren();
            CCSpriteBatchNode* child = NULL;
            object* pObject = NULL;
            CCARRAY_FOREACH(pChildrenArray, pObject)
            {
                child = (CCSpriteBatchNode*) pObject;

                if (!child)
                    break;

                child.Texture.setAntiAliasTexParameters();
            }
            */

            map.AnchorPoint = (new CCPoint(0, 0));

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

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

            Schedule(removeSprite, 2);
        }
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 = (new CCPoint(0, 0));
            CCTMXLayer layer = map.LayerNamed("Tile Layer 1");
            layer.SetTileGID(3, new CCPoint(2, 2));
        }
Example #7
0
        public TMXOrthoVertexZ()
        {
            CCTMXTiledMap map = new CCTMXTiledMap("TileMaps/orthogonal-test-vertexz");
            AddChild(map, 0, kTagTileMap);

            CCSize s = map.ContentSize;

            // 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(new CCPoint(0, 11));
            CCLog.Log("tamara vertexZ: {0}", m_tamara.VertexZ);

            CCMoveBy move = new CCMoveBy (10, new CCPoint(400, 450) * (1f / CCMacros.CCContentScaleFactor()));
            CCFiniteTimeAction back = move.Reverse();
            CCSequence seq = new CCSequence(move, back);
            m_tamara.RunAction(new CCRepeatForever (seq));

            Schedule(repositionSprite);
        }