コード例 #1
0
        /**
         * Creates a new <code>FlxButton</code> object with a gray background and a
         * callback function on the UI thread.
         *
         * @param X The X position of the button.
         * @param Y The Y position of the button.
         * @param Label The text that you want to appear on the button.
         * @param OnClick The function to call whenever the button is clicked.
         */
        public FlxButton(float x = 0, float y = 0, String label = null, FlxButtonEvent Callback = null) : base(x, y)
        {
            if (label != null)
            {
                Label = new FlxText(x - 1, y + 3, 80, label);
                Label.setFormat(null, 8, new Color(0x33, 0x33, 0x33), "center", Color.Transparent);
                LabelOffset = new FlxPoint(-1, 3);
            }
            loadGraphic(ImgDefaultButton, true, false, 80, 20);
            _callback = Callback;

            /*
             * onUp = OnClick;
             *
             * onDown = null;
             * onOut = null;
             * onOver = null;
             */
            SoundOver = null;
            SoundOut  = null;
            SoundDown = null;
            SoundUp   = null;

            Status       = Normal;
            _onToggle    = false;
            _pressed     = false;
            _initialized = false;
        }
コード例 #2
0
ファイル: ScoreCardState.cs プロジェクト: initials/Island
        override public void create()
        {
            FlxG.backColor = Color.White;

            base.create();

            FlxTileblock t = new FlxTileblock(8, 8, 256 - 16, 224 - 16);

            t.auto = FlxTileblock.HUDELEMENT;
            t.loadTiles("_sheet_window_06", 16, 16, 0);
            add(t);

            FlxG.playMp3("putt/music/March", 1.0f);

            text = new FlxText(16, 16, 200);
            text.setFormat(FlxG.Content.Load <SpriteFont>("flixel/initials/SMALL_PIXEL"), 1, Color.Black, FlxJustification.Left, Color.White);
            add(text);
            text.text = "Scorecard:\n";

            int total = 0;

            for (int i = 0; i < 18; i++)
            {
                try
                {
                    Console.WriteLine("Score for hole {0}: {1}", i + 1, Globals.scoreCard[i]);
                    text.text += string.Format("{0}: {1}, ", i + 1, Globals.scoreCard[i]);
                    total     += Globals.scoreCard[i];
                    if (i % 3 == 2)
                    {
                        text.text += "\n";
                    }
                }
                catch
                {
                }
            }

            text.text += string.Format("\nTotal: {0} / Par: 18 \n", total);;



            if (total <= 18 && Globals.hasPlayedHoleAgain == false)
            {
                text.text += "\nBonestorm.rom unlocked.";
            }
            else if (total >= 48)
            {
                text.text += "\nSix time national champion\nCarvello urges\nyou to keep practicing\nand improve your\nputting game.";
            }
            else if (total >= 32)
            {
                text.text += "\nYour putting game is improving\nrapidly.\nKeep it up, kid. ";
            }
            else if (total >= 24)
            {
                text.text += "\nYou're a real sharp shooter.";
            }
        }
コード例 #3
0
        public LevelIntro()
        {
            //b1 = new FlxSprite(0, 0);
            //b1.createGraphic(FlxG.width, FlxG.height , Lemonade_Globals.GAMEBOY_COLOR_4);
            //b1.setScrollFactors(0, 0);
            //add(b1);

            //b2 = new FlxSprite(0, 0);
            //b2.createGraphic(FlxG.width, FlxG.height, Lemonade_Globals.GAMEBOY_COLOR_3);
            //b2.setScrollFactors(0, 0);
            //add(b2);

            //b3 = new FlxSprite(0, 0);
            //b3.createGraphic(FlxG.width , FlxG.height, Lemonade_Globals.GAMEBOY_COLOR_2);
            //b3.setScrollFactors(0, 0);
            //add(b3);

            //b4 = new FlxSprite(0, 0);
            //b4.createGraphic(FlxG.width , FlxG.height, Lemonade_Globals.GAMEBOY_COLOR_1);
            //b4.setScrollFactors(0, 0);
            //add(b4);

            block             = new FlxTileblock(0, 0, FlxG.width + 20, FlxG.height + 20);
            block.auto        = FlxTileblock.FRAMENUMBER;
            block.frameNumber = 0;
            block.setScrollFactors(0, 0);
            block.loadTiles(FlxG.Content.Load <Texture2D>("Lemonade/fade"), 20, 20, 0);

            add(block);


            bT1 = new FlxText(0, FlxG.height / 4, FlxG.width);
            bT1.setFormat(null, 3, Lemonade_Globals.GAMEBOY_COLOR_1, FlxJustification.Center, Lemonade_Globals.GAMEBOY_COLOR_3);

            bT1.text = Lemonade_Globals.niceLocationNames[Lemonade_Globals.location];
            add(bT1);

            bT2 = new FlxText(0, (FlxG.height / 4) * 3, FlxG.width);
            bT2.setFormat(null, 2, Lemonade_Globals.GAMEBOY_COLOR_1, FlxJustification.Center, Lemonade_Globals.GAMEBOY_COLOR_3);

            bT2.text = Lemonade_Globals.niceActorNames[Lemonade_Globals.location];
            add(bT2);


            textTween1 = new Tweener(FlxG.height / 4, -95, 1.20f, XNATweener.Elastic.EaseInOut);
            textTween2 = new Tweener((FlxG.height / 4) * 3, FlxG.height + 95, 1.5f, XNATweener.Elastic.EaseInOut);
            textTween3 = new Tweener(-20, FlxG.height / 4, 0.7f, XNATweener.Quintic.EaseOut);
            textTween4 = new Tweener(800, (FlxG.height / 4) * 3, 1.2f, XNATweener.Quintic.EaseOut);

            timer = 0.0f;
        }
コード例 #4
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);
        }
コード例 #5
0
ファイル: LoadRomState.cs プロジェクト: initials/Island
        override public void create()
        {
            base.create();

            selection = 0;

            games = new List <string> ();
            games.Add("Lee Carvallo's Putting Challenge");
            games.Add("Bonestorm");
            games.Add("Bonestorm II");
            games.Add("Bonesquad");
            games.Add("Billy Graham's Bible Blaster");
            games.Add("Bowling 2000");
            games.Add("Chevy Chase Foul Play");
            games.Add("Disembowler IV - The game where condemned criminals dig at each other with rusty hooks.");
            games.Add("Escape from Death Row");
            games.Add("Escape from Grandma's House");
            games.Add("Escape from Grandma's House II");
            games.Add("Larry the Looter");
            games.Add("Polybius");
            games.Add("Super Slugfest");
            games.Add("Tandem Bike Ride With Your Mom");
            games.Add("Triangle Wars");

            //games.Add("");


            gamesDisplay = new FlxText(2, 12, 200);
            //text1.setFormat(FlxG.Content.Load<SpriteFont>("Lemonade/SMALL_PIXEL"), 3, new Color(237, 0, 142), FlxJustification.Center, Color.Black);
            gamesDisplay.setFormat(FlxG.Content.Load <SpriteFont>("flixel/initials/SMALL_PIXEL"), 1, Color.White, FlxJustification.Left, Color.Black); //FlxG.Content.Load<SpriteFont> ("")
            add(gamesDisplay);

            status = new FlxText(2, 2, 200);
            status.setFormat(FlxG.Content.Load <SpriteFont>("flixel/initials/SMALL_PIXEL"), 1, Color.Red, FlxJustification.Left, Color.Black); //FlxG.Content.Load<SpriteFont> ("")
            add(status);
        }
コード例 #6
0
        public Hud(int xPos, int yPos)
            : base(xPos, yPos)
        {
            loadGraphic(FlxG.Content.Load <Texture2D>("Lemonade/currentChar"), true, false, 14, 28);

            setScrollFactors(0, 0);

            addAnimation("andre", new int[] { 2 }, 0, true);

            play("andre");


            coin = new Coin(FlxG.width - 24, 2, true);
            coin.setScrollFactors(0, 0);

            coinCounter = new FlxText(FlxG.width - 36, 10, 100);
            coinCounter.setFormat(null, 1, Lemonade_Globals.GAMEBOY_COLOR_4, FlxJustification.Left, Lemonade_Globals.GAMEBOY_COLOR_1);
            coinCounter.alignment = FlxJustification.Left;
            coinCounter.setScrollFactors(0, 0);

            toastySprite = new FlxSprite(0, FlxG.height);

            string person = "Lemonade/illustration/andre_drawing";
            int    ran    = (int)FlxU.random(0, 4);

            switch (ran)
            {
            case 0:
                person = "Lemonade/illustration/andre_drawing";
                break;

            case 1:
                person = "Lemonade/illustration/liselot_drawing";
                break;

            case 2:
                person = "Lemonade/illustration/army_drawing";
                break;

            case 3:
                person = "Lemonade/illustration/worker_drawing";
                break;

            default:
                person = "Lemonade/illustration/andre_drawing";
                break;
            }

            toastySprite.loadGraphic(person, false, false, 302, 640);
            toastySprite.setScrollFactors(0, 0);

            tween = new Tweener(4, 12, 1, Quadratic.EaseInOut);
            tween.Start();
            tween.PingPong = true;

            powerBar = new FlxGroup();

            for (int i = 0; i < 30; i++)
            {
                int offsetY = 0;
                int offsetS = 0;

                                #if __ANDROID__
                offsetY = 50;
                offsetS = 150;
                                #endif

                FlxSprite bar = new FlxSprite(offsetS + 5 + (i * 10), FlxG.height - 10 - offsetY);
                bar.createGraphic(8, 8, Lemonade_Globals.GAMEBOY_COLOR_4);
                bar.setScrollFactors(0, 0);
                powerBar.add(bar);
            }
        }
コード例 #7
0
        override public void create()
        {
            base.create();

            Lemonade_Globals.totalCoins = Lemonade_Globals.calculateTotalCoins();

            FlxTilemap bgMap = new FlxTilemap();

            bgMap.auto        = FlxTilemap.STRING;
            bgMap.indexOffset = -1;
            bgMap.loadTMXMap("Lemonade/levels/slf2/newyork/newyork_intro.tmx", "map", "bg", FlxXMLReader.TILES, FlxG.Content.Load <Texture2D>("Lemonade/bgtiles_newyork"), 20, 20);
            bgMap.boundingBoxOverride = false;
            bgMap.setScrollFactors(1, 1);
            add(bgMap);

            bgMap             = new FlxTilemap();
            bgMap.auto        = FlxTilemap.STRING;
            bgMap.indexOffset = -1;
            bgMap.loadTMXMap("Lemonade/levels/slf2/newyork/newyork_intro.tmx", "map", "bg2", FlxXMLReader.TILES, FlxG.Content.Load <Texture2D>("Lemonade/bgtiles_newyork"), 20, 20);
            bgMap.boundingBoxOverride = false;
            bgMap.setScrollFactors(1, 1);
            add(bgMap);

            FlxTilemap bgMap3 = new FlxTilemap();

            bgMap3.auto        = FlxTilemap.STRING;
            bgMap3.indexOffset = -1;
            bgMap3.loadTMXMap("Lemonade/levels/slf2/newyork/newyork_intro.tmx", "map", "stars", FlxXMLReader.TILES, FlxG.Content.Load <Texture2D>("Lemonade/bgtiles_newyork"), 20, 20);
            bgMap3.boundingBoxOverride = false;
            bgMap3.setScrollFactors(0.5f, 0.5f);
            add(bgMap3);

            FlxTilemap bgMap4 = new FlxTilemap();

            bgMap4.auto        = FlxTilemap.STRING;
            bgMap4.indexOffset = -1;
            bgMap4.loadTMXMap("Lemonade/levels/slf2/newyork/newyork_intro.tmx", "map", "city", FlxXMLReader.TILES, FlxG.Content.Load <Texture2D>("Lemonade/bgtiles_newyork"), 20, 20);
            bgMap4.boundingBoxOverride = false;
            bgMap4.setScrollFactors(1, 1);
            add(bgMap4);

            follower         = new FlxSprite(400, 1500);
            follower.visible = false;
            add(follower);
            follower.velocity.Y = this.speed;

            FlxG.follow(follower, 20.0f);
            FlxG.followBounds(0, 0, int.MaxValue, 2000);

            int textSize = 2;

                        #if __ANDROID__
            textSize = 4;
                        #endif


            heading = new FlxText(0, 50, FlxG.width, "Collection Incomplete");
            heading.setFormat(FlxG.Content.Load <SpriteFont>("Lemonade/SMALL_PIXEL"), textSize, Lemonade_Globals.GAMEBOY_COLOR_4, FlxJustification.Center, Lemonade_Globals.GAMEBOY_COLOR_1);
            heading.setScrollFactors(0, 0);
            add(heading);



            string howWellDidYouGo = "Collected " + Lemonade_Globals.coins.ToString() + "\nfrom " + Lemonade_Globals.totalCoins.ToString() + " Coins ";
            credits = new FlxText(0, FlxG.height / 1.75f, FlxG.width, howWellDidYouGo);
            credits.setFormat(FlxG.Content.Load <SpriteFont>("Lemonade/SMALL_PIXEL"), textSize, Lemonade_Globals.GAMEBOY_COLOR_4, FlxJustification.Center, Lemonade_Globals.GAMEBOY_COLOR_1);
            credits.setScrollFactors(0, 0);
            credits.visible = false;
            add(credits);

            string ins = "Press X to Continue";
#if __ANDROID__
            ins = "Press O to Continue";
#endif

            instruction = new FlxText(0, FlxG.height / 1.3f, FlxG.width, ins);
            instruction.setFormat(FlxG.Content.Load <SpriteFont>("Lemonade/SMALL_PIXEL"), textSize, Lemonade_Globals.GAMEBOY_COLOR_4, FlxJustification.Center, Lemonade_Globals.GAMEBOY_COLOR_1);
            instruction.setScrollFactors(0, 0);
            instruction.visible = false;
            add(instruction);

            if (Lemonade_Globals.coins == Lemonade_Globals.totalCoins)
            {
                heading.setFormat(FlxG.Content.Load <SpriteFont>("Lemonade/SMALL_PIXEL"), textSize, Lemonade_Globals.GAMEBOY_COLOR_4, FlxJustification.Center, Lemonade_Globals.GAMEBOY_COLOR_1);
                heading.text = "Complete Collection!!\nThe Lemonade Factory is saved.";
                instruction.setFormat(FlxG.Content.Load <SpriteFont>("Lemonade/SMALL_PIXEL"), textSize, Lemonade_Globals.GAMEBOY_COLOR_4, FlxJustification.Center, Lemonade_Globals.GAMEBOY_COLOR_1);


                string ins2 = "Press X to Continue";
#if __ANDROID__
                ins2 = "Press O to Continue";
#endif

                instruction.text = ins2;

                //FlxU.openURL("http://initials.itch.io/slf2/download/Y9wdBOHe7a92Qpo9t5UJdz05HhZR5p10F0L6wfdP");
            }

            tween          = new Tweener(FlxG.height / 1.3f, FlxG.height / 1.2f, TimeSpan.FromSeconds(0.67f), XNATweener.Cubic.EaseInOut);
            tween.PingPong = true;
            tween.Start();

            // play some music
            FlxG.playMp3("Lemonade/music/March", 0.75f);

            rain = new FlxGroup();
            for (int i = 0; i < 150; i++)
            {
                FlxSprite rainDrop = new FlxSprite((FlxU.random() * FlxG.width * 2), -200 + (FlxU.random() * 1000));
                rainDrop.loadGraphic("Lemonade/rain", true, false, 2, 2);
                rainDrop.frame      = (int)FlxU.random(0, 6);
                rainDrop.velocity.Y = FlxU.random(350, 400);
                rain.add(rainDrop);
            }
            add(rain);

            splashes = new FlxEmitter();
            splashes.createSprites("Lemonade/rain", 150, true, 0.0f, 0.0f);
            splashes.setXSpeed(-25, 25);
            splashes.setYSpeed(-30, 0);
            splashes.gravity = 1.0f;
            add(splashes);
        }
コード例 #8
0
        override public void create()
        {
            base.create();

            Lemonade_Globals.totalCoins = Lemonade_Globals.calculateTotalCoins();

            Console.WriteLine("Total coins = {0}", Lemonade_Globals.totalCoins);

                        #if __ANDROID__
            FlxG.BUILD_TYPE = FlxG.BUILD_TYPE_OUYA;
                        #endif

            FlxTilemap bgMap = new FlxTilemap();
            bgMap.auto        = FlxTilemap.STRING;
            bgMap.indexOffset = -1;
            bgMap.loadTMXMap("Lemonade/levels/slf2/newyork/newyork_intro.tmx", "map", "bg", FlxXMLReader.TILES, FlxG.Content.Load <Texture2D>("Lemonade/bgtiles_newyork"), 20, 20);
            bgMap.boundingBoxOverride = false;
            bgMap.setScrollFactors(1, 1);
            add(bgMap);

            bgMap             = new FlxTilemap();
            bgMap.auto        = FlxTilemap.STRING;
            bgMap.indexOffset = -1;
            bgMap.loadTMXMap("Lemonade/levels/slf2/newyork/newyork_intro.tmx", "map", "bg2", FlxXMLReader.TILES, FlxG.Content.Load <Texture2D>("Lemonade/bgtiles_newyork"), 20, 20);
            bgMap.boundingBoxOverride = false;
            bgMap.setScrollFactors(1, 1);
            add(bgMap);

            FlxTilemap bgMap3 = new FlxTilemap();
            bgMap3.auto        = FlxTilemap.STRING;
            bgMap3.indexOffset = -1;
            bgMap3.loadTMXMap("Lemonade/levels/slf2/newyork/newyork_intro.tmx", "map", "stars", FlxXMLReader.TILES, FlxG.Content.Load <Texture2D>("Lemonade/bgtiles_newyork"), 20, 20);
            bgMap3.boundingBoxOverride = false;
            bgMap3.setScrollFactors(0.5f, 0.5f);
            add(bgMap3);

            FlxTilemap bgMap4 = new FlxTilemap();
            bgMap4.auto        = FlxTilemap.STRING;
            bgMap4.indexOffset = -1;
            bgMap4.loadTMXMap("Lemonade/levels/slf2/newyork/newyork_intro.tmx", "map", "city", FlxXMLReader.TILES, FlxG.Content.Load <Texture2D>("Lemonade/bgtiles_newyork"), 20, 20);
            bgMap4.boundingBoxOverride = false;
            bgMap4.setScrollFactors(1, 1);
            add(bgMap4);

            follower         = new FlxSprite(0, -100);
            follower.visible = false;
            add(follower);
            follower.velocity.Y = 450;

            FlxG.follow(follower, 20.0f);
            FlxG.followBounds(0, 0, int.MaxValue, 2000);

            FlxText text1 = new FlxText(0, FlxG.height / 2 - 50, FlxG.width, "Initials\nVideo\nGames\nPresents");
            text1.setFormat(FlxG.Content.Load <SpriteFont>("Lemonade/SMALL_PIXEL"), 2, Lemonade_Globals.GAMEBOY_COLOR_4, FlxJustification.Center, Lemonade_Globals.GAMEBOY_COLOR_1);
            text1.setScrollFactors(1.5f, 1.5f);

            add(text1);

            credits = new FlxText(0, FlxG.height / 2 - 100, FlxG.width, "A Game by\nShane Brouwer");
            credits.setFormat(FlxG.Content.Load <SpriteFont>("Lemonade/SMALL_PIXEL"), 2, Lemonade_Globals.GAMEBOY_COLOR_4, FlxJustification.Center, Lemonade_Globals.GAMEBOY_COLOR_1);
            credits.setScrollFactors(0, 0);
            credits.visible = false;
            add(credits);

            string ins = "Press X to Continue";
                        #if __ANDROID__
            ins = "Press O to Continue";
                        #endif

            instruction = new FlxText(0, FlxG.height / 1.3f, FlxG.width, ins);
            instruction.setFormat(FlxG.Content.Load <SpriteFont>("Lemonade/SMALL_PIXEL"), 2, Lemonade_Globals.GAMEBOY_COLOR_4, FlxJustification.Center, Lemonade_Globals.GAMEBOY_COLOR_1);
            instruction.setScrollFactors(0, 0);
            instruction.visible = false;
            add(instruction);

            tween          = new Tweener(FlxG.height / 1.3f, FlxG.height / 1.2f, TimeSpan.FromSeconds(0.67f), XNATweener.Cubic.EaseInOut);
            tween.PingPong = true;
            tween.Start();

            // play some music
            FlxG.playMp3("Lemonade/music/Beyond", 0.75f);

            rain = new FlxGroup();
            for (int i = 0; i < 150; i++)
            {
                FlxSprite rainDrop = new FlxSprite((FlxU.random() * FlxG.width), -200 + (FlxU.random() * 1000));
                rainDrop.loadGraphic("Lemonade/rain", true, false, 2, 2);
                rainDrop.frame      = (int)FlxU.random(0, 6);
                rainDrop.velocity.Y = FlxU.random(350, 400);
                rain.add(rainDrop);
            }
            add(rain);

            splashes = new FlxEmitter();
            splashes.createSprites("Lemonade/rain", 150, true, 0.0f, 0.0f);
            splashes.setXSpeed(-25, 25);
            splashes.setYSpeed(-30, 0);
            splashes.gravity = 1.0f;
            add(splashes);
        }
コード例 #9
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);
        }
コード例 #10
0
        override public void create()
        {
            base.create();

            FlxG.playMp3("Lemonade/music/AmbulanceCalls", 0.5f);

            block             = new FlxTileblock(0, 0, FlxG.width + 20, FlxG.height + 20);
            block.auto        = FlxTileblock.FRAMENUMBER;
            block.frameNumber = 6;
            block.setScrollFactors(0, 0);
            block.loadTiles(FlxG.Content.Load <Texture2D>("Lemonade/fade"), 20, 20, 0);

            add(block);

            icons    = new FlxGroup();
            tweeners = new List <Vector3Tweener>();

            for (int i = 0; i < 6; i++)
            {
                int offsetX  = 75;
                int offsetY  = 0;
                int offsetY2 = 0;

                                #if __ANDROID__
                offsetX  = 400;
                offsetY  = 100;
                offsetY2 = 120;
                                #endif

                FlxSprite p1 = new FlxSprite(0 + (i * 36) + offsetX, 12);
                p1.loadGraphic("Lemonade/illustration/people", true, false, 302, 640);
                p1.frame = i;
                icons.add(p1);
                tweeners.Add(new Vector3Tweener(new Vector3(-100 + (i * 36) + offsetX, -290 + offsetY2, 0.1f), new Vector3(12 + offsetY + offsetX, 100, 1), 0.45f, Bounce.EaseOut));
            }

            foreach (var item in tweeners)
            {
                item.Pause();
            }

            add(icons);

            switch (Lemonade_Globals.location)
            {
            case "warehouse":
                selected = 0;
                break;

            case "military":
                selected = 1;
                break;

            case "newyork":
                selected = 2;
                break;

            case "sydney":
                selected = 3;
                break;

            case "management":
                selected = 4;
                break;

            case "factory":
                selected = 5;
                break;

            default:
                selected = 0;
                break;
            }
            tweeners[selected].Play();

            timer = 5.0f;

            t1 = new FlxText(0, FlxG.height - 72, FlxG.width);
            t1.setFormat(null, 2, Lemonade_Globals.GAMEBOY_COLOR_1, FlxJustification.Center, Lemonade_Globals.GAMEBOY_COLOR_4);
            add(t1);

            t2 = new FlxText(0, 3, FlxG.width);
            t2.setFormat(null, 2, Lemonade_Globals.GAMEBOY_COLOR_1, FlxJustification.Center, Lemonade_Globals.GAMEBOY_COLOR_4);
            add(t2);
        }
コード例 #11
0
        override public void create()
        {
            base.create();

            rollIndicators = new FlxGroup();

            framesElapsed = 0;

            selected = 0;
            suggestionForClubNoted   = false;
            suggestionForForceNoted  = false;
            suggestionForClubStatus  = 0;
            suggestionForForceStatus = 0;
            selectedClub             = 0;
            playAgainSelected        = 0;

            Globals.ballInHole = false;


            //"Sand Wedge" }

            clubs = new List <string> {
                "Putter", "1 Wood", "3 Wood", "5 Wood",
                "1 Iron", "2 Iron", "3 Iron", "4 Iron", "5 Iron", "6 Iron", "7 Iron", "8 Iron", "9 Iron"
            };

            //, "Chip Shot", "Pitch", "Fade", "Draw", "Lay-up", "Knock Down", "Flop"
            force = new List <string> {
                "Feather Touch", "Firm Putt", "Power Drive"
            };

            playAgain = new List <string> {
                "Yes", "No", "Skip Hole +9"
            };

            game = new FlxSprite(0, 0);
            game.loadGraphic("putt/bg", true, false, 256, 224);
            game.boundingBoxOverride = false;

            add(game);



            ball = new Ball(FlxG.width / 2 - 8, FlxG.height - 24);


            hole = new Hole(FlxG.width / 2, FlxG.height / 2);

            // load the level.
            loadOgmo();


            add(hole);
            add(ball);


            lee = new Lee(FlxG.width / 6, FlxG.height - 170);
            add(lee);

            aim   = new Aim(1, FlxG.height / 2);
            aim.y = hole.y - aim.width;
            add(aim);

            power = new FlxBar(FlxG.width - 110, FlxG.height - 30, FlxBar.FILL_LEFT_TO_RIGHT, 80, 8, null, "", 0, 50, true);
            add(power);
            power.visible         = false;
            power.useCustomColors = true;


            sound = new FlxSound();
            sound.loadEmbedded(Globals.ContentFolder + "/sfx/welcome", false);

            if (Globals.hole == 1)
            {
                sound.play();
            }

            actionButton         = new ActionButton(FlxG.width - 40, FlxG.height - 40);
            actionButton.visible = false;
            add(actionButton);


            if (FlxG.debug && Globals.platform == "Touch")
            {
                FlxG.mouse.show();
            }
            if (Globals.platform == "Touch")
            {
                actionButton.visible = true;
            }


            add(rollIndicators);

            carPark         = new CarPark(0, 0);
            carPark.visible = false;
            add(carPark);

            text = new FlxText(22, 16, 200);
            text.setFormat(FlxG.Content.Load <SpriteFont>("flixel/initials/SMALL_PIXEL"), 1, Color.Yellow, FlxJustification.Left, Color.Black);

            add(text);

            subtitle = new FlxText(22, 2, FlxG.width);
            subtitle.setFormat(FlxG.Content.Load <SpriteFont>("flixel/initials/SMALL_PIXEL"), 1, Color.White, FlxJustification.Left, Color.Black);

            add(subtitle);

            activator = new Carrot((int)text.x - 11, (int)text.y);
            //activator.createGraphic(8, 8, Color.Violet);
            activator.visible = false;
            add(activator);

            log("Welcome to " + Globals.GameNameSplit);


            if (Globals.pirate && Globals.hole >= 4)
            {
                                #if !__IOS__
                FlxU.openURL("http://initialsgames.com/");


                FlxG.Game.Exit();
                                #endif
            }
        }
コード例 #12
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);
            }
        }
コード例 #13
0
        override public void create()
        {
            base.create();

#if __ANDROID__
            FlxG.BUILD_TYPE = FlxG.BUILD_TYPE_OUYA;
#endif

            FlxTilemap bgMap = new FlxTilemap();
            bgMap.auto        = FlxTilemap.STRING;
            bgMap.indexOffset = -1;
            bgMap.loadTMXMap("Lemonade/levels/slf2/newyork/newyork_intro.tmx", "map", "bg", FlxXMLReader.TILES, FlxG.Content.Load <Texture2D>("Lemonade/bgtiles_newyork"), 20, 20);
            bgMap.boundingBoxOverride = false;
            bgMap.setScrollFactors(1, 1);
            add(bgMap);

            bgMap             = new FlxTilemap();
            bgMap.auto        = FlxTilemap.STRING;
            bgMap.indexOffset = -1;
            bgMap.loadTMXMap("Lemonade/levels/slf2/newyork/newyork_intro.tmx", "map", "bg2", FlxXMLReader.TILES, FlxG.Content.Load <Texture2D>("Lemonade/bgtiles_newyork"), 20, 20);
            bgMap.boundingBoxOverride = false;
            bgMap.setScrollFactors(1, 1);
            add(bgMap);

            FlxTilemap bgMap3 = new FlxTilemap();
            bgMap3.auto        = FlxTilemap.STRING;
            bgMap3.indexOffset = -1;
            bgMap3.loadTMXMap("Lemonade/levels/slf2/newyork/newyork_intro.tmx", "map", "stars", FlxXMLReader.TILES, FlxG.Content.Load <Texture2D>("Lemonade/bgtiles_newyork"), 20, 20);
            bgMap3.boundingBoxOverride = false;
            bgMap3.setScrollFactors(0.5f, 0.5f);
            add(bgMap3);

            FlxTilemap bgMap4 = new FlxTilemap();
            bgMap4.auto        = FlxTilemap.STRING;
            bgMap4.indexOffset = -1;
            bgMap4.loadTMXMap("Lemonade/levels/slf2/newyork/newyork_intro.tmx", "map", "city", FlxXMLReader.TILES, FlxG.Content.Load <Texture2D>("Lemonade/bgtiles_newyork"), 20, 20);
            bgMap4.boundingBoxOverride = false;
            bgMap4.setScrollFactors(1, 1);
            add(bgMap4);

            follower         = new FlxSprite(0, -100);
            follower.visible = false;
            add(follower);
            follower.velocity.Y = 1450;
            follower.drag.Y     = 10;

            FlxG.follow(follower, 20.0f);
            FlxG.followBounds(0, 0, int.MaxValue, 2000);

            FlxText text1 = new FlxText(0, FlxG.height / 2 - 50, FlxG.width, "GAME OVER");
            text1.setFormat(FlxG.Content.Load <SpriteFont>("Lemonade/SMALL_PIXEL"), 2, Lemonade_Globals.GAMEBOY_COLOR_4, FlxJustification.Center, Lemonade_Globals.GAMEBOY_COLOR_1);
            text1.setScrollFactors(1.5f, 1.5f);

            add(text1);


            string howWellDidYouGo = "Collected " + Lemonade_Globals.coins.ToString() + " from " + Lemonade_Globals.totalCoins.ToString() + " Coins ";
            credits = new FlxText(0, FlxG.height / 2 - 100, FlxG.width, "");
            credits.setFormat(FlxG.Content.Load <SpriteFont>("Lemonade/SMALL_PIXEL"), 2, Lemonade_Globals.GAMEBOY_COLOR_4, FlxJustification.Center, Lemonade_Globals.GAMEBOY_COLOR_1);
            credits.setScrollFactors(0, 0);
            credits.visible = true;
            add(credits);

            string ins = "Press X to Continue";
#if __ANDROID__
            ins = "Press O to Continue";
#endif

            instruction = new FlxText(0, FlxG.height / 1.3f, FlxG.width, ins);
            instruction.setFormat(FlxG.Content.Load <SpriteFont>("Lemonade/SMALL_PIXEL"), 2, Lemonade_Globals.GAMEBOY_COLOR_4, FlxJustification.Center, Lemonade_Globals.GAMEBOY_COLOR_1);
            instruction.setScrollFactors(0, 0);
            instruction.visible = true;
            add(instruction);


            //rgb(237, 0, 142)

            tween          = new Tweener(FlxG.height / 1.3f, FlxG.height / 1.2f, TimeSpan.FromSeconds(1.0f), XNATweener.Cubic.EaseInOut);
            tween.PingPong = true;
            tween.Start();

            // play some music
            FlxG.playMp3("Lemonade/music/Lemonade1989Theme", 0.75f);

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