Beispiel #1
0
        public void advanceToNextState()
        {
            Console.WriteLine("Advance to next state");

            if (_nameEntry.text == "")
            {
                FlxG.setHudText(2, "Name cannot be blank");

                return;
            }

            FlxG.username = _nameEntry.text;

            SaveToDevice();

            //FlxOnlineStatCounter.sendStats("slfparttwo", "zero", Lemonade_Globals.PAID_VERSION+1);


            FlxG.level = 1;
            FlxG.score = 0;
            FlxG.hideHud();

                        #if __ANDROID__
            FlxG.state = new IntroState();
                        #endif
                        #if !__ANDROID__
            FlxG.state = new IntroState();
                        #endif

            return;
        }
Beispiel #2
0
        override public void update()
        {
            FlxG.setHudText(1, "Car Speed: " + car.pathSpeed.ToString() + "\nCar Cornering: " + car.pathCornering.ToString());

            if (FlxG.keys.DOWN)
            {
                car.pathSpeed -= 10;
            }
            if (FlxG.keys.UP)
            {
                car.pathSpeed += 10;
            }
            if (FlxG.keys.LEFT)
            {
                car.pathCornering -= 0.1f;
            }
            if (FlxG.keys.RIGHT)
            {
                car.pathCornering += 0.1f;
            }



            if (car.pathSpeed > 1300)
            {
                FlxG.quake.start(0.05f, 0.5f);
            }


            base.update();
        }
Beispiel #3
0
        override public void create()
        {
            FlxG.backColor = Color.DarkBlue;



            base.create();


            FlxG.resetHud();


            string textInfo = "";

            textInfo  = "Choose:\n";
            textInfo += "1. Camera Test State\n";
            textInfo += "2. Cave Tiles Test State\n";


            FlxG.setHudText(1, textInfo);
            FlxG.setHudTextPosition(1, 20, 20);
            FlxG.setHudTextScale(1, 3);
            FlxG.setHudGamepadButton(FlxHud.TYPE_KEYBOARD, FlxHud.Keyboard_1, FlxG.width - 40, 30);

            FlxG.showHud();
        }
Beispiel #4
0
        override public void create()
        {
            base.create();

            FlxG.showHud();
            FlxG.setHudText(1, "Press [`] to show the debug console.\nYou must build with the Debug Solution Configuration.\n\nIn the console press TAB to bring up the cheat menu.\n\nTry typing in the cheat code \"cheatcode\"");
            FlxG.setHudGamepadButton(FlxHud.TYPE_KEYBOARD, FlxHud.Keyboard_Tilda, (FlxG.width * 2) - 100, 10);
            FlxG.setHudGamepadButton(FlxHud.TYPE_KEYBOARD_DIRECTION, FlxHud.Keyboard_Tab, (FlxG.width * 2) - 100, 100);
        }
Beispiel #5
0
        override public void update()
        {
            if (FlxGlobal.cheatString == "cheatcode")
            {
                FlxG._game._console.visible = false;
                FlxG.showHud();

                FlxG.setHudText(1, "Awesome Cheat Activated!");
            }

            base.update();
        }
Beispiel #6
0
        override public void create()
        {
            base.create();

            FlxG.mouse.show(FlxG.Content.Load <Texture2D>("flixel/cursor"));

            mouseInfo           = new FlxText(1, 1, 100);
            mouseInfo.text      = "Info:";
            mouseInfo.alignment = FlxJustification.Left;
            mouseInfo.setScrollFactors(1, 1);
            add(mouseInfo);

            FlxG.resetHud();

            string textInfo = "";

            textInfo  = "Choose:\n";
            textInfo += "1. Cheat State\n";
            textInfo += "2. Cave State\n";
            textInfo += "3. Race Or Die\n";
            textInfo += "4. Tweens\n";
            textInfo += "5. Robot Football\n";
            textInfo += "6. Animation Callbacks\n";
            textInfo += "7. FlxPath \n";
            textInfo += "8. Physics \n";
            textInfo += "9. Angle And Velocity\n";
            textInfo += "F2. Physics 2\n";
            textInfo += "F3. Island \n";
            textInfo += "F4. Island 2 \n";
            textInfo += "F5. Physics Hockey \n";
            textInfo += "F6. FlxBar \n";
            textInfo += "F7. Scrolling Test \n";

            textInfo += "Q. Garbage Tests \n";
            FlxG.setHudText(1, textInfo);
            FlxG.setHudTextPosition(1, 50, 20);
            FlxG.setHudTextScale(1, 2);
            FlxG.setHudGamepadButton(FlxHud.TYPE_KEYBOARD, FlxHud.Keyboard_1, FlxG.width - 120, 30);

            FlxG.showHud();

            /*
             *          FlxSprite logo = new FlxSprite(12, 12);
             *          logo.loadGraphic("flixel/surt/race_or_die", true, false, 64, 64);
             *          logo.addAnimation("Static", new int[] { 8 }, 0, true);
             *          logo.play("Static");
             *          logo.setDrags(5, 5);
             *          add(logo);
             */
        }
Beispiel #7
0
        //PlayHud localHud;

        override public void create()
        {
            FlxG.backColor = Color.Black;

            base.create();

            FlxG.mouse.show(FlxG.Content.Load <Texture2D>("initials/crosshair"));

            //FlxG.backColor = new Color(0xc2, 0x88, 0x83);

            base.create();

            FlxG.resetHud();
            FlxG.showHud();

            _nameEntry = new FlxText(60, 150, FlxG.width);
            _nameEntry.setFormat(null, 2, Color.White, FlxJustification.Left, Color.White);
            _nameEntry.text = "";
            add(_nameEntry);

            try
            {
                _nameEntry.text = LoadFromDevice();
            }
            catch
            {
                Console.WriteLine("Cannot load name from file");
            }

            FlxG.showHud();
            FlxG.setHudText(1, "Enter name, use @ symbol to specify Twitter handle.\nPress enter when complete.");
            FlxG.setHudTextScale(1, 2);
            FlxG.setHudTextScale(3, 2);
            FlxG.setHudTextPosition(1, 30 * 2, 40 * 2);
            FlxG.setHudTextPosition(3, 10 * 2, 20 * 2);

            //play = new FlxButton(FlxG.width / 2 - 50, FlxG.height - 30, advanceToNextState, FlxButton.ControlPadA);
            ////play = new FlxButton(0, FlxG.height - 30, advanceToNextState, FlxButton.ControlPadA);

            //play.loadGraphic((new FlxSprite()).loadGraphic(FlxG.Content.Load<Texture2D>("fourchambers/menuButton"), false, false, 100, 20), (new FlxSprite()).loadGraphic(FlxG.Content.Load<Texture2D>("fourchambers/menuButtonPressed"), false, false, 100, 20));

            //play.loadText(new FlxText(2, 2, 100, "Enter"), new FlxText(2, 2, 100, "ENTER"));
            //add(play);

            FlxG.setHudGamepadButton(FlxHud.TYPE_XBOX, FlxButton.ControlPadA, FlxG.width / 2 + 54, FlxG.height - 100);

            FlxG.flash.start(Color.Black, 1.5f);
        }
        override public void update()
        {
            _world.Step(Math.Min((float)FlxG.elapsedAsGameTime.ElapsedGameTime.TotalSeconds, (1f / 30f)));

            if (FlxG.keys.justPressed(Keys.B))
            {
                FlxG.showBounds = !FlxG.showBounds;
            }

            FlxG.setHudText(1, FlxG.score.ToString());

            FlxU.collide(movingBlocksGrp, crates);
            FlxU.collide(blocksGrp, crates);
            FlxU.collide(charactersGrp, blocksGrp);
            FlxU.collide(charactersGrp, movingBlocksGrp);
            FlxU.overlap(charactersGrp, doors, overlapped);
            FlxU.overlap(charactersGrp, crates, overlappedCrate);

            if (FlxControl.ACTIONJUSTPRESSED)
            {
                foreach (MovingBlock block in movingBlocksGrp.members)
                {
                    block.forward = !block.forward;

                    if (block.forward && block.velocity.X == 0 && block.velocity.Y == 0)
                    {
                        block.startFollowingPath(FlxObject.PATH_FORWARD);
                    }
                    if (!block.forward && block.velocity.X == 0 && block.velocity.Y == 0)
                    {
                        block.startFollowingPath(FlxObject.PATH_BACKWARD);
                    }
                }
            }


            base.update();
        }
        public void pulse(string Name, uint Frame, int FrameIndex)
        {
            string info = "Current animation: " + Name + " Frame: " + Frame + " FrameIndex: " + FrameIndex;

            FlxG.setHudText(1, info);
            FlxG.setHudTextScale(1, 3);

            if (Name == "transform" && Frame == 39)
            {
                FlxG.flash.start(Color.White);
            }

            // Lets say you want to fire some jets on the fifth frame of any animation
            if (Frame == 5)
            {
                jets.start();
            }

            // Fire jets at the fifth frame of reverse.
            if (Name == "reverse" && FrameIndex == 5)
            {
                jets.start();
            }
        }
Beispiel #10
0
        override public void create()
        {
            base.create();

            FlxG.resetHud();

            String hudText = "Press \n";

            hudText += "Q. Back \n";
            hudText += "W. Bounce \n";
            hudText += "E. Circular \n";
            hudText += "R. Cubic \n";
            hudText += "A. Elastic \n";
            hudText += "S. Exponential \n";
            hudText += "D. Linear \n";
            hudText += "F. Quadratic \n";
            hudText += "Z. Quartic \n";
            hudText += "X. Quintic \n";
            hudText += "C. Sinusoidal";

            FlxG.setHudText(2, hudText);

            FlxG.mouse.hide();

            //Define the time it takes to move the car across the screen.
            timeToMove = 2.5f;

            //Define the distance the car will move.
            driveDistance = 350;

            //Define the starting positions of the cars.
            car1Pos = new Vector2(20, 0);
            car2Pos = new Vector2(20, 50);
            car3Pos = new Vector2(20, 100);
            car4Pos = new Vector2(20, 150);
            car5Pos = new Vector2(20, 200);
            car6Pos = new Vector2(20, 250);

            redCarText      = new FlxText(car1Pos.X, car1Pos.Y + 40, FlxG.width);
            redCarText.text = "Back.EaseInOut";
            redCarText.setFormat(null, 1, Color.Red, FlxJustification.Left, Color.Black);
            add(redCarText);

            yellowCarText      = new FlxText(car2Pos.X, car2Pos.Y + 40, FlxG.width);
            yellowCarText.text = "Bounce.EaseInOut";
            yellowCarText.setFormat(null, 1, Color.Yellow, FlxJustification.Left, Color.Black);
            add(yellowCarText);

            greenCarText      = new FlxText(car3Pos.X, car3Pos.Y + 40, FlxG.width);
            greenCarText.text = "Circular.EaseInOut";
            greenCarText.setFormat(null, 1, Color.Green, FlxJustification.Left, Color.Black);
            add(greenCarText);

            blueCarText      = new FlxText(car4Pos.X, car4Pos.Y + 40, FlxG.width);
            blueCarText.text = "Cubic.EaseInOut";
            blueCarText.setFormat(null, 1, Color.Blue, FlxJustification.Left, Color.Black);
            add(blueCarText);

            purpleCarText      = new FlxText(car5Pos.X, car5Pos.Y + 40, FlxG.width);
            purpleCarText.text = "Elastic.EaseInOut - Loop";
            purpleCarText.setFormat(null, 1, Color.Purple, FlxJustification.Left, Color.Black);
            add(purpleCarText);

            lightGreenCarText      = new FlxText(car6Pos.X, car6Pos.Y + 40, FlxG.width);
            lightGreenCarText.text = "Exponential.EaseInOut - Ping Pong";
            lightGreenCarText.setFormat(null, 1, Color.LightGreen, FlxJustification.Left, Color.Black);
            add(lightGreenCarText);



            carsGroup = new FlxGroup();
            add(carsGroup);

            redCar = new FlxSprite(car1Pos.X, car1Pos.Y);
            redCar.loadGraphic(FlxG.Content.Load <Texture2D>("flixel/surt/race_or_die"), true, false, 64, 64);
            redCar.addAnimation("Static", new int[] { 6 }, 0, true);
            redCar.play("Static");
            redCar.angle = 180;
            carsGroup.add(redCar);

            redCarTween      = new Tweener(car1Pos.X, driveDistance, TimeSpan.FromSeconds(timeToMove), Back.EaseInOut);
            redCarTween.Loop = true;
            redCarTween.Start();

            yellowCar = new FlxSprite(car2Pos.X, car2Pos.Y);
            yellowCar.loadGraphic(FlxG.Content.Load <Texture2D>("flixel/surt/race_or_die"), true, false, 64, 64);
            yellowCar.addAnimation("Static", new int[] { 7 }, 0, true);
            yellowCar.play("Static");
            yellowCar.angle = 180;
            carsGroup.add(yellowCar);

            yellowCarTween      = new Tweener(car2Pos.X, driveDistance, TimeSpan.FromSeconds(timeToMove), Bounce.EaseInOut);
            yellowCarTween.Loop = true;

            greenCar = new FlxSprite(car3Pos.X, car3Pos.Y);
            greenCar.loadGraphic(FlxG.Content.Load <Texture2D>("flixel/surt/race_or_die"), true, false, 64, 64);
            greenCar.addAnimation("Static", new int[] { 8 }, 0, true);
            greenCar.play("Static");
            greenCar.angle = 180;
            carsGroup.add(greenCar);

            greenCarTween      = new Tweener(car3Pos.X, driveDistance, TimeSpan.FromSeconds(timeToMove), XNATweener.Circular.EaseInOut);
            greenCarTween.Loop = true;


            blueCar = new FlxSprite(car4Pos.X, car4Pos.Y);
            blueCar.loadGraphic(FlxG.Content.Load <Texture2D>("flixel/surt/race_or_die"), true, false, 64, 64);
            blueCar.addAnimation("Static", new int[] { 9 }, 0, true);
            blueCar.play("Static");
            blueCar.angle = 180;
            carsGroup.add(blueCar);

            blueCarTween      = new Tweener(car4Pos.X, driveDistance, TimeSpan.FromSeconds(timeToMove), XNATweener.Cubic.EaseInOut);
            blueCarTween.Loop = true;


            purpleCar = new FlxSprite(car5Pos.X, car5Pos.Y);
            purpleCar.loadGraphic(FlxG.Content.Load <Texture2D>("flixel/surt/race_or_die"), true, false, 64, 64);
            purpleCar.addAnimation("Static", new int[] { 10 }, 0, true);
            purpleCar.play("Static");
            purpleCar.angle = 180;
            carsGroup.add(purpleCar);

            purpleCarTween      = new Tweener(car5Pos.X, driveDistance, TimeSpan.FromSeconds(timeToMove), XNATweener.Elastic.EaseInOut);
            purpleCarTween.Loop = true;


            lightGreenCar = new FlxSprite(car6Pos.X, car6Pos.Y);
            lightGreenCar.loadGraphic(FlxG.Content.Load <Texture2D>("flixel/surt/race_or_die"), true, false, 64, 64);
            lightGreenCar.addAnimation("Static", new int[] { 11 }, 0, true);
            lightGreenCar.play("Static");
            lightGreenCar.angle = 180;
            carsGroup.add(lightGreenCar);

            lightGreenCarTween          = new Tweener(car6Pos.X, driveDistance, TimeSpan.FromSeconds(timeToMove), XNATweener.Exponential.EaseInOut);
            lightGreenCarTween.PingPong = true;

            Console.WriteLine(lightGreenCar.GetType().AssemblyQualifiedName);


            String myClass = "org.flixel.examples.CarSprite";

            var type = Type.GetType(myClass);

            Console.WriteLine(type);
            var myObject = (FlxSprite)Activator.CreateInstance(type, 800, 400);

            //Console.WriteLine(myObject.GetType().AssemblyQualifiedName);
            //myObject.x = 300;
            //myObject.y = 300;
            add(myObject);
        }
Beispiel #11
0
        override public void update()
        {
            //Toggle the bounding box visibility
            if (FlxG.keys.justPressed(Microsoft.Xna.Framework.Input.Keys.B))
            {
                FlxG.showBounds = !FlxG.showBounds;
            }


            if (FlxG.mouse.pressedRightButton())
            {
                tiles.setTile((int)FlxG.mouse.x / 16, (int)FlxG.mouse.y / 16, 0, true);
            }
            if (FlxG.mouse.pressedLeftButton())
            {
                tiles.setTile((int)FlxG.mouse.x / 16, (int)FlxG.mouse.y / 16, 1, true);
            }

            int tile = tiles.getTile((int)FlxG.mouse.x / 16, (int)FlxG.mouse.y / 16);

            FlxG.setHudTextScale(1, 3);
            FlxG.setHudText(1, "The tile index you are hovering over is: " + tile.ToString());



            base.update();

            //Put the collide after base.update() to avoid flickering.
            FlxU.collide(spaceShip, tiles);

            int velValue = 500;

            if (FlxG.keys.A)
            {
                spaceShip.velocity.X = velValue * -1;
            }
            else if (FlxG.keys.D)
            {
                spaceShip.velocity.X = velValue;
            }
            else if (FlxG.keys.W)
            {
                spaceShip.velocity.Y = velValue * -1;
            }
            else if (FlxG.keys.S)
            {
                spaceShip.velocity.Y = velValue;
            }
            if (FlxG.keys.Z)
            {
                spaceShip.angle -= 5;
            }
            else if (FlxG.keys.X)
            {
                spaceShip.angle += 5;
            }
            else if (FlxG.keys.SPACE)
            {
                spaceShip.thrust = 500;
            }
            else if (FlxG.keys.L)
            {
                spaceShip.play("Transform");
                //FlxG.bloom.Visible = true;
            }
            else
            {
                spaceShip.thrust = 0;
            }
        }
        override public void create()
        {
            base.create();

            // play some music



            FlxG.playMp3("Lemonade/music/music_menu_1", 0.75f);

            // load some tile maps

            List <Dictionary <string, string> > bgString = FlxXMLReader.readNodesFromTmxFile("Lemonade/levels/slf2/newyork/bgnewyork.tmx", "map", "bg", FlxXMLReader.TILES);

            ny             = new FlxTilemap();
            ny.auto        = FlxTilemap.STRING;
            ny.indexOffset = -1;
            ny.loadMap(bgString[0]["csvData"], FlxG.Content.Load <Texture2D>("Lemonade/bgtiles_newyork"), 20, 20);
            ny.boundingBoxOverride = true;
            ny.setScrollFactors(0, 0);
            ny.visible = false;
            add(ny);

            bgString           = FlxXMLReader.readNodesFromTmxFile("Lemonade/levels/slf2/sydney/bgsydney.tmx", "map", "bg", FlxXMLReader.TILES);
            sydney             = new FlxTilemap();
            sydney.auto        = FlxTilemap.STRING;
            sydney.indexOffset = -1;
            sydney.loadMap(bgString[0]["csvData"], FlxG.Content.Load <Texture2D>("Lemonade/bgtiles_sydney"), 20, 20);
            sydney.boundingBoxOverride = true;
            sydney.setScrollFactors(0, 0);
            sydney.visible = false;
            add(sydney);

            bgString            = FlxXMLReader.readNodesFromTmxFile("Lemonade/levels/slf2/military/bgmilitary.tmx", "map", "bg", FlxXMLReader.TILES);
            miltary             = new FlxTilemap();
            miltary.auto        = FlxTilemap.STRING;
            miltary.indexOffset = -1;
            miltary.loadMap(bgString[0]["csvData"], FlxG.Content.Load <Texture2D>("Lemonade/bgtiles_military"), 20, 20);
            miltary.boundingBoxOverride = true;
            miltary.setScrollFactors(0, 0);
            miltary.visible = false;
            add(miltary);

            //FlxG.mouse.show(FlxG.Content.Load<Texture2D>("Mode/cursor"));

            FlxButton b = new FlxButton((FlxG.width / 2) - 100, 150, startGame);

            b.loadGraphic(new FlxSprite().loadGraphic(FlxG.Content.Load <Texture2D>("Lemonade/button_ny")), new FlxSprite().loadGraphic(FlxG.Content.Load <Texture2D>("Lemonade/buttonPressed_ny")));
            b.loadText(new FlxText(-20, 10, 100, "Sydney"), new FlxText(-20, 10, 100, "Sydney!"));
            buttons.add(b);

            b = new FlxButton(FlxG.width / 2, 150, startGame);
            b.loadGraphic(new FlxSprite().loadGraphic(FlxG.Content.Load <Texture2D>("Lemonade/button_ny")), new FlxSprite().loadGraphic(FlxG.Content.Load <Texture2D>("Lemonade/buttonPressed_ny")));
            b.loadText(new FlxText(-20, 10, 100, "New York"), new FlxText(-20, 10, 100, "New York!"));
            buttons.add(b);

            b = new FlxButton((FlxG.width / 2) + 100, 150, startGame);
            b.loadGraphic(new FlxSprite().loadGraphic(FlxG.Content.Load <Texture2D>("Lemonade/button_ny")), new FlxSprite().loadGraphic(FlxG.Content.Load <Texture2D>("Lemonade/buttonPressed_ny")));
            b.loadText(new FlxText(-20, 10, 100, "Military"), new FlxText(-20, 10, 100, "Military!"));
            buttons.add(b);


            for (int i = 1; i < 13; i++)
            {
                FlxButton a = new FlxButton(175 + (i * 45), 225, startGame);
                a.loadGraphic(new FlxSprite().loadGraphic(FlxG.Content.Load <Texture2D>("Lemonade/button_ny")), new FlxSprite().loadGraphic(FlxG.Content.Load <Texture2D>("Lemonade/buttonPressed_ny")));
                a.loadText(new FlxText(-40, 10, 100, i.ToString()), new FlxText(-40, 10, 100, i.ToString() + "!"));

                buttons.add(a);
            }

            b = new FlxButton((FlxG.width / 2) - 100, 275, startMultiplayerGame);
            b.loadGraphic(new FlxSprite().loadGraphic(FlxG.Content.Load <Texture2D>("Lemonade/button_ny")), new FlxSprite().loadGraphic(FlxG.Content.Load <Texture2D>("Lemonade/buttonPressed_ny")));
            b.loadText(new FlxText(-20, 10, 100, "Multiplayer"), new FlxText(-20, 10, 100, "Multiplayer!"));
            buttons.add(b);


            location = new FlxText(0, 50, FlxG.width);
            location.setFormat(FlxG.Content.Load <SpriteFont>("Lemonade/SMALL_PIXEL"), 3, Color.White, FlxJustification.Center, Color.Black);
            location.text = "";
            add(location);


            addButtons();

            FlxText badges = new FlxText(0, 330, 0, "Badges");

            badges.setFormat(FlxG.Content.Load <SpriteFont>("Lemonade/SMALL_PIXEL"), 3, Color.White, FlxJustification.Left, Color.Black);
            add(badges);

            Color notDone = new Color(0.1f, 0.1f, 0.1f);


            badge1 = new FlxSprite((FlxG.width / 2) - 150, 330);
            badge1.loadGraphic(FlxG.Content.Load <Texture2D>("Lemonade/offscreenIcons"), true, false, 12, 12);
            badge1.frame = 2;
            badge1.color = notDone;
            add(badge1);

            badge2 = new FlxSprite((FlxG.width / 2) - 50, 330);
            badge2.loadGraphic(FlxG.Content.Load <Texture2D>("Lemonade/offscreenIcons"), true, false, 12, 12);
            badge2.frame = 3;
            badge2.color = notDone;
            add(badge2);

            badge3 = new FlxSprite((FlxG.width / 2) + 50, 330);
            badge3.loadGraphic(FlxG.Content.Load <Texture2D>("Lemonade/offscreenIcons"), true, false, 12, 12);
            badge3.frame = 4;
            badge3.color = notDone;
            add(badge3);

            badge4 = new FlxSprite((FlxG.width / 2) + 150, 330);
            badge4.loadGraphic(FlxG.Content.Load <Texture2D>("Lemonade/offscreenIcons"), true, false, 12, 12);
            badge4.frame = 5;
            badge4.color = notDone;
            add(badge4);

            tweenBounce          = new Tweener(5.0f, 8.0f, TimeSpan.FromSeconds(1.12f), Elastic.EaseOut);
            tweenBounce.PingPong = true;


            try
            {
                FlxG.username = LoadFromDevice();
            }
            catch
            {
                Console.WriteLine("Cannot load name from file");
            }

            if (FlxG.username != "")
            {
                //_nameEntry.text = FlxG.username;
                FlxG.setHudText(3, "Username:\n" + FlxG.username);
                FlxG.setHudTextPosition(3, 50, FlxG.height - 30);
                FlxG.setHudTextScale(3, 2);
            }
        }
Beispiel #13
0
        override public void update()
        {
            FlxG.setHudText(1, "Flight Height : " + flightHeight.ToString());


            if (shadow.debugName == "fly")
            {
                flightHeight++;
                if (flightHeight >= 16)
                {
                    flightHeight = 16;
                }
            }
            if (shadow.debugName == "onground")
            {
                flightHeight--;
                if (flightHeight <= 0)
                {
                    flightHeight = 0;
                }
            }

            player.at(shadow);
            player.y -= flightHeight;
            //player.x -= flightHeight;

            if (FlxControl.ACTIONJUSTPRESSED && elapsedInState > 0.6f)
            {
                if (shadow.debugName == "onground")
                {
                    shadow.debugName = "fly";
                }
                else if (shadow.debugName == "fly")
                {
                    shadow.debugName = "onground";
                }
            }


            //m.x = ((int)(FlxG.mouse.x / 8) * 8);
            //m.y = ((int)(FlxG.mouse.y / 8) * 8);



            if (shadow.debugName == "fly")
            {
                if (FlxControl.LEFTJUSTPRESSED)
                {
                    shadow.x -= 8;
                }
                if (FlxControl.RIGHTJUSTPRESSED)
                {
                    shadow.x += 8;
                }
                if (FlxControl.UPJUSTPRESSED)
                {
                    shadow.y -= 8;
                }
                if (FlxControl.DOWNJUSTPRESSED)
                {
                    shadow.y += 8;
                }
            }
            else if (shadow.debugName == "onground")
            {
                if (FlxControl.LEFTJUSTPRESSED)
                {
                    shadow.x -= 8;
                    if (FlxU.overlap(shadow, waterGrp, null) == true)
                    {
                        shadow.x += 8;
                    }
                }
                if (FlxControl.RIGHTJUSTPRESSED)
                {
                    shadow.x += 8;
                    if (FlxU.overlap(shadow, waterGrp, null) == true)
                    {
                        shadow.x -= 8;
                    }
                }
                if (FlxControl.UPJUSTPRESSED)
                {
                    shadow.y -= 8;
                    if (FlxU.overlap(shadow, waterGrp, null) == true)
                    {
                        shadow.y += 8;
                    }
                }
                if (FlxControl.DOWNJUSTPRESSED)
                {
                    shadow.y += 8;
                    if (FlxU.overlap(shadow, waterGrp, null) == true)
                    {
                        shadow.y -= 8;
                    }
                }
            }

            //if (FlxControl.LEFT)
            //{
            //    player.x -= 8;
            //}
            //if (FlxControl.RIGHT)
            //{
            //    player.x += 8;
            //}
            //if (FlxControl.UP)
            //{
            //    player.y -= 8;
            //}
            //if (FlxControl.DOWN)
            //{
            //    player.y += 8;
            //}



            //FlxG.setHudText(1, tile

            FlxU.overlap(pellets, shadow, getPellet);

            if (FlxG.debug)
            {
                if (FlxG.keys.F8)
                {
                    if (pellets.getFirstAlive() != null)
                    {
                        shadow.at(pellets.getFirstAlive());
                    }
                }
            }

            if (pellets.getFirstAlive() == null)
            {
                FlxG.username = FlxU.randomString(32);

                FlxOnlineStatCounter.sendStats("theisland", "-", (int)(elapsedInState * 100));

                FlxG.state = new WinState();
                return;
            }

            base.update();
        }