예제 #1
0
 public Vector2 GetPositionInCameraView(FlxCamera camera = null)
 {
     if (camera == null)
     {
         camera = FlxG.Camera;
     }
     return(camera.ViewportAdapter.PointToScreen(ScreenPosition.ToPoint()).ToVector2());
 }
예제 #2
0
        override public void create()
        {
            FlxG.backColor = Color.DarkGreen;

            base.create();

            FlxCamera cam1 = new FlxCamera(0, 0, FlxG.width / 2, FlxG.height, 1);

            cam1.color = Color.Blue;
            FlxG.cameras.Add(cam1);

            FlxCamera cam2 = new FlxCamera(FlxG.width / 2, 0, FlxG.width / 2, FlxG.height, 1);

            cam2.color = Color.GreenYellow;
            FlxG.cameras.Add(cam2);

            FlxTilemap t = new FlxTilemap();

            t.auto = FlxTilemap.AUTO;
            t.loadMap("1,0,1,1,1,1,1,0,0,0,0,0,1,0,1,1,1,1,1,0,0,0,0,0,1,1,0,1,1,1,1,1,0,0,0,0,0,1,0,1,1,1,1,1,0,0,0,0,0,1,1,0,1,1,1,1,1,0,0,0,0,0,1,0,1,1,1,1,1,0,0,0,0,0,1,1,0,1,1,1,1,1,0,0,0,0,0,1,0,1,1,1,1,1,0,0,0,0,0,1\n1,0,1,1,1,1,1,0,0,0,0,0,1,0,1,1,1,1,1,0,0,0,0,0,1,1,0,1,1,1,1,1,0,0,0,0,0,1,0,1,1,1,1,1,0,0,0,0,0,1,1,0,1,1,1,1,1,0,0,0,0,0,1,0,1,1,1,1,1,0,0,0,0,0,1,1,0,1,1,1,1,1,0,0,0,0,0,1,0,1,1,1,1,1,0,0,0,0,0,1\n1,0,1,1,1,1,1,0,0,0,0,0,1,0,1,1,1,1,1,0,0,0,0,0,1,1,0,1,1,1,1,1,0,0,0,0,0,1,0,1,1,1,1,1,0,0,0,0,0,1,1,0,1,1,1,1,1,0,0,0,0,0,1,0,1,1,1,1,1,0,0,0,0,0,1,1,0,1,1,1,1,1,0,0,0,0,0,1,0,1,1,1,1,1,0,0,0,0,0,1\n1,0,1,1,1,1,1,0,0,0,0,0,1,0,1,1,1,1,1,0,0,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0,0,0,0,0,1,1,0,1,1,1,1,1,0,0,0,0,0,1,0,1,1,1,1,1,0,0,0,0,0,1,1,0,1,1,1,1,1,0,0,0,0,0,1,0,1,1,1,1,1,0,0,0,0,0,1\n",
                      FlxG.Content.Load <Texture2D>("flixel/autotiles"),
                      8,
                      8);

            add(t);

            FlxSprite s = new FlxSprite(0, 0, FlxG.Content.Load <Texture2D>("flixel/initials/initialsLogo"));

            add(s);
            s.velocity.X = 150;
            s.velocity.Y = 50;


            FlxG.follow(s, 10.0f);
            FlxG.followBounds(0, 0, 2000, 2000);
        }
예제 #3
0
파일: FlxG.cs 프로젝트: jlorek/flxSharp
        /// <summary>
        /// Remove a camera from the game.
        /// </summary>
        /// <param name="camera">The camera you want to remove.</param>
        /// <param name="destroy">Whether to call destroy() on the camera, default value is true.</param>
        public static void removeCamera(FlxCamera camera, bool destroy = true)
        {
            throw new NotImplementedException();

            /*
            try
            {
                FlxG._game.removeChild(Camera._flashSprite);
            }
            catch(E:Error)
            {
                FlxG.log("Error removing camera, not part of game.");
            }
            if(Destroy)
                Camera.destroy();
            */
        }
예제 #4
0
파일: FlxG.cs 프로젝트: jlorek/flxSharp
        /// <summary>
        /// Add a new camera object to the game.
        /// Handy for PiP, split-screen, etc.
        /// </summary>
        /// <param name="newCamera">The camera you want to add.</param>
        /// <returns>This <code>FlxCamera</code> instance.</returns>
        public static FlxCamera addCamera(FlxCamera newCamera)
        {
            FlxG.cameras.Add(newCamera);

            var newViewport = new Viewport((int)newCamera.X, (int)newCamera.Y, (int)newCamera.Width, (int)newCamera.Height);
            FlxS.Viewports.Add(newViewport);

            //FlxG.log("camera is at x: " + NewCamera.x + " y: " + NewCamera.y + " width: " + NewCamera.width + " height " + NewCamera.height);
            //FlxG.log("camera count: " + FlxG.cameras.Count);

            return newCamera;

            /*
            FlxG._game.addChildAt(NewCamera._flashSprite,FlxG._game.getChildIndex(FlxG._game._mouse));
            FlxG.cameras.push(NewCamera);
            return NewCamera;
            */
        }
예제 #5
0
파일: FlxG.cs 프로젝트: jlorek/flxSharp
        /// <summary>
        /// Called by <code>FlxGame</code> to set up <code>FlxG</code> during <code>FlxGame</code>'s constructor.
        /// </summary>
        internal static void init(FlxGame game, int width, int height, float zoom)
        {
            FlxG._game = game;
            FlxG.width = width;
            FlxG.height = height;

            FlxG.mute = false;
            FlxG.volume = 1.0f;
            FlxG.sounds = new FlxGroup();
            FlxG.volumeHandler = delegate { };

            //FlxG.clearBitmapCache();

            //if(flashGfxSprite == null)
            //{
            //    flashGfxSprite = new Sprite();
            //    flashGfx = flashGfxSprite.graphics;
            //}

            FlxCamera.DefaultZoom = zoom;
            //FlxG._cameraRect = new Rectangle();
            FlxG.cameras = new List<FlxCamera>();
            //FlxG.UseBufferLocking = false;

            FlxG.plugins = new List<FlxBasic>();
            //addPlugin(new DebugPathDisplay());
            //addPlugin(new TimerManager());

            FlxG.mouse = new FlxMouse();
            FlxG.keys = new FlxKeyboard();
            //FlxG.mobile = false;

            FlxG.levels = null;
            FlxG.scores = null;
            FlxG.visualDebug = false;

            // flx# stuff

            FlxG.cameras = new List<FlxCamera>();

            //FlxG.width = FlxG.graphics.PreferredBackBufferWidth;
            //FlxG.height = FlxG.graphics.PreferredBackBufferHeight;
            FlxG.bgColor = Color.Black;
            FlxG.mute = false;
            FlxG.sounds = new FlxGroup();
            FlxG.worldBounds = new FlxRect();
            FlxG.defaultFont = FlxS.ContentManager.Load<SpriteFont>("ConsoleFont");
            //FlxG.zoom = 1f;
            FlxG.pad1 = new FlxGamepad(PlayerIndex.One);
            FlxG.pad2 = new FlxGamepad(PlayerIndex.Two);
            FlxG.pad3 = new FlxGamepad(PlayerIndex.Three);
            FlxG.pad4 = new FlxGamepad(PlayerIndex.Four);
            FlxG.keys = new FlxKeyboard();
            FlxG.mouse = new FlxMouse();
            FlxCamera defaultCam = new FlxCamera(0, 0, FlxG.width, FlxG.height, FlxG.zoom);
            FlxG.addCamera(defaultCam);

            //Thread tCreate = new Thread(FlxG.state.create);
            //tCreate.Start();

            //create state last
            //FlxG.State.create();
        }
예제 #6
0
        /// <summary>
        /// Checks to see if this <code>FlxObject</code> were located at the given position, would it overlap the <code>FlxObject</code> or <code>FlxGroup</code>?
        /// This is distinct from overlapsPoint(), which just checks that point, rather than taking the object's size into account.
        /// WARNING: Currently tilemaps do NOT support screen space overlap checks!
        /// </summary>
        /// <param name="x">The X position you want to check. Pretends this object (the caller, not the parameter) is located here.</param>
        /// <param name="y">The Y position you want to check. Pretends this object (the caller, not the parameter) is located here.</param>
        /// <param name="objectOrGroup">The object or group being tested.</param>
        /// <param name="inScreenSpace">Whether to take scroll factors into account when checking for overlap.  Default is false, or "only compare in world space."</param>
        /// <param name="camera">Specify which game camera you want.  If null getScreenXY() will just grab the first global camera. flx# - currently only one exists</param>
        /// <returns></returns>
        public virtual bool overlapsAt(float x, float y, FlxBasic objectOrGroup, bool inScreenSpace = false, FlxCamera camera = null)
        {
            if (objectOrGroup is FlxGroup)
            {
                bool results = false;
                var group = objectOrGroup as FlxGroup;
                foreach (FlxBasic member in group.Members)
                {
                    if (overlapsAt(x, y, member, inScreenSpace, camera))
                    {
                        results = true;
                        // flx# - we could break here, if overlaps does not trigger anything on the remaining members
                    }
                }

                /*
                int i = 0;List<FlxBasic> members = new List<FlxBasic>();
                members = (objectOrGroup as FlxGroup).members;
                uint length = (uint)members.Count;
                while (i < length)
                {
                        if (overlapsAt(x, y, members[i++], inScreenSpace, camera))
                            results = true;
                }
                */
                return results;
            }

            if (objectOrGroup is FlxTilemap)
            {
                var tilemap = objectOrGroup as FlxTilemap;
                return tilemap.overlapsAt(tilemap.X - (x - this.X), tilemap.Y - (y - this.Y), this, inScreenSpace, camera);
            }

            var flxObject = objectOrGroup as FlxObject;

            if(!inScreenSpace)
            {
                return (flxObject.X + flxObject.Width > x) && (flxObject.X < x + Width) &&
                       (flxObject.Y + flxObject.Height > y) && (flxObject.Y < y + Height);
            }

            if (camera == null)
            {
                camera = FlxG.camera;
            }

            FlxPoint objectScreenPos = flxObject.getScreenXY(null, camera);
            _tagPoint.X = x - camera.Scroll.X * ScrollFactor.X; //copied from getScreenXY()
            _tagPoint.Y = y - camera.Scroll.Y * ScrollFactor.Y;
            _tagPoint.X += (_tagPoint.X > 0) ? 0.0000001f : -0.0000001f;
            _tagPoint.Y += (_tagPoint.Y > 0) ? 0.0000001f : -0.0000001f;

            return (objectScreenPos.X + flxObject.Width > _tagPoint.X) && (objectScreenPos.X < _tagPoint.X + Width) &&
                   (objectScreenPos.Y + flxObject.Height > _tagPoint.Y) && (objectScreenPos.Y < _tagPoint.Y + Height);
        }
예제 #7
0
        /// <summary>
        /// Checks to see if some <code>FlxObject</code> overlaps this <code>FlxObject</code> or <code>FlxGroup</code>.
        /// If the group has a LOT of things in it, it might be faster to use <code>FlxG.overlaps()</code>.
        /// WARNING: Currently tilemaps do NOT support screen space overlap checks!
        /// </summary>
        /// <param name="objectOrGroup">The object or group being tested.</param>
        /// <param name="inScreenSpace">Whether to take scroll factors into account when checking for overlap.  Default is false, or "only compare in world space."</param>
        /// <param name="camera">Specify which game camera you want. If null getScreenXY() will just grab the first global camera. flx# - currently only one exists</param>
        /// <returns></returns>
        public virtual bool overlaps(FlxBasic objectOrGroup, bool inScreenSpace = false, FlxCamera camera = null)
        {
            if(objectOrGroup is FlxGroup)
            {
                bool results = false;
                var group = objectOrGroup as FlxGroup;
                foreach (FlxBasic member in group.Members)
                {
                    if (overlaps(member, inScreenSpace, camera))
                    {
                        results = true;
                        // flx# - we could break here, if overlaps does not trigger anything on the remaining members
                    }
                }

                /*
                int i = 0;
                List<FlxBasic> members = new List<FlxBasic>();
                members = (objectOrGroup as FlxGroup).members;
                //uint l = (uint)(ObjectOrGroup as FlxGroup).length;
                uint length = (uint)members.Count;
                while(i < length)
                {
                    if(overlaps(members[i++],inScreenSpace,camera))
                        results = true;
                }
                */

                return results;
            }

            if (objectOrGroup is FlxTilemap)
            {
                // Since tilemap's have to be the caller, not the target, to do proper tile-based collisions,
                // we redirect the call to the tilemap overlap here.
                return (objectOrGroup as FlxTilemap).overlaps(this, inScreenSpace, camera);
            }

            var flxObject = objectOrGroup as FlxObject;

            if(!inScreenSpace)
            {
                return (flxObject.X + flxObject.Width > X) && (flxObject.X < X + Width) &&
                       (flxObject.Y + flxObject.Height > Y) && (flxObject.Y < Y + Height);
            }

            if (camera == null)
            {
                camera = FlxG.camera;
            }

            FlxPoint objectScreenPos = flxObject.getScreenXY(null, camera);
            getScreenXY(_tagPoint, camera);
            return (objectScreenPos.X + flxObject.Width > _tagPoint.X) && (objectScreenPos.X < _tagPoint.X + Width) &&
                   (objectScreenPos.Y + flxObject.Height > _tagPoint.Y) && (objectScreenPos.Y < _tagPoint.Y + Height);
        }
예제 #8
0
 public void follow(FlxCamera Camera = null, int Border = 0, Boolean UpdateWorld = false)
 {
     if (Camera == null)
         Camera = FlxG.camera;
     Camera.setBounds(X + Border * tileSize, Y + Border * tileSize, Width - Border * tileSize * 2, Height - Border * tileSize * 2, UpdateWorld);
 }
예제 #9
0
        /// <summary>
        /// Call this function to figure out the on-screen position of the object.
        /// </summary>
        /// <param name="point">Takes a <code>FlxPoint</code> object and assigns the post-scrolled X and Y values of this object to it.</param>
        /// <param name="camera">Specify which game camera you want.  If null getScreenXY() will just grab the first global camera.</param>
        /// <returns></returns>
        public FlxPoint getScreenXY(FlxPoint point = null, FlxCamera camera = null)
        {
            if (point == null)
            {
                point = new FlxPoint();
            }

            if (camera == null)
            {
                camera = FlxG.camera;
            }

            point.X = X - (camera.Scroll.X * ScrollFactor.X);
            point.Y = Y - (camera.Scroll.Y * ScrollFactor.Y);
            point.X += (point.X > 0) ? 0.0000001f : -0.0000001f;
            point.Y += (point.Y > 0) ? 0.0000001f : -0.0000001f;
            return point;
        }
예제 #10
0
        /// <summary>
        /// #flx - Not yet implemented / missing FlxG.flashGfx for direct drawing (draw on immovable debug overlay?)
        /// </summary>
        /// <param name="Camera">Which Camera - currently only one exists</param>
        public override void drawDebug(FlxCamera Camera=null)
        {
            throw new NotImplementedException();

            if(Camera == null)
                Camera = FlxG.camera;

            //get bounding box coordinates
            float boundingBoxX = X - (int)(Camera.Scroll.X*ScrollFactor.X); //copied from getScreenXY()
            float boundingBoxY = Y - (int)(Camera.Scroll.Y*ScrollFactor.Y);
            boundingBoxX = (int)(boundingBoxX + ((boundingBoxX > 0)?0.0000001f:-0.0000001f));
            boundingBoxY = (int)(boundingBoxY + ((boundingBoxY > 0)?0.0000001f:-0.0000001f));
            int boundingBoxWidth = (int)((Width != (int)(Width)) ? Width : Width - 1f);
            int boundingBoxHeight = (int)((Height != (int)(Height)) ?Height : Height - 1f);

            ////fill static graphics object with square shape
            //var gfx:Graphics = FlxG.flashGfx;
            //gfx.clear();
            //gfx.moveTo(boundingBoxX,boundingBoxY);
            Color boundingBoxColor;
            if(Convert.ToBoolean(AllowCollisions))
            {
                if(AllowCollisions != Any)
                    boundingBoxColor = FlxColor.PINK;
                if(Immovable)
                    boundingBoxColor = FlxColor.GREEN;
                else
                    boundingBoxColor = FlxColor.RED;
            }
            else
                boundingBoxColor = FlxColor.BLUE;
            //gfx.lineStyle(1,boundingBoxColor,0.5);
            //gfx.lineTo(boundingBoxX+boundingBoxWidth,boundingBoxY);
            //gfx.lineTo(boundingBoxX+boundingBoxWidth,boundingBoxY+boundingBoxHeight);
            //gfx.lineTo(boundingBoxX,boundingBoxY+boundingBoxHeight);
            //gfx.lineTo(boundingBoxX,boundingBoxY);

            ////draw graphics shape to camera buffer
            //Camera.buffer.draw(FlxG.flashGfxSprite);
        }
예제 #11
0
        /// <summary>
        /// Checks to see if a point in 2D world space overlaps this <code>FlxObject</code> object.
        /// </summary>
        /// <param name="point">The point in world space you want to check.</param>
        /// <param name="inScreenSpace">Whether to take scroll factors into account when checking for overlap.</param>
        /// <param name="camera">Specify which game camera you want.  If null getScreenXY() will just grab the first global camera. flx# - currently only one exists</param>
        /// <returns></returns>
        public virtual bool overlapsPoint(FlxPoint point, bool inScreenSpace = false, FlxCamera camera = null)
        {
            if (!inScreenSpace)
            {
                return (point.X > this.X) && (point.X < this.X + Width) && (point.Y > this.Y) && (point.Y < this.Y + Height);
            }

            if (camera == null)
            {
                camera = FlxG.camera;
            }

            float x = point.X - camera.Scroll.X;
            float y = point.Y - camera.Scroll.Y;
            getScreenXY(_tagPoint, camera);
            return (x > _tagPoint.X) && (x < _tagPoint.X + Width) && (y > _tagPoint.Y) && (y < _tagPoint.Y + Height);
        }
예제 #12
0
 protected void drawTilemap(FlxCamera Camera)
 {
     //no need because draw() actually renders the tilemap
 }
예제 #13
0
        // overlapsPoint
        public override Boolean overlapsPoint(FlxPoint point, Boolean inScreenSpace = false, FlxCamera camera = null)
        {
            if (!inScreenSpace)
                return (_tileObjects[_data[(int)(((point.Y - Y) / _tileHeight) * widthInTiles + (point.X - X) / _tileWidth)]] as FlxTile).AllowCollisions > 0;

            if (camera == null)
                camera = FlxG.camera;
            point.X = point.X - camera.Scroll.X;
            point.Y = point.Y - camera.Scroll.Y;
            getScreenXY(_tagPoint, camera);
            return (_tileObjects[_data[(int)(((point.Y - _tagPoint.Y) / _tileHeight) * widthInTiles + (point.X - _tagPoint.X) / _tileWidth)]] as FlxTile).AllowCollisions > 0;
        }
예제 #14
0
 // getData
 // setDirty
 // findPath
 // simplifyPath
 // raySimplifyPath
 // computePathDistance
 // walkPath
 public override Boolean overlaps(FlxBasic objectOrGroup, Boolean inScreenSpace = false, FlxCamera camera = null)
 {
     if (objectOrGroup is FlxGroup)
     {
         Boolean results = false;
         FlxBasic basic;
         int i = 0;
         List<FlxBasic> members = new List<FlxBasic>();
         members = (objectOrGroup as FlxGroup).Members;
         while (i < members.Count)
         {
             basic = members[i++] as FlxBasic;
             if (basic is FlxObject)
             {
                 if (overlapsWithCallback(basic as FlxObject))
                 results = true;
             }
             else
             {
                 if (overlaps(basic, inScreenSpace, camera))
                     results = true;
             }
         }
         return results;
     }
     else if (objectOrGroup is FlxObject)
     {
         return overlapsWithCallback(objectOrGroup as FlxObject);
     }
     return false;
 }
예제 #15
0
파일: FlxG.cs 프로젝트: jlorek/flxSharp
        /// <summary>
        /// Dumps all the current cameras and resets to just one camera.
        /// Handy for doing split-screen especially.
        /// </summary>
        /// <param name="newCamera">Optional; specify a specific camera object to be the new main camera.</param>
        public static void resetCameras(FlxCamera newCamera = null)
        {
            foreach (FlxCamera flxCam in cameras)
            {
                //FlxG._game.removeChild(cam._flashSprite); // ?
                flxCam.destroy();
            }

            cameras.Clear();

            if (newCamera == null)
            {
                newCamera = new FlxCamera(0, 0, FlxG.width, FlxG.height);
            }

            FlxG.addCamera(newCamera);
            FlxG.camera = newCamera;

            /*
            var cam:FlxCamera;
            var i:uint = 0;
            var l:uint = cameras.length;
            while(i < l)
            {
                cam = FlxG.cameras[i++] as FlxCamera;
                FlxG._game.removeChild(cam._flashSprite);
                cam.destroy();
            }
            FlxG.cameras.length = 0;

            if(NewCamera == null)
                NewCamera = new FlxCamera(0,0,FlxG.width,FlxG.height)
            FlxG.camera = FlxG.addCamera(NewCamera);
            */
        }
예제 #16
0
        /// <summary>
        /// Check and see if this object is currently on screen.
        /// </summary>
        /// <param name="camera">Specify which game camera you want. If null getScreenXY() will just grab the first global camera.</param>
        /// <returns>bool</returns>
        public virtual bool onScreen(FlxCamera camera = null)
        {
            if (camera == null)
            {
                camera = FlxG.camera;
            }

            getScreenXY(_tagPoint,camera);
            return (_tagPoint.X + Width > 0) && (_tagPoint.X < camera.Width) && (_tagPoint.Y + Height > 0) && (_tagPoint.Y < camera.Height);
        }
예제 #17
0
        //Just plops down a spawner and some blocks - haphazard and crappy atm but functional!
        protected void buildRoom(int RX, int RY, bool Spawners)
        {
            //first place the spawn point (if necessary)
            int rw = 20;
            int sx = 0;
            int sy = 0;

            if (Spawners)
            {
                sx = (int)(2 + FlxG.random() * (rw - 7));
                sy = (int)(2 + FlxG.random() * (rw - 7));
            }

            //then place a bunch of blocks
            int numBlocks = (int)(3 + FlxG.random() * 4);

            if (!Spawners)
            {
                numBlocks++;
            }
            int  maxW = 10;
            int  minW = 2;
            int  maxH = 8;
            int  minH = 1;
            int  bx;
            int  by;
            int  bw;
            int  bh;
            bool check;

            for (int i = 0; i < numBlocks; i++)
            {
                do
                {
                    //keep generating different specs if they overlap the spawner
                    bw = (int)(minW + FlxG.random() * (maxW - minW));
                    bh = (int)(minH + FlxG.random() * (maxH - minH));
                    bx = (int)(-1 + FlxG.random() * (rw + 1 - bw));
                    by = (int)(-1 + FlxG.random() * (rw + 1 - bh));
                    if (Spawners)
                    {
                        check = ((sx > bx + bw) || (sx + 3 < bx) || (sy > by + bh) || (sy + 3 < by));
                    }
                    else
                    {
                        check = true;
                    }
                } while(!check);

                FlxTileblock b;
                b = new FlxTileblock(RX + bx * 8, RY + by * 8, bw * 8, bh * 8);
                b.loadTiles(ImgTech);
                _blocks.add(b);

                //If the block has room, add some non-colliding "dirt" graphics for variety
                if ((bw >= 4) && (bh >= 5))
                {
                    b = new FlxTileblock(RX + bx * 8 + 8, RY + by * 8, bw * 8 - 16, 8);
                    b.loadTiles(ImgDirtTop);
                    _decorations.add(b);

                    b = new FlxTileblock(RX + bx * 8 + 8, RY + by * 8 + 8, bw * 8 - 16, bh * 8 - 24);
                    b.loadTiles(ImgDirt);
                    _decorations.add(b);
                }
            }

            if (Spawners)
            {
                //Finally actually add the spawner
                Spawner sp = new Spawner(RX + sx * 8, RY + sy * 8, _bigGibs, _enemies, _enemyBullets, _littleGibs, _player);
                _spawners.add(sp);

                //Then create a dedicated camera to watch the spawner
                _hud.add(new FlxSprite(3 + (_spawners.length - 1) * 16, 3, ImgMiniFrame));
                FlxCamera camera = new FlxCamera(10 + (_spawners.length - 1) * 32, 10, 24, 24, 1);
                camera.follow(sp);
                FlxG.addCamera(camera);
            }
        }
예제 #18
0
        public override void create()
        {
            FlxG.Framerate = 50;
            //FlxG.FlashFramerate = 50;

            // set the background color to white
            FlxG.bgColor = FlxColor.WHITE;

            //Setup the level (40 x 40 tiles) Addapted from Adam Atomic's EZPlatformer
            int[] levelData =
            {
                1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
                1, 1, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1,
                1, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1,
                1, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1,
                1, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1,
                1, 0, 0, 1, 1, 1, 0, 0, 1, 1, 1, 1, 1, 1, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1,
                1, 0, 0, 0, 1, 1, 0, 0, 1, 1, 1, 1, 1, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0, 1,
                1, 0, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 1,
                1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1,
                1, 0, 0, 0, 0, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1,
                1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1,
                1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1,
                1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 1,
                1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 1,
                1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1,
                1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1,
                1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1,
                1, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1,
                1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 1,
                1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 1,
                1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 1, 1, 1, 1, 1, 0, 0, 1,
                1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
                1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
                1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1,
                1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1,
                1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1,
                1, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1,
                1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 1, 1, 1, 1, 1, 0, 1, 0, 1, 1, 1, 1, 1, 0, 0, 0, 1, 1, 1, 1, 0, 1,
                1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 1,
                1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1,
                1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1,
                1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 1,
                1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1,
                1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1,
                1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
                1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
                1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
                1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
                1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
                1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1
            };

            // Create the tilemap from the levelData we just created
            level = new FlxTilemap();
            level.loadMap(FlxTilemap.arrayToCSV(levelData, 40), FlxTilemap.ImgAuto, 0, 0, FlxTilemap.AUTO);
            add(level);

            //Create the two players
            player1 = new FlxSprite(65, 200).makeGraphic(10, 12, FlxColor.RED); //player 1 is red and starts at 65, 200
            player1.MaxVelocity.X  = 80;                                        // Theses are pysics settings,
            player1.MaxVelocity.Y  = 200;                                       // controling how the players behave
            player1.Acceleration.Y = 200;                                       // in the game
            player1.Drag.X         = player1.MaxVelocity.X * 4;
            add(player1);

            player2 = new FlxSprite(265, 200).makeGraphic(10, 12, FlxColor.BLUE); // player2 is blue and starts at 265, 200
            player2.MaxVelocity.X  = 80;                                          // Same thing than player 1
            player2.MaxVelocity.Y  = 200;
            player2.Acceleration.Y = 200;
            player2.Drag.X         = player2.MaxVelocity.X * 4;
            add(player2);

            // Then we setup two cameras to follow each of the two players

            FlxCamera cam = new FlxCamera(0, 0, FlxG.width / 2, FlxG.height);          // we put the first one in the top left corner

            cam.follow(player2);
            // this sets the limits of where the camera goes so that it doesn't show what's outside of the tilemap
            cam.setBounds(0, 0, level.Width, level.Height);
            cam.Color = FlxColor.PINK;             // add a light red tint to the camera to differentiate it from the other
            FlxG.resetCameras(cam);

            // Almost the same thing as the first camera
            cam = new FlxCamera(FlxG.width / 2, 0, FlxG.width / 2, FlxG.height);           // and the second one in the top middle of the screen
            cam.follow(player1);
            cam.setBounds(0, 0, level.Width, level.Height);
            cam.Color = FlxColor.CADETBLUE;             // Add a light blue tint to the camera
            FlxG.addCamera(cam);
        }