Beispiel #1
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 #2
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 #3
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 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);
        }
        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);
            }
        }