Пример #1
0
        override public void create()
        {
            base.create();

            FlxG.resetHud();
            FlxG.hideHud();

            _world.Gravity.Y = 0;

            team1 = new FlxGroup();
            team2 = new FlxGroup();

            puck = new FarSprite(FlxG.width / 2, FlxG.height / 2, _world);
            puck.createGraphic(20, 20, Color.Green);
            puck.attachCircle(20, 20);
            add(puck);

            puck._body.ApplyLinearImpulse(new Vector2(FlxU.random(-15000, 15000), FlxU.random(-15000, 15000)));


            for (int i = 0; i < 6; i++)
            {
                FarSprite p1 = new FarSprite(i * 80, (int)FlxU.random(0, FlxG.height), _world);

                p1.createGraphic(4, 40, Color.Red);

                p1.attachRectangle(4, 40);

                team1.add(p1);
            }

            add(team1);
            add(team2);
        }
Пример #2
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;
        }
Пример #3
0
        override public void create()
        {
            base.create();

            FlxG.hideHud();
            FlxG.resetHud();

            robot = new FlxSprite(60, 60);
            robot.loadGraphic("flixel/surt/race_or_die", true, false, 64, 64);
            robot.addAnimation("static", new int[] { 0 }, 12, true);
            robot.play("static");
            robot.angle  = 0;
            robot.width  = 32;
            robot.height = 32;
            robot.setOffset(12, 12);
            robot.health = 100;
            robot.alpha  = 0.1f;

            add(robot);

            bar = new FlxBar(30, 30, FlxBar.FILL_LEFT_TO_RIGHT, 100, 10, robot, "rad", 0, 100, true);
            add(bar);

            bar2 = new FlxBar(60, 90, FlxBar.FILL_LEFT_TO_RIGHT, 20, 2, null, "health", 0, 100, false);
            bar2.loadCustomEmptyGraphic("flixel/initials/healthBar");
            bar2.emptyBar.offset.X = 2;
            bar2.emptyBar.offset.Y = 3;
            add(bar2);
        }
Пример #4
0
        override public void create()
        {
            base.create();

            FlxG.mouse.hide();
            FlxG.hideHud();

            playingField      = new FlxTileblock(0, 0, 640, 640);
            playingField.auto = FlxTileblock.RANDOM;
            playingField.loadTiles(FlxG.Content.Load <Texture2D>("examples/sports_ground"), 16, 16, 0);
            add(playingField);

            team1 = new FlxGroup();
            team2 = new FlxGroup();

            // Create two teams of 7 robots;
            for (int i = 0; i < 7; i++)
            {
                FlxSprite robot = new FlxSprite(20 + (i * 90), 10);
                robot.loadGraphic(FlxG.Content.Load <Texture2D>("flixel/surt/race_or_die"), true, false, 64, 64);
                robot.addAnimation("Static", new int[] { 7 }, 0, true);
                robot.play("Static");
                robot.angle      = 270;
                robot.velocity.Y = FlxU.random(10, 100);
                //robot.width = 32;
                //robot.height = 32;
                //robot.offset.X = 16;
                //robot.offset.Y = 16;
                team1.add(robot);
            }
            for (int i = 0; i < 7; i++)
            {
                FlxSprite robot = new FlxSprite(20 + (i * 90), 200);
                robot.loadGraphic(FlxG.Content.Load <Texture2D>("flixel/surt/race_or_die"), true, false, 64, 64);
                robot.addAnimation("Static", new int[] { 9 }, 0, true);
                robot.play("Static");
                robot.angle      = 90;
                robot.velocity.Y = FlxU.random(-10, -100);
                //robot.width = 32;
                //robot.height = 32;
                //robot.offset.X = 16;
                //robot.offset.Y = 16;
                team2.add(robot);
            }


            add(team1);
            add(team2);
        }
Пример #5
0
        override public void create()
        {
            base.create();

            FlxG.hideHud();

            scroller = new FlxScrollingSprite(20, 20);
            scroller.loadGraphic("flixel/initials/crate_80x60", true, false, 80, 60);
            scroller.scrollSpeed = new Vector2(0.5f, 0.1f);
            add(scroller);
            scroller = new FlxScrollingSprite(120, 20);
            scroller.loadGraphic("flixel/initials/crate_80x60", true, false, 80, 60);
            scroller.scrollSpeed = new Vector2(10.5f, -10.1f);
            add(scroller);
        }
Пример #6
0
        override public void create()
        {
            FlxG.hideHud();

            FlxG.backColor = Color.LightGray;

            base.create();

            makeCave2(1.0f, Color.Green);

            logo = new FlxSprite(360, 360);
            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);

            FlxG.follow(logo, 10.0f);
            FlxG.followBounds(0, 0, 150 * 16, 140 * 16);

            velValue = 0;
        }
Пример #7
0
        override public void create()
        {
            base.create();

            FlxG.hideHud();

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

            for (int i = 0; i < 10; i++)
            {
                Vector2   v = new Vector2((int)FlxU.random(0, 400), (int)FlxU.random(0, 200));
                FarSprite f = new FarSprite((int)v.X, (int)v.Y, _world);
                f.loadGraphic("flixel/initials/crate_80x60", true, false, (int)FlxU.random(10, 20), (int)FlxU.random(10, 20));
                f._body.Mass = 500f;
                //f._body.AngularVelocity = FlxU.random(-20,20);
                add(f);
            }

            for (int i = 0; i < 10; i++)
            {
                Vector2      v = new Vector2((int)FlxU.random(0, 400), (int)FlxU.random(0, 200));
                FarTileblock f = new FarTileblock((int)v.X, (int)v.Y, (int)FlxU.random(10, 40), (int)FlxU.random(10, 40), _world);
                f.loadTiles("flixel/initials/crate_80x60", 5, 5, 0);
                //f.loadGraphic("flixel/initials/crate_80x60", true, false, (int)FlxU.random(10, 20), (int)FlxU.random(10, 20));
                f._body.Mass            = 500f;
                f._body.AngularVelocity = FlxU.random(-20, 20);
                f.moves = true;
                add(f);
            }

            _ground          = BodyFactory.CreateRectangle(_world, 2000, 20, 1.0f, new Vector2(0, 350), null);
            _ground.BodyType = BodyType.Static;

            g1 = new FlxSprite(0, 340);
            g1.loadGraphic("flixel/diagnostic/testpalette", true, false, 1000, 20);
            add(g1);
        }
Пример #8
0
        override public void create()
        {
            FlxG.resetHud();
            FlxG.hideHud();

            FlxG.backColor = Color.DarkTurquoise;

            base.create();

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

            FlxCaveGeneratorExt caveExt = new FlxCaveGeneratorExt(20, 20, 0.49f, 1);

            string[,] caveLevel = caveExt.generateCaveLevel();

            //Optional step to print cave to the console.
            //caveExt.printCave(caveLevel);

            tileGrp = new FlxGroup();

            for (int i = 0; i < caveLevel.GetLength(1); i++)
            {
                for (int y = 0; y < caveLevel.GetLength(0); y++)
                {
                    //string toPrint = tiles[y, i];
                    if (Convert.ToInt32(caveLevel[y, i]) != 0)
                    {
                        FarSprite x = new FarSprite(100 + (i * 10), 10 + (y * 10), _world);
                        //x.createGraphic(8, 8, colors[Convert.ToInt32(caveLevel[y, i])]);
                        x.loadGraphic("flixel/autotilesIsland", false, false, 8, 8);
                        //x.color = colors[Convert.ToInt32(caveLevel[y, i])];

                        x._body.BodyType = BodyType.Dynamic;

                        //_body.BodyType = BodyType.Dynamic;

                        x.frame = Convert.ToInt32(caveLevel[y, i]);
                        //x.scale = 2;
                        //x.angularDrag = 250;
                        //
                        //x.setOffset(4, 4);

                        tileGrp.add(x);
                    }
                    //Console.Write(toPrint);
                }

                //Console.WriteLine();
            }

            //string newMap = caveExt.convertMultiArrayStringToString(caveLevel);


            add(tileGrp);

            m = new FlxSprite(0, 0);
            m.loadGraphic("flixel/cursor");
            add(m);


            _ground          = BodyFactory.CreateRectangle(_world, 2000, 20, 1.0f, new Vector2(0, 350), null);
            _ground.BodyType = BodyType.Static;

            //g1 = new FlxSprite(0, 340);
            //g1.loadGraphic("flixel/diagnostic/testpalette", true, false, 1000, 20);
            //add(g1);
        }
Пример #9
0
        override public void create()
        {
            FlxG.resetHud();
            FlxG.hideHud();

            FlxG.backColor = FlxColor.ToColor("#3cbcfc");

            base.create();

            FlxCaveGeneratorExt caveExt = new FlxCaveGeneratorExt(40, 40, 0.514f, 2);

            string[,] caveLevel = caveExt.generateCaveLevel();

            //Optional step to print cave to the console.
            //caveExt.printCave(caveLevel);
            #region color

            Color[] colors = new Color[] {
                FlxColor.ToColor("#7C7C7C"),

                FlxColor.ToColor("#0000FC"),

                FlxColor.ToColor("#0000BC"),

                FlxColor.ToColor("#4428BC"),

                FlxColor.ToColor("#940084"),

                FlxColor.ToColor("#A80020"),

                FlxColor.ToColor("#A81000"),

                FlxColor.ToColor("#881400"),

                FlxColor.ToColor("#503000"),

                FlxColor.ToColor("#007800"),

                FlxColor.ToColor("#006800"),

                FlxColor.ToColor("#005800"),

                FlxColor.ToColor("#004058"),

                FlxColor.ToColor("#000000"),

                FlxColor.ToColor("#000000"),

                FlxColor.ToColor("#000000"),

                FlxColor.ToColor("#BCBCBC"),

                FlxColor.ToColor("#0078F8"),

                FlxColor.ToColor("#0058F8"),

                FlxColor.ToColor("#6844FC"),

                FlxColor.ToColor("#D800CC"),

                FlxColor.ToColor("#E40058"),

                FlxColor.ToColor("#F83800"),

                FlxColor.ToColor("#E45C10"),

                FlxColor.ToColor("#AC7C00"),

                FlxColor.ToColor("#00B800"),

                FlxColor.ToColor("#00A800"),

                FlxColor.ToColor("#00A844"),

                FlxColor.ToColor("#008888"),

                FlxColor.ToColor("#000000"),

                FlxColor.ToColor("#000000"),

                FlxColor.ToColor("#000000"),

                FlxColor.ToColor("#F8F8F8"),

                FlxColor.ToColor("#3CBCFC"),

                FlxColor.ToColor("#6888FC"),

                FlxColor.ToColor("#9878F8"),

                FlxColor.ToColor("#F878F8"),

                FlxColor.ToColor("#F85898"),

                FlxColor.ToColor("#F87858"),

                FlxColor.ToColor("#FCA044"),

                FlxColor.ToColor("#F8B800"),

                FlxColor.ToColor("#B8F818"),

                FlxColor.ToColor("#58D854"),

                FlxColor.ToColor("#58F898"),

                FlxColor.ToColor("#00E8D8"),

                FlxColor.ToColor("#787878"),

                FlxColor.ToColor("#000000"),

                FlxColor.ToColor("#000000"),

                FlxColor.ToColor("#FCFCFC"),

                FlxColor.ToColor("#A4E4FC"),

                FlxColor.ToColor("#B8B8F8"),

                FlxColor.ToColor("#D8B8F8"),

                FlxColor.ToColor("#F8B8F8"),

                FlxColor.ToColor("#F8A4C0"),

                FlxColor.ToColor("#F0D0B0"),

                FlxColor.ToColor("#FCE0A8"),

                FlxColor.ToColor("#F8D878"),

                FlxColor.ToColor("#D8F878"),

                FlxColor.ToColor("#B8F8B8"),

                FlxColor.ToColor("#B8F8D8"),

                FlxColor.ToColor("#00FCFC"),

                FlxColor.ToColor("#F8D8F8"),

                FlxColor.ToColor("#000000"),

                FlxColor.ToColor("#000000")
            };

            #endregion

            tileGrp  = new FlxGroup();
            waterGrp = new FlxGroup();
            pellets  = new FlxGroup();

            Vector2 startPos = new Vector2(0, 0);

            for (int i = 0; i < caveLevel.GetLength(1); i++)
            {
                for (int y = 0; y < caveLevel.GetLength(0); y++)
                {
                    //string toPrint = tiles[y, i];
                    if (Convert.ToInt32(caveLevel[y, i]) != 0)
                    {
                        if (startPos.X == 0)
                        {
                            startPos = new Vector2(i * 8, y * 8);
                        }
                        FlxSprite x = new FlxSprite(i * 8, y * 8);
                        //x.createGraphic(8, 8, colors[Convert.ToInt32(caveLevel[y, i])]);
                        x.loadGraphic("autotilesIsland", false, false, 8, 8);
                        //x.color = colors[Convert.ToInt32(caveLevel[y, i])];

                        x.frame = Convert.ToInt32(caveLevel[y, i]);
                        //x.scale = 2;
                        //x.angularDrag = 250;
                        //x.setOffset(4, 4);
                        tileGrp.add(x);

                        if (FlxU.random() < 0.02f)
                        {
                            FlxSprite xx = new FlxSprite(i * 8, y * 8);
                            xx.createGraphic(8, 8, Color.Red);
                            pellets.add(xx);
                        }
                    }
                    else
                    {
                        FlxSprite x = new FlxSprite(i * 8, y * 8);
                        x.loadGraphic("water", false, false, 8, 8);
                        x.addAnimation("flow", new int[] { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 }, (int)FlxU.random(1, 7), true);
                        x.play("flow");

                        waterGrp.add(x);
                    }
                    //Console.Write(toPrint);
                }

                //Console.WriteLine();
            }

            //string newMap = caveExt.convertMultiArrayStringToString(caveLevel);


            add(tileGrp);
            add(waterGrp);
            add(pellets);

            //m = new FlxSprite(0, 0);
            //m.loadGraphic("flixel/cursor");
            //add(m);

            shadow = new FlxSprite(startPos.X, startPos.Y);
            shadow.createGraphic(8, 8, Color.Black);
            shadow.debugName = "onground";
            shadow.alpha     = 0.5f;
            add(shadow);

            player = new FlxSprite(startPos.X, startPos.Y);
            player.createGraphic(8, 8, colors[12]);
            add(player);

            //FlxG.showHud();

            FlxG.follow(shadow, 20.0f);
            FlxG.followBounds(0, 0, 320, 320);
        }
Пример #10
0
        override public void create()
        {
            FlxG.resetHud();
            FlxG.hideHud();

            FlxG.backColor = Color.DarkTurquoise;

            base.create();



            FlxCaveGeneratorExt caveExt = new FlxCaveGeneratorExt(80, 120, 0.49f, 1);

            string[,] caveLevel = caveExt.generateCaveLevel();

            //Optional step to print cave to the console.
            //caveExt.printCave(caveLevel);

            Color[] colors = new Color[] {
                Color.Aqua,
                Color.ForestGreen,
                Color.Yellow,
                Color.Yellow,
                Color.Yellow,
                Color.Yellow,
                Color.Yellow,
                Color.Yellow,
                Color.Yellow,
                Color.Yellow,
                Color.Yellow,
                Color.Yellow,
                Color.Yellow,
                Color.Yellow,
                Color.Yellow,
                Color.Green,
                Color.Yellow,
                Color.Yellow,
                Color.Yellow,
                Color.Yellow,
                Color.Yellow,
                Color.Yellow,
                Color.Yellow,
                Color.Yellow, Color.Yellow, Color.Yellow, Color.Yellow, Color.Yellow, Color.Yellow, Color.Yellow, Color.Yellow, Color.Yellow, Color.Yellow, Color.Yellow, Color.Yellow, Color.Yellow, Color.Yellow, Color.Yellow, Color.Yellow, Color.Yellow, Color.Yellow, Color.Yellow, Color.Yellow, Color.Yellow, Color.Yellow, Color.Yellow, Color.Yellow, Color.Yellow, Color.Yellow, Color.Yellow, Color.Yellow, Color.Yellow, Color.Yellow, Color.Yellow, Color.Yellow, Color.Yellow, Color.Yellow, Color.Yellow, Color.Yellow, Color.Yellow, Color.Yellow, Color.Yellow, Color.Yellow, Color.Yellow, Color.Yellow, Color.Yellow, Color.Yellow, Color.Yellow, Color.Yellow, Color.Yellow, Color.Yellow, Color.Yellow
            };


            tileGrp = new FlxGroup();

            for (int i = 0; i < caveLevel.GetLength(1); i++)
            {
                for (int y = 0; y < caveLevel.GetLength(0); y++)
                {
                    //string toPrint = tiles[y, i];
                    if (Convert.ToInt32(caveLevel[y, i]) != 0)
                    {
                        FlxSprite x = new FlxSprite(i * 8, y * 8);
                        //x.createGraphic(8, 8, colors[Convert.ToInt32(caveLevel[y, i])]);
                        x.loadGraphic("flixel/autotilesIsland", false, false, 8, 8);
                        //x.color = colors[Convert.ToInt32(caveLevel[y, i])];

                        x.frame = Convert.ToInt32(caveLevel[y, i]);
                        //x.scale = 2;
                        x.angularDrag = 250;
                        x.setOffset(4, 4);
                        tileGrp.add(x);
                    }
                    //Console.Write(toPrint);
                }

                //Console.WriteLine();
            }

            //string newMap = caveExt.convertMultiArrayStringToString(caveLevel);


            add(tileGrp);

            m = new FlxSprite(0, 0);
            m.loadGraphic("flixel/cursor");
            add(m);
        }
Пример #11
0
        override public void create()
        {
            FlxG.resetHud();
            FlxG.hideHud();

            FlxG.backColor = Color.DarkTurquoise;

            base.create();



            FlxCaveGeneratorExt caveExt = new FlxCaveGeneratorExt(100, 60, 0.42f, 3);

            string[,] caveLevel = caveExt.generateCaveLevel();

            tileGrp = new FlxGroup();

            for (int i = 0; i < caveLevel.GetLength(1); i++)
            {
                for (int y = 0; y < caveLevel.GetLength(0); y++)
                {
                    //string toPrint = tiles[y, i];
                    if (Convert.ToInt32(caveLevel[y, i]) != 0)
                    {
                        FlxSprite x = new FlxSprite(i * 8, y * 8);
                        //x.createGraphic(8, 8, colors[Convert.ToInt32(caveLevel[y, i])]);
                        x.loadGraphic("flixel/autotilesIsland", false, false, 8, 8);
                        //x.color = colors[Convert.ToInt32(caveLevel[y, i])];

                        x.frame = Convert.ToInt32(caveLevel[y, i]);
                        //x.scale = 2;
                        x.angularDrag = 250;
                        //x.setOffset(4, 4);

                        x.@fixed = true;
                        tileGrp.add(x);
                    }
                    //Console.Write(toPrint);
                }

                //Console.WriteLine();
            }

            //string newMap = caveExt.convertMultiArrayStringToString(caveLevel);


            add(tileGrp);

            boats = new FlxGroup();

            for (int i = 0; i < 20; i++)
            {
                Boat b = new Boat((int)FlxU.random(0, FlxG.width), (int)FlxU.random(0, FlxG.height));
                b.velocity.X = FlxU.random(-40, 40);
                b.velocity.Y = FlxU.random(-40, 40);


                boats.add(b);
            }

            add(boats);
        }