Пример #1
0
        /**
         * Called by <code>FlxGame</code> to set up <code>FlxG</code> during <code>FlxGame</code>'s constructor.
         */
        static internal void setGameData(FlxGame Game, int Width, int Height)
        {
            _game  = Game;
            width  = Width;
            height = Height;

            _mute   = false;
            _volume = 0.5f;

            FlxG.camera = new FlxCamera();

            FlxG.camera.unfollow();

            level = 0;
            score = 0;

            pause        = false;
            timeScale    = 1.0f;
            maxElapsed   = 0.0333f;
            FlxG.elapsed = 0;
            showBounds   = false;
#if !WINDOWS_PHONE
            mobile = false;
#else
            mobile = true;
#endif
            FlxU.setWorldBounds(0, 0, FlxG.width, FlxG.height);
        }
Пример #2
0
 /// <summary>
 /// Specify the boundaries of the level or where the camera is allowed to move.
 /// </summary>
 /// <param name="MinX">The smallest X value of your level (usually 0).</param>
 /// <param name="MinY">The smallest Y value of your level (usually 0).</param>
 /// <param name="MaxX">The largest X value of your level (usually the level width).</param>
 /// <param name="MaxY">The largest Y value of your level (usually the level height).</param>
 /// <param name="UpdateWorldBounds">Whether the quad tree's dimensions should be updated to match.</param>
 static public void followBounds(int MinX, int MinY, int MaxX, int MaxY, bool UpdateWorldBounds)
 {
     followMin = new Point(-MinX, -MinY);
     followMax = new Point(-MaxX + width, -MaxY + height);
     if (followMax.X > followMin.X)
     {
         followMax.X = followMin.X;
     }
     if (followMax.Y > followMin.Y)
     {
         followMax.Y = followMin.Y;
     }
     if (UpdateWorldBounds)
     {
         FlxU.setWorldBounds(MinX, MinY, MaxX - MinX, MaxY - MinY);
     }
     doFollow();
 }