Example #1
0
        internal void reloadMap()
        {
            removeAllChildren();

            int i = 0;

            for (int y = (int)playerRegion.Y - 1; y <= (int)playerRegion.Y + 1; y++)
            {
                for (int x = (int)playerRegion.X - 1; x <= (int)playerRegion.X + 1; x++)
                {
                    TiledMap chunk = new TiledMap(x, y);
                    chunks[i++] = chunk;
                }
            }

            addChunks();
        }
Example #2
0
        void loadW()
        {
            chunks[6].removeFromParent();
            chunks[7].removeFromParent();
            chunks[8].removeFromParent();

            chunks[6] = chunks[3];
            chunks[7] = chunks[4];
            chunks[8] = chunks[5];

            chunks[3] = chunks[0];
            chunks[4] = chunks[1];
            chunks[5] = chunks[2];

            chunks[0] = new TiledMap(loadedRegion.X - 1, loadedRegion.Y - 1);
            chunks[1] = new TiledMap(loadedRegion.X + 0, loadedRegion.Y - 1);
            chunks[2] = new TiledMap(loadedRegion.X + 1, loadedRegion.Y - 1);

            addChunks();
        }