Example #1
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);
        }
Example #2
0
        protected override void Create()
        {
            BackgroundColor    = Color.Gray;
            VisibleBoundingbox = true;
            spriteA            = new FlxSprite(10, 10);
            spriteA.MakeGraphic(128, 128, Color.White);
            spriteA.ScrollFactor = Vector2.Zero;

            spriteB = new FlxSprite(200, 400);
            spriteB.MakeGraphic(160, 16, Color.Yellow);
            spriteB.Immovable    = true;
            spriteB.ScrollFactor = new Vector2(0.5f, 0.5f);

            text1 = new FlxText("Font");

            text2           = new FlxText("Font", 0, 0, FlxG.Width);
            text2.Alignment = FlxTextAlign.LEFT;

            text3           = new FlxText("Font", 0, 0, FlxG.Width);
            text3.Alignment = FlxTextAlign.CENTER;

            text4           = new FlxText("Font", 0, 0, FlxG.Width);
            text4.Alignment = FlxTextAlign.RIGHT;

            text5             = new FlxText("BigFont", 0, 0, FlxG.Width, "Hello World");
            text5.BorderStyle = FlxTextBorderStyle.SHADOW;
            text5.BorderColor = Color.Black;
            text5.BorderSize  = 4;
            text5.ScreenCenter();

            text1.X = 10;
            text1.Y = FlxG.Height - 40;
            text2.X = 10;
            text2.Y = FlxG.Height - 20;
            text3.X = 10;
            text3.Y = FlxG.Height - 60;
            text4.X = 10;
            text4.Y = FlxG.Height - 80;

            flxBar = new FlxBar(50, 50);
            flxBar.CreateFilledBar(Color.DarkBlue, Color.Cyan, true, Color.Black);
            flxBar.Value = 40;
            flxBar.SetParent(spriteA, null, true, (int)(spriteA.FrameWidth - flxBar.Width) / 2, -20);

            Add(spriteA);
            Add(spriteB);
            Add(text1);
            Add(text2);
            Add(text3);
            Add(text4);
            Add(text5);
            Add(flxBar);
        }
Example #3
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
            }
        }