Пример #1
0
        /// <summary>
        /// An internal function used by the binary auto-tilers.
        /// </summary>
        /// <param name="Index">The index of the tile you want to analyze.</param>
        protected void autoTileWithRemap(int Index)
        {
            if (_data[Index] == 0)
            {
                return;
            }
            _data[Index] = 0;
            if ((Index - widthInTiles < 0) || (_data[Index - widthInTiles] > 0))                //UP
            {
                _data[Index] += 1;
            }
            if ((Index % widthInTiles >= widthInTiles - 1) || (_data[Index + 1] > 0))           //RIGHT
            {
                _data[Index] += 2;
            }
            if ((Index + widthInTiles >= totalTiles) || (_data[Index + widthInTiles] > 0)) //DOWN
            {
                _data[Index] += 4;
            }
            if ((Index % widthInTiles <= 0) || (_data[Index - 1] > 0))                                  //LEFT
            {
                _data[Index] += 8;
            }
            if ((auto == REMAPALT) && (_data[Index] == 15))     //The alternate algo checks for interior corners
            {
                if ((Index % widthInTiles > 0) && (Index + widthInTiles < totalTiles) && (_data[Index + widthInTiles - 1] <= 0))
                {
                    _data[Index] = 1;           //BOTTOM LEFT OPEN
                }
                if ((Index % widthInTiles > 0) && (Index - widthInTiles >= 0) && (_data[Index - widthInTiles - 1] <= 0))
                {
                    _data[Index] = 2;           //TOP LEFT OPEN
                }
                if ((Index % widthInTiles < widthInTiles - 1) && (Index - widthInTiles >= 0) && (_data[Index - widthInTiles + 1] <= 0))
                {
                    _data[Index] = 4;           //TOP RIGHT OPEN
                }
                if ((Index % widthInTiles < widthInTiles - 1) && (Index + widthInTiles < totalTiles) && (_data[Index + widthInTiles + 1] <= 0))
                {
                    _data[Index] = 8;           //BOTTOM RIGHT OPEN
                }
            }


            if (remapGuide.ContainsKey(_data[Index]))
            {
                int count = FlxU.randomInt(0, remapGuide[_data[Index]].Length - 1);


                _data[Index] = remapGuide[_data[Index]][count];
            }
            else
            {
                _data[Index] = remapGuide[0][0];
            }
            _data[Index] += 1;
        }
Пример #2
0
        /// <summary>
        /// Get a position of any tile that matches Tiles
        /// </summary>
        /// <param name="Tiles">Provide an array of tiles you want to match.</param>
        /// <returns></returns>
        public Vector2 getRandomTilePositionWithType(int[] Tiles)
        {
            int[] empties = remapGuide[15];
            int   rx      = FlxU.randomInt(0, widthInTiles);
            int   ry      = FlxU.randomInt(0, heightInTiles);
            int   rz      = getTile(rx, ry);

            while (empties.Contains(rz) == false)
            {
                rx = FlxU.randomInt(0, widthInTiles);
                ry = FlxU.randomInt(0, heightInTiles);

                rz = getTile(rx, ry);
            }

            return(new Vector2(rx * _tileWidth, ry * _tileHeight));
        }
Пример #3
0
        /// <summary>
        /// Get a random tile with the type you specify.
        /// </summary>
        /// <param name="Tiles">Array of tiles you want to search for.</param>
        /// <returns></returns>
        public int getRandomTileWithType(int[] Tiles)
        {
            int[] empties = remapGuide[15];
            int   rx      = FlxU.randomInt(0, widthInTiles);
            int   ry      = FlxU.randomInt(0, heightInTiles);
            int   rz      = getTile(rx, ry);

            while (empties.Contains(rz) == false)
            {
                rx = FlxU.randomInt(0, widthInTiles);
                ry = FlxU.randomInt(0, heightInTiles);

                rz = getTile(rx, ry);
            }

            return(rz);
        }
Пример #4
0
        public override void create()
        {
            base.create();

            FlxSprite bg = new FlxSprite(0, 0);

            bg.createGraphic(FlxG.width, FlxG.height, FlxG.splashBGColor);
            add(bg);

            _f         = null;
            _poweredBy = FlxG.Content.Load <Texture2D>("flixel/poweredby");
            _fSound    = FlxG.Content.Load <SoundEffect>(FlxG.splashAudioWaveFlixel);

            _initialsLogo = FlxG.Content.Load <Texture2D>(FlxG.splashLogo);

            //_logo = new FlxSprite();
            //_logo.loadGraphic(_initialsLogo, false, false, 216,24);
            //_logo.x = FlxG.width / 2 - 216 / 2;
            //_logo.y = FlxG.height / 2 - 24;
            //add(_logo);

            logoParts = new FlxGroup();

            for (int i = 0; i < 18; i++)
            {
                for (int j = 0; j < 2; j++)
                {
                    _logo = new FlxLogoSprite(i, j);
                    _logo.loadGraphic(_initialsLogo, false, false, 12, 12);
                    _logo.x = (FlxG.width / 2 - 216 / 2) + (i * 12);
                    _logo.y = (FlxG.height / 2 - 24) + (j * 12);
                    _logo.addAnimation("bugs", new int[] { 0, 1, 2, FlxU.randomInt(0, 24), FlxU.randomInt(0, 24), FlxU.randomInt(0, 24), FlxU.randomInt(0, 24), FlxU.randomInt(0, 24), FlxU.randomInt(0, 24), FlxU.randomInt(0, 24), FlxU.randomInt(0, 24), FlxU.randomInt(0, 24), FlxU.randomInt(0, 24), FlxU.randomInt(0, 24), FlxU.randomInt(0, 24), FlxU.randomInt(0, 24), FlxU.randomInt(0, 24), FlxU.randomInt(0, 24),
                                                           (j * 18) + i }, FlxU.randomInt(12, 18), false);

                    _logo.addAnimation("bugs2", new int[] { 0, 1, 2, FlxU.randomInt(0, 24), FlxU.randomInt(0, 24), FlxU.randomInt(0, 24), FlxU.randomInt(0, 24), FlxU.randomInt(0, 24), FlxU.randomInt(0, 24), FlxU.randomInt(0, 24), FlxU.randomInt(0, 24), FlxU.randomInt(0, 24), FlxU.randomInt(0, 24), FlxU.randomInt(0, 24), FlxU.randomInt(0, 24), FlxU.randomInt(0, 24), FlxU.randomInt(0, 24), FlxU.randomInt(0, 24),
                                                            0 }, FlxU.randomInt(18, 24), false);

                    _logo.play("bugs");
                    logoParts.add(_logo);

                    float offset = 25.0f;
                    if (j >= 1)
                    {
                        offset *= -1.0f;
                    }
                    _logo.t = new Tweener((float)(_logo.y + offset), (float)_logo.y, 0.25f + (i / 18.0f), XNATweener.Quadratic.EaseInOut);
                    _logo.t.Start();
                }
            }
            add(logoParts);


            _logoTweener = new Tweener(-150, FlxG.height / 2 - 24, TimeSpan.FromSeconds(0.9f), Bounce.EaseOut);

            SndTag = FlxG.splashAudioWave;
            //FlxG.play(SndTag,1.0f);



            debugMode         = new FlxText(10, 90, 200, "DEBUG MODE!");
            debugMode.visible = false;
            add(debugMode);

            Console.WriteLine(" !!! Type {0} To Enter Debug Mode !!! ", FlxGlobal.titleScreenDebugMode);
        }