예제 #1
0
        override public void create()
        {
            FlxG.resetHud();
            FlxG.showHud();

            FlxG.backColor = Color.LightGray;

            base.create();

            string levelData = FlxU.randomString(10);

            FlxG.log("levelData: " + levelData);

            makeCave(0.1f, Color.Black);
            makeCave(0.5f, new Color(0.98f, 1.0f, 0.95f));
            makeCave2(1.0f, Color.Green);

            spaceShip = new FlxSprite(60, 60);
            spaceShip.loadGraphic(FlxG.Content.Load <Texture2D>("flixel/surt/spaceship_32x32"), true, false, 32, 32);
            spaceShip.addAnimation("Static", new int[] { 0 }, 36, true);
            spaceShip.addAnimation("Transform", new int[] { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39 }, 36, false);
            spaceShip.play("Static");

            spaceShip.setDrags(1100, 1100);
            add(spaceShip);

            FlxG.follow(spaceShip, 10.0f);
            FlxG.followBounds(0, 0, 50 * 16, 40 * 16);
        }
예제 #2
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();
        }
예제 #3
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);
        }
예제 #4
0
        override public void update()
        {
            if (FlxGlobal.cheatString == "cheatcode")
            {
                FlxG._game._console.visible = false;
                FlxG.showHud();

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

            base.update();
        }
예제 #5
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);
             */
        }
예제 #6
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);
        }
예제 #7
0
        override public void create()
        {
            FlxG.backColor = FlxColor.ToColor("dedbc3");
            base.create();

            _world = new World(new Vector2(0, 98.0f));

            charactersGrp   = new FlxGroup();
            blocksGrp       = new FlxGroup();
            movingBlocksGrp = new FlxGroup();
            doors           = new FlxGroup();
            crates          = new FlxGroup();


            //Dictionary<string,string> levelAttrs = FlxXMLReader.readAttributesFromOelFile("ogmo/level1.oel", "level/grid");
            //FlxTilemap tiles = new FlxTilemap();
            //tiles.useExtraMiddleTiles = false;
            //tiles.auto = FlxTilemap.AUTO;
            //tiles.indexOffset = -1;
            //tiles.loadMap(levelAttrs["grid"], FlxG.Content.Load<Texture2D>("level1_tiles"), 10, 10);
            //tiles.setScrollFactors(0, 0);
            //tiles.boundingBoxOverride = true;

            //blocksGrp.add(tiles);

            List <Dictionary <string, string> > lblocks = FlxXMLReader.readNodesFromOelFile("ogmo/level1.oel", "level/grid");

            foreach (Dictionary <string, string> nodes in lblocks)
            {
                FarTileblock t = new FarTileblock(Convert.ToInt32(nodes["x"]) + (Convert.ToInt32(nodes["w"]) / 2), Convert.ToInt32(nodes["y"]) + (Convert.ToInt32(nodes["h"]) / 2), Convert.ToInt32(nodes["w"]), Convert.ToInt32(nodes["h"]), _world);
                t.auto = FlxTilemap.AUTO;
                t.loadTiles("level1_tiles", 10, 10, 0);
                blocksGrp.add(t);
                t._body.BodyType = BodyType.Static;


                FlxTileblock t2 = new FlxTileblock(Convert.ToInt32(nodes["x"]), Convert.ToInt32(nodes["y"]), Convert.ToInt32(nodes["w"]), Convert.ToInt32(nodes["h"]));
                t2.auto = FlxTilemap.AUTO;
                t2.loadTiles("level1_tiles", 10, 10, 0);
                blocksGrp.add(t2);
            }

            List <Dictionary <string, string> > blocks = FlxXMLReader.readNodesFromOelFile("ogmo/level1.oel", "level/tileblocks");

            foreach (Dictionary <string, string> nodes in blocks)
            {
                if (nodes["Name"] == "elevator")
                {
                    MovingBlock block = new MovingBlock(Convert.ToInt32(nodes["x"]), Convert.ToInt32(nodes["y"]));
                    block.loadGraphic("level1_specialBlock", false, true, 40, 20);
                    movingBlocksGrp.add(block);

                    FlxPath xpath = new FlxPath(null);
                    xpath.add(Convert.ToInt32(nodes["x"]) + 20, Convert.ToInt32(nodes["y"]) + 10);
                    xpath.addPointsUsingStrings(nodes["pathNodesX"], nodes["pathNodesY"], 20, 10);
                    block.followPath(xpath, 80, FlxObject.PATH_FORWARD, false);
                }
                if (nodes["Name"] == "door")
                {
                    Door door = new Door(Convert.ToInt32(nodes["x"]), Convert.ToInt32(nodes["y"]) - 100);
                    doors.add(door);
                }
                //foreach (var item in nodes)
                //{
                //    Console.WriteLine("{0} {1}", item.Key, item.Value);
                //}
            }
            //bat = new Bat(x, y);
            //actors.add(bat);
            //Console.WriteLine("Building a bat {0} {1} {2} {3}", x, y, PathNodesX, PathNodesY);

            //if (PathNodesX != "" && PathNodesY != "")
            //{
            //    Console.WriteLine("Building a path {0} {1} {2}", PathNodesX, PathNodesY, PathCornering);

            //    FlxPath xpath = new FlxPath(null);
            //    xpath.add(x, y);
            //    xpath.addPointsUsingStrings(PathNodesX, PathNodesY);
            //    bat.followPath(xpath, PathSpeed, PathType, false);
            //    bat.pathCornering = PathCornering;


            //}



            Andre andre = new Andre(0, 0);

            charactersGrp.add(andre);

            Liselot liselot = new Liselot(40, 40);

            charactersGrp.add(liselot);

            Army army = new Army(30, 20);

            charactersGrp.add(army);

            Inspector inspector = new Inspector(50, 50);

            charactersGrp.add(inspector);

            Worker worker = new Worker(60, 60);

            charactersGrp.add(worker);

            Chef chef = new Chef(100, 30);

            charactersGrp.add(chef);


            FlxTileblock bg = new FlxTileblock(0, 0, 240, 800);

            bg.auto = FlxTileblock.RANDOM;
            bg.loadTiles("level1_shelfTile", 80, 80, 0);
            add(bg);

            bg      = new FlxTileblock(640, 0, 240, 800);
            bg.auto = FlxTileblock.RANDOM;
            bg.loadTiles("level1_shelfTile", 80, 80, 0);
            add(bg);

            for (int i = 0; i < 5; i++)
            {
                SmallCrate c = new SmallCrate((int)FlxU.random(0, FlxG.width), (int)FlxU.random(0, FlxG.height - 100));
                crates.add(c);
            }

            for (int i = 0; i < 5; i++)
            {
                Bottle b = new Bottle((int)FlxU.random(0, FlxG.width), (int)FlxU.random(0, FlxG.height - 100));
                crates.add(b);
            }
            for (int i = 0; i < 55; i++)
            {
                Fruit f = new Fruit((int)FlxU.random(0, FlxG.width), (int)FlxU.random(0, FlxG.height - 100), _world);
                f._body.ApplyLinearImpulse(new Vector2(20, 2120));


                crates.add(f);
            }


            add(doors);
            add(charactersGrp);
            add(blocksGrp);
            add(movingBlocksGrp);
            add(crates);

            FlxG.showHud();
            FlxG.setHudTextPosition(1, FlxG.width / 2, 10);
            FlxG.setHudTextScale(1, 3);
        }
        public override void overlapped(FlxObject obj)
        {
            base.overlapped(obj);

            if (Math.Abs(velocity.X) > 1 || Math.Abs(velocity.Y) > 1)
            {
                if (obj.GetType().ToString() == "Lemonade.Worker" && obj.dead == false)
                {
                    //Lemonade_Globals.gameProgress[Lemonade_Globals.location + "_" + FlxG.level.ToString()].KilledWorker = true;
                    obj.kill();
                    play("explode");
                    velocity.X = 0;

                    FlxG.play("Lemonade/sfx/cw_sound38", 0.5f, false);
                }
                else if (obj.GetType().ToString() == "Lemonade.Army" && obj.dead == false)
                {
                    //Lemonade_Globals.gameProgress[Lemonade_Globals.location + "_" + FlxG.level.ToString()].KilledArmy = true;
                    obj.kill();
                    play("explode");
                    velocity.X = 0;

                    FlxG.play("Lemonade/sfx/cw_sound38", 0.5f, false);
                }
                else if (obj.GetType().ToString() == "Lemonade.Chef" && obj.dead == false)
                {
                    //Lemonade_Globals.gameProgress[Lemonade_Globals.location + "_" + FlxG.level.ToString()].KilledChef = true;
                    obj.kill();
                    play("explode");
                    velocity.X = 0;

                    FlxG.play("Lemonade/sfx/cw_sound38", 0.5f, false);
                }
                else if (obj.GetType().ToString() == "Lemonade.Inspector" && obj.dead == false)
                {
                    //Lemonade_Globals.gameProgress[Lemonade_Globals.location + "_" + FlxG.level.ToString()].KilledInspector = true;
                    obj.kill();
                    play("explode");
                    velocity.X = 0;

                    FlxG.play("Lemonade/sfx/cw_sound38", 0.5f, false);
                }
            }

            if (obj.GetType().ToString() == "Lemonade.Liselot" || obj.GetType().ToString() == "Lemonade.Andre")
            {
                if (((FlxPlatformActor)(obj)).control == FlxPlatformActor.Controls.player && parent == null)
                {
                    FlxG.showHud();

                    //Console.WriteLine("Small crate is at {0} {1} collider is {2} {3} Zoom {4} ", x, y, this.getScreenXY().X, this.getScreenXY().Y, FlxG.zoom);


                    if (FlxG.BUILD_TYPE == FlxG.BUILD_TYPE_PC)
                    {
                        if (FlxG.lastControlTypeUsed == FlxG.CONTROL_TYPE_KEYBOARD)
                        {
                            FlxG._game.hud.setHudGamepadButton(
                                FlxHud.TYPE_KEYBOARD_DIRECTION,
                                FlxHud.Keyboard_Arrow_Down,
                                (this.getScreenXY().X *FlxG.zoom) - 80,
                                (this.getScreenXY().Y *FlxG.zoom) - 120);

                            FlxG._game.hud.setHudGamepadButton(FlxHud.TYPE_KEYBOARD,
                                                               FlxHud.Keyboard_C,
                                                               (this.getScreenXY().X *FlxG.zoom) + 20,
                                                               (this.getScreenXY().Y *FlxG.zoom) - 120);
                        }
                        else if (FlxG.lastControlTypeUsed == FlxG.CONTROL_TYPE_GAMEPAD)
                        {
                            FlxG._game.hud.setHudGamepadButton(FlxHud.TYPE_XBOX_DIRECTION,
                                                               FlxHud.xboxDPadDown,
                                                               (this.getScreenXY().X *FlxG.zoom) - 80,
                                                               (this.getScreenXY().Y *FlxG.zoom) - 120);

                            FlxG._game.hud.setHudGamepadButton(FlxHud.TYPE_XBOX,
                                                               FlxHud.xboxButtonX,
                                                               (this.getScreenXY().X *FlxG.zoom) + 20,
                                                               (this.getScreenXY().Y *FlxG.zoom) - 120);
                        }
                    }
                    if (FlxG.BUILD_TYPE == FlxG.BUILD_TYPE_OUYA)
                    {
                        FlxG._game.hud.setHudGamepadButton(FlxHud.TYPE_OUYA_DIRECTION,
                                                           FlxHud.ouyaDPadDown,
                                                           (this.getScreenXY().X *FlxG.zoom) - 80,
                                                           (this.getScreenXY().Y *FlxG.zoom) - 120);

                        FlxG._game.hud.setHudGamepadButton(FlxHud.TYPE_OUYA,
                                                           FlxHud.ouyaButtonU,
                                                           (this.getScreenXY().X *FlxG.zoom) + 20,
                                                           (this.getScreenXY().Y *FlxG.zoom) - 120);
                    }

                    FlxG._game.hud.resetTime();
                    FlxG._game.hud.timeToShowButton = 0.05f;

                    throwTimer = 0;

                    if (canParent)
                    {
                        parent = obj;
                        Console.WriteLine("can parent == True);");
                    }

                    canParent = false;
                }
            }
            else
            {
                canParent = false;
            }

            if (obj.GetType().ToString() == "Lemonade.Trampoline")
            {
                trampolineTimer = 0;
                velocity.Y      = -1000;
            }

            if (obj.GetType().ToString() == "Lemonade.Spike")
            {
                play("explode");
            }
        }