예제 #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
        public Ball(int xPos, int yPos)
            : base(xPos, yPos)
        {
            loadGraphic("putt/ball_8x8", false, false, 8, 8);
            addAnimationsFromGraphicsGaleCSV("content/putt/ball_8x8.csv");
            play("size2");


            //setDrags(10, 10);

            dragMultiplier = 10;

            width  = 4;
            height = 2;
            setOffset(2, 6);

            heightOffGround = 0;

            shadow = new FlxSprite(xPos, yPos);
            shadow.loadGraphic("putt/ball_8x8", false, false, 8, 8);
            shadow.color = Color.Black;
            shadow.alpha = 0.1f;
            rise         = false;

            normalizedDrags = new Vector2(0, 0);
        }
예제 #3
0
        override public void create()
        {
            base.create();

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

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

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

            g1 = new FlxSprite(0, 700);
            g1.loadGraphic("flixel/diagnostic/testpalette", true, false, 1000, 20);
            add(g1);

            for (int i = 0; i < 40; i++)
            {
                FarSprite f = new FarSprite(Convert.ToInt32(FlxU.random(90, 800)), Convert.ToInt32(FlxU.random(-600, 0)), _world);
                f.loadGraphic("flixel/initials/crate_80x60", true, false, FlxU.randomInt(20, 40), FlxU.randomInt(40, 60));
                f._body.AngularVelocity = FlxU.randomInt(0, 5);
                add(f);
            }


            List <Dictionary <string, string> > completeSet = new List <Dictionary <string, string> >();

            string currentLevel = "l" + FlxG.level.ToString();

            XDocument xdoc = XDocument.Load("Content/flixel/ogmo/PhysicsLevel.oel");

            // Load level main stats.
            XElement xelement = XElement.Load("Content/flixel/ogmo/PhysicsLevel.oel");
            IEnumerable <XAttribute> attList =
                from at in xelement.Attributes()
                select at;

            foreach (XAttribute xAttr in attList)
            {
                //Console.WriteLine(xAttr.Name.ToString() + "  " + xAttr.Value.ToString());
                //levelAttrs.Add(xAttr.Name.ToString(), xAttr.Value.ToString());
            }

            foreach (XElement xEle in xdoc.Descendants("level").Descendants("NewLayer0").Elements())
            {
                Console.WriteLine(xEle.Name.ToString() + "  " + xEle.Attribute("x").ToString().Split('=')[1].Replace('\"', ' '));


                FarSprite f = new FarSprite(
                    Convert.ToInt32(xEle.Attribute("x").ToString().Split('=')[1].Replace('\"', ' ')) + 500,
                    Convert.ToInt32(xEle.Attribute("y").ToString().Split('=')[1].Replace('\"', ' ')) + 220,
                    _world);

                f.loadGraphic("flixel/initials/crate_80x60", true, false,
                              Convert.ToInt32(xEle.Attribute("width").ToString().Split('=')[1].Replace('\"', ' ')),
                              Convert.ToInt32(xEle.Attribute("height").ToString().Split('=')[1].Replace('\"', ' ')));

                add(f);
            }
        }
예제 #4
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);
        }
예제 #5
0
        override public void create()
        {
            base.create();

            FlxSprite robot = new FlxSprite(0, 0);

            robot.loadGraphic("flixel/surt/race_or_die", true, false, 64, 64);
            robot.addAnimation("static", new int[] { 7 }, 0, true);
            robot.play("static");
            add(robot);

            robot.angle = 210;
            robot.setVelocityFromAngle(100);



            robot = new FlxSprite(200, 0);
            robot.loadGraphic("flixel/surt/race_or_die", true, false, 64, 64);
            robot.addAnimation("static", new int[] { 10 }, 0, true);
            robot.play("static");
            add(robot);

            robot.setVelocity(-30, 100);
            robot.setAngleFromVelocity();
        }
예제 #6
0
        //creates a new coin located on the specified tile
        public void createCoin(int X, int Y)
        {
            FlxSprite coin = new FlxSprite(X * 8 + 3, Y * 8 + 2);

            coin.makeGraphic(2, 4, FlxColor.YELLOW);
            coins.add(coin);
        }
예제 #7
0
        void AddSegment()
        {
            FlxSprite segment = new FlxSprite(-20, -20);

            segment.MakeGraphic(BLOCK_SIZE - 2, BLOCK_SIZE - 2, Color.Green);
            segment.DebugColor = Color.Yellow;
            _snakeBody.Add(segment, true);
        }
예제 #8
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);
        }
예제 #9
0
 public FlxConsole()
     : base()
 {
     bg = new FlxSprite(80, 40);
     bg.makeGraphic((uint)FlxS.GraphicsDevice.Viewport.Width - 160, (uint)FlxS.GraphicsDevice.Viewport.Height - 80, FlxColor.WHITE * 0.45f);
     bg.Alpha = 0.5f;
     add(bg);
     ScrollFactor.X = ScrollFactor.Y = 0;
     Visible = false;
     text = new FlxText(100, 60, FlxS.GraphicsDevice.Viewport.Width - 160, "internal console is a work in progress", FlxG.defaultFont);
     text.setFormat(FlxColor.WHITE);
     text.Alpha = 0.75f;
     add(text);
 }
예제 #10
0
        override public void create()
        {
            base.create();

            for (int i = 0; i < 40; i++)
            {
                for (int y = 0; y < 40; y++)
                {
                    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");

                    add(x);
                }
            }

            FlxTilemap t   = new FlxTilemap();
            string     map = "0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0\n";

            map += "0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0\n";
            map += "0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0\n";
            map += "0,0,1,0,0,0,0,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0\n";
            map += "0,0,1,0,0,0,0,1,0,1,0,1,0,0,0,1,0,1,0,0,0,1,0,1,1,1,1,1,0,1,1,1,0,0,0,0,0\n";
            map += "0,0,1,0,0,0,0,1,0,1,0,1,1,0,0,1,0,1,1,0,0,1,0,1,0,0,0,0,0,1,0,0,1,0,0,0,0\n";
            map += "0,0,1,0,1,0,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,1,0,0,0,0,1,1,1,1,0,0,0,0\n";
            map += "0,0,1,0,1,0,0,1,0,1,0,1,0,0,1,1,0,1,0,0,1,1,0,1,0,0,0,0,0,1,0,1,0,0,0,0,0\n";
            map += "0,0,0,1,0,1,1,0,0,1,0,1,0,0,0,1,0,1,0,0,0,1,0,1,1,1,1,0,0,1,0,0,1,0,0,0,0\n";
            map += "0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0\n";
            map += "0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0\n";
            map += "0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0\n";
            map += "0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0\n";
            map += "0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0\n";
            map += "0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0\n";
            map += "0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0\n";
            map += "0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0\n";
            map += "0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0\n";
            map += "0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0\n";
            map += "0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0\n";
            map += "0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0\n";
            map += "0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0\n";
            map += "0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0\n";
            map += "0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0\n";
            map += "0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0\n";


            t.auto = FlxTilemap.AUTO;
            t.loadMap(map, FlxG.Content.Load <Texture2D>("autotilesIsland"), 8, 8);
            add(t);
        }
예제 #11
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);
        }
예제 #12
0
        override public void create()
        {
            base.create();

            menu = new FlxSprite(0, 0);
            menu.loadGraphic(Globals.ContentFolder + "/menu", true, false, 256, 224);
            add(menu);

            toPlay = false;
            FlxG.playMp3("putt/music/GreenlandIsAlive", 1.0f);

            toStart = false;

            FlxGlobal.cheatString = "";
        }
예제 #13
0
 public static bool PixelPerfectOverlap(FlxSprite spriteA, FlxSprite spriteB)
 {
     if (spriteA.BoundingBox.Intersects(spriteB.BoundingBox))
     {
         return(IntersectPixels(
                    spriteA.TransformMatrix,
                    (int)spriteA.Width,
                    (int)spriteA.Height,
                    spriteA.BitmapData,
                    spriteB.TransformMatrix,
                    (int)spriteB.Width,
                    (int)spriteB.Height,
                    spriteB.BitmapData));
     }
     return(false);
 }
예제 #14
0
        protected override void Create()
        {
            base.Create();

            closeBtn = new FlxButton(FlxG.Width * 0.5f - 40f, FlxG.Height * 0.5f, "Close", OnClick);
            Add(closeBtn);

            switchParentDrawingBtn = new FlxButton(closeBtn.X, closeBtn.Y + 40, "SwitchDraw", OnSwitchDraw);
            Add(switchParentDrawingBtn);

            switchParentUpdatingBtn = new FlxButton(switchParentDrawingBtn.X, switchParentDrawingBtn.Y + 40, "SwitchUpdate", OnSwitchUpdate);
            Add(switchParentUpdatingBtn);

            testSprite            = new FlxSprite(0, 10);
            testSprite.Velocity.X = 20;
            Add(testSprite);
        }
예제 #15
0
        public override void create()
        {
            base.create();

            //FlxG.addCamera(new FlxCamera(50, 50, 500, 500));

            //defaultLogo = new FlxSprite(FlxG.width / 2, FlxG.height / 2);
            ////defaultLogo.scaling = new FlxPoint(10, 10);
            //this.add(defaultLogo);

            //block = new FlxSprite(0, 0);
            //block.makeGraphic(100, 100, FlxColor.CYAN);
            //this.add(block);

            //block2 = new FlxSprite(100, 0);
            //block2.makeGraphic(100, 100, FlxColor.GREEN);
            //this.add(block2);

            //block3 = new FlxSprite(0, 100);
            //block3.makeGraphic(100, 100, FlxColor.INDIGO);
            //block3.drawLine(0, 0, 99, 99, FlxColor.BLACK, 1);
            //this.add(block3);

            //block4 = new FlxSprite(100, 100);
            //block4.makeGraphic(100, 100, FlxColor.PINK);
            //this.add(block4);

            background = new FlxSprite(0, 0, FlxS.ContentManager.Load <Texture2D>("bg"));
            this.add(background);

            megaman = new FlxSprite(50, 150);
            //megaman.loadGraphic(FlxS.ContentManager.Load<Texture2D>("megaman_run_test"), true, false, 49, 49);
            megaman.loadGraphic(FlxS.ContentManager.Load <Texture2D>("megaman_run"), true, false, 49, 49);
            megaman.addAnimation("run", new[] { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1 }, 12);
            megaman.play("run", true);
            this.add(megaman);

            //FlxG.playMusic(FlxS.ContentManager.Load<SoundEffect>("applause"));
            //FlxG.play(FlxS.ContentManager.Load<SoundEffect>("background")); // change content processor to soundeffect

            //DoFlash();
            DoQuake();
        }
        public override void create()
        {
            FlxG.debug = true;

            // The grass background
            FlxSprite grass = new FlxSprite(0, 0).loadGraphic(ImgGrass, false, false, FlxG.width, FlxG.height);

            add(grass);

            add(_bunnies = new FlxGroup());


            // Text display
            add(_bunnyCounter = new FlxText(0, FlxG.height - 20, FlxG.width).setFormat(null, 8, Color.White, "right", Color.Black));
            add(_memoryUsage  = new FlxText(5, FlxG.height - 20, 200).setFormat(null, 8, Color.White, "left", Color.Black));

            // Buttons Left side
            float leftBtnY = 20;

            add(new FlxButton(leftBtnY, 25, "+" + INITIAL_AMOUNT, addBunnies));
            add(new FlxButton(leftBtnY, 50, "-" + INITIAL_AMOUNT, removeBunnies));

            // Buttons right side
            float rightBtnX = FlxG.width - 100;

            add(_complexityButton = new FlxButton(rightBtnX, 25, "Complex", ComplexityCallback));
            add(_collisionButton  = new FlxButton(rightBtnX, 65, "Collision ON", CollisionCallback));

            // Finally create the bunnies
            addBunnies();

            // Force GC
            GC.Collect();

            // Timer to update the memory usage
            _memoryTimer = new FlxTimer();
            updateMemoryUsage();

            // Show mouse pointer
            FlxG.mouse.show();
        }
예제 #17
0
        protected override void Create()
        {
            //VisibleHitbox = true;
            int screenMiddleX = (int)Math.Floor(FlxG.Width / 2f);
            int screenMiddleY = (int)Math.Floor(FlxG.Height / 2f);

            _snakeHead = new FlxSprite(screenMiddleX - BLOCK_SIZE * 2, screenMiddleY);
            _snakeHead.MakeGraphic(BLOCK_SIZE - 2, BLOCK_SIZE - 2, Color.Lime);
            _snakeHead.DebugColor = Color.Yellow;
            OffsetSprite(_snakeHead);

            _headPositions = new List <Vector2>
            {
                new Vector2(_snakeHead.X, _snakeHead.Y)
            };

            _snakeBody = new FlxSpriteGroup();
            Add(_snakeBody);

            for (int i = 0; i < 3; i++)
            {
                AddSegment();
                MoveSnake();
            }

            Add(_snakeHead);

            _fruit = new FlxSprite();
            _fruit.MakeGraphic(BLOCK_SIZE - 2, BLOCK_SIZE - 2, Color.Red);
            RandomizeFruitPosition();
            OffsetSprite(_fruit);
            Add(_fruit);

            _scoreText = new FlxText(0, 0, 200, "Score: " + _score);
            Add(_scoreText);

            ResetTimer();

            _gameOverSound = Game.Content.Load <SoundEffect>(FlxAssets.SOUND_FLIXEL);
            _beepSound     = Game.Content.Load <SoundEffect>(FlxAssets.SOUND_BEEP);
        }
예제 #18
0
        public static FlxSprite ScreenWrap(FlxSprite sprite, bool left = true, bool right = true, bool top = true, bool bottom = true)
        {
            if (left && ((sprite.X + sprite.FrameWidth / 2) <= 0))
            {
                sprite.X = FlxG.Width;
            }
            else if (right && (sprite.X >= FlxG.Width))
            {
                sprite.X = 0;
            }

            if (top && ((sprite.Y + sprite.FrameHeight / 2) <= 0))
            {
                sprite.Y = FlxG.Height;
            }
            else if (bottom && (sprite.Y >= FlxG.Height))
            {
                sprite.Y = 0;
            }
            return(sprite);
        }
예제 #19
0
 /// <summary>
 /// Creates a new <code>FlxButton</code> object with a gray background
 /// and a callback function on the UI thread.
 /// </summary>
 /// <param name="x">The X position of the button.</param>
 /// <param name="y">The Y position of the button.</param>
 /// <param name="callback">The function to call whenever the button is clicked.</param>   	
 public FlxButton(int x, int y, FlxButtonClick callback)
 {
     X = x;
     Y = y;
     Width = 100;
     Height = 20;
     _off = new FlxSprite().CreateGraphic((int)Width, (int)Height, new Color(0x7f, 0x7f, 0x7f));
     _off.Solid = false;
     Add(_off, true);
     _on = new FlxSprite().CreateGraphic((int)Width, (int)Height, Color.White);
     _on.Solid = false;
     Add(_on, true);
     _offT = null;
     _onT = null;
     _callback = callback;
     _onToggle = false;
     _pressed = false;
     _initialized = false;
     _sf = Vector2.Zero;
     PauseProof = false;
 }
예제 #20
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;
        }
예제 #21
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);
        }
예제 #22
0
        override public void create()
        {
            FlxG.backColor = Color.DarkGreen;

            base.create();

            FlxCamera cam1 = new FlxCamera(0, 0, FlxG.width / 2, FlxG.height, 1);

            cam1.color = Color.Blue;
            FlxG.cameras.Add(cam1);

            FlxCamera cam2 = new FlxCamera(FlxG.width / 2, 0, FlxG.width / 2, FlxG.height, 1);

            cam2.color = Color.GreenYellow;
            FlxG.cameras.Add(cam2);

            FlxTilemap t = new FlxTilemap();

            t.auto = FlxTilemap.AUTO;
            t.loadMap("1,0,1,1,1,1,1,0,0,0,0,0,1,0,1,1,1,1,1,0,0,0,0,0,1,1,0,1,1,1,1,1,0,0,0,0,0,1,0,1,1,1,1,1,0,0,0,0,0,1,1,0,1,1,1,1,1,0,0,0,0,0,1,0,1,1,1,1,1,0,0,0,0,0,1,1,0,1,1,1,1,1,0,0,0,0,0,1,0,1,1,1,1,1,0,0,0,0,0,1\n1,0,1,1,1,1,1,0,0,0,0,0,1,0,1,1,1,1,1,0,0,0,0,0,1,1,0,1,1,1,1,1,0,0,0,0,0,1,0,1,1,1,1,1,0,0,0,0,0,1,1,0,1,1,1,1,1,0,0,0,0,0,1,0,1,1,1,1,1,0,0,0,0,0,1,1,0,1,1,1,1,1,0,0,0,0,0,1,0,1,1,1,1,1,0,0,0,0,0,1\n1,0,1,1,1,1,1,0,0,0,0,0,1,0,1,1,1,1,1,0,0,0,0,0,1,1,0,1,1,1,1,1,0,0,0,0,0,1,0,1,1,1,1,1,0,0,0,0,0,1,1,0,1,1,1,1,1,0,0,0,0,0,1,0,1,1,1,1,1,0,0,0,0,0,1,1,0,1,1,1,1,1,0,0,0,0,0,1,0,1,1,1,1,1,0,0,0,0,0,1\n1,0,1,1,1,1,1,0,0,0,0,0,1,0,1,1,1,1,1,0,0,0,0,0,1,1,0,1,1,1,1,1,0,0,0,0,0,1,0,1,1,1,1,1,0,0,0,0,0,1,1,0,1,1,1,1,1,0,0,0,0,0,1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,0,1,0,1,1,1,1,1,0,0,0,0,0,1\n",
                      FlxG.Content.Load <Texture2D>("flixel/autotiles"),
                      8,
                      8);

            add(t);

            FlxSprite s = new FlxSprite(0, 0, FlxG.Content.Load <Texture2D>("flixel/initials/initialsLogo"));

            add(s);
            s.velocity.X = 150;
            s.velocity.Y = 50;


            FlxG.follow(s, 10.0f);
            FlxG.followBounds(0, 0, 2000, 2000);
        }
예제 #23
0
        private void setupPlayer()
        {
            player = new FlxSprite(64, 220);
            player.loadGraphic(ImgSpaceman, true, true, 16);

            //bounding box tweaks
            player.Width    = 14;
            player.Height   = 14;
            player.Offset.X = 1;
            player.Offset.Y = 1;

            //basic player physics
            player.Drag.X         = 640;
            player.Acceleration.Y = 420;
            player.MaxVelocity.X  = 80;
            player.MaxVelocity.Y  = 200;

            //animations
            player.addAnimation("idle", new int[] { 0 });
            player.addAnimation("run", new int[] { 1, 2, 3, 0 }, 12);
            player.addAnimation("jump", new int[] { 4 });

            add(player);
        }
예제 #24
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);
        }
예제 #25
0
        public override void create()
        {
            // Background color
            FlxG.bgColor     = (FlxColor.GREEN);
            FlxG.worldBounds = new FlxRect(0, 0, 320, 240);

            //Design your platformer level with 1s and 0s (at 40x30 to fill 320x240 screen)
            int[] data =
            {
                1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
                1, 1, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1,
                1, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1,
                1, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1,
                1, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1,
                1, 0, 0, 1, 1, 1, 0, 0, 1, 1, 1, 1, 1, 1, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1,
                1, 0, 0, 0, 1, 1, 0, 0, 1, 1, 1, 1, 1, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0, 1,
                1, 0, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 1,
                1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1,
                1, 0, 0, 0, 0, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1,
                1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1,
                1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1,
                1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 1,
                1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 1,
                1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1,
                1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1,
                1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1,
                1, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1,
                1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 1,
                1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 1,
                1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 1, 1, 1, 1, 1, 0, 0, 1,
                1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
                1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
                1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1,
                1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1,
                1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1,
                1, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1,
                1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 1, 1, 1, 1, 1, 0, 1, 0, 1, 1, 1, 1, 1, 0, 0, 0, 1, 1, 1, 1, 0, 1,
                1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 1,
                1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1
            };

            //Create a new tilemap using our level data
            level = new FlxTilemap();
            level.loadMap(FlxTilemap.arrayToCSV(data, 40), FlxTilemap.ImgAuto, 0, 0, FlxTilemap.AUTO);
            add(level);

            //Create the level exit, a dark gray box that is hidden at first
            exit = new FlxSprite(35 * 8 + 1, 25 * 8);
            exit.makeGraphic(14, 16, FlxColor.BLUE);
            exit.Exists = false;
            add(exit);

            //Create coins to collect (see createCoin() function below for more info)
            coins = new FlxGroup();
            //Top left coins
            createCoin(18, 4);
            createCoin(12, 4);
            createCoin(9, 4);
            createCoin(8, 11);
            createCoin(1, 7);
            createCoin(3, 4);
            createCoin(5, 2);
            createCoin(15, 11);
            createCoin(16, 11);

            //Bottom left coins
            createCoin(3, 16);
            createCoin(4, 16);
            createCoin(1, 23);
            createCoin(2, 23);
            createCoin(3, 23);
            createCoin(4, 23);
            createCoin(5, 23);
            createCoin(12, 26);
            createCoin(13, 26);
            createCoin(17, 20);
            createCoin(18, 20);

            //Top right coins
            createCoin(21, 4);
            createCoin(26, 2);
            createCoin(29, 2);
            createCoin(31, 5);
            createCoin(34, 5);
            createCoin(36, 8);
            createCoin(33, 11);
            createCoin(31, 11);
            createCoin(29, 11);
            createCoin(27, 11);
            createCoin(25, 11);
            createCoin(36, 14);

            //Bottom right coins
            createCoin(38, 17);
            createCoin(33, 17);
            createCoin(28, 19);
            createCoin(25, 20);
            createCoin(18, 26);
            createCoin(22, 26);
            createCoin(26, 26);
            createCoin(30, 26);

            add(coins);

            //Create player (a red box)
            player = new FlxSprite(FlxG.width / 2 - 5);
            player.makeGraphic(10, 12, FlxColor.RED);
            player.MaxVelocity.X  = 80;
            player.MaxVelocity.Y  = 200;
            player.Acceleration.Y = 200;
            player.Drag.X         = player.MaxVelocity.X * 4;
            add(player);

            score = new FlxText(2, 2, 80, "SCORE: ");
            //score.setShadow(FlxColor.BLACK);
            score.text = "SCORE: " + (coins.CountDead() * 100);
            add(score);

            status = new FlxText(FlxG.width - 160 - 2, 2, 160);
            //status.setShadow(0xff000000);
            //status.setAlignment("right");
            switch (FlxG.score)
            {
            case 0:
                status.text = "Collect coins.";
                break;

            case 1:
                status.text = "Aww, you died!";
                break;
            }
            add(status);
        }
예제 #26
0
        private void InitConsole()
        {
            //initialize the debug console
            _console = new FlxConsole(targetLeft, targetWidth);

            _console.log(FlxG.LIBRARY_NAME +
                         " v" + FlxG.LIBRARY_MAJOR_VERSION.ToString() + "." + FlxG.LIBRARY_MINOR_VERSION.ToString());
            _console.log("---------------------------------------");

            //Pause screen popup
            _pausePanel = new FlxPause();
            if (_helpStrings != null)
            {
                _pausePanel.helpX = _helpStrings[0];
                _pausePanel.helpC = _helpStrings[1];
                _pausePanel.helpMouse = _helpStrings[2];
                _pausePanel.helpArrows = _helpStrings[3];
            }

            //Sound Tray popup
            _soundTrayRect = new Rectangle((FlxG.width - 80) / 2, -30, 80, 30);
            _soundTrayVisible = false;

            _soundCaption = new FlxText((FlxG.width - 80) / 2, -10, 80, "VOLUME");
            _soundCaption.SetFormat(null, 1, Color.White, FlxJustification.Center, Color.White).Height = 10;

            int bx = 10;
            int by = 14;
            _soundTrayBars = new FlxSprite[10];
            for(int i = 0; i < 10; i++)
            {
                _soundTrayBars[i] = new FlxSprite(_soundTrayRect.X + (bx * 1), -i, null);
                _soundTrayBars[i].Width = 4;
                _soundTrayBars[i].Height = i + 1;
                _soundTrayBars[i].scrollFactor = Vector2.Zero;
                bx += 6;
                by--;
            }
        }
예제 #27
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);
        }
예제 #28
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);
            }
        }
예제 #29
0
        override public void create()
        {
            FlxG.Framerate = 60;
            //FlxG.flashFramerate = 60;

            //Here we actually initialize out emitter
            //The parameters are        X   Y                Size (Maximum number of particles the emitter can store)
            theEmitter = new FlxEmitter(10, FlxG.height / 2, 200);

            //Now by default the emitter is going to have some properties set on it and can be used immediately
            //but we're going to change a few things.

            //First this emitter is on the side of the screen, and we want to show off the movement of the particles
            //so lets make them launch to the right.
            theEmitter.setXSpeed(100, 200);

            //and lets funnel it a tad
            theEmitter.setYSpeed(-50, 50);

            //Let's also make our pixels rebound off surfaces
            theEmitter.bounce = 0.8f;

            //Now let's add the emitter to the state.
            add(theEmitter);

            //Now it's almost ready to use, but first we need to give it some pixels to spit out!
            //Lets fill the emitter with some white pixels
            for (int i = 0; i < theEmitter.maxSize / 2; i++)
            {
                whitePixel = new FlxParticle();
                whitePixel.makeGraphic(2, 2, new Color(0xFF, 0xFF, 0xFF));
                whitePixel.Visible = false;                 //Make sure the particle doesn't show up at (0, 0)
                theEmitter.add(whitePixel);
                whitePixel = new FlxParticle();
                whitePixel.makeGraphic(1, 1, new Color(0xFF, 0xFF, 0xFF));
                whitePixel.Visible = false;
                theEmitter.add(whitePixel);
            }

            //Now let's setup some buttons for messing with the emitter.
            collisionButton = new FlxButton(0, FlxG.height - 22, "Collision", onCollision);
            add(collisionButton);
            gravityButton = new FlxButton(80, FlxG.height - 22, "Gravity", onGravity);
            add(gravityButton);
            quitButton = new FlxButton(FlxG.width - 80, FlxG.height - 22, "Quit", onQuit);
            add(quitButton);

            //I'll just leave this here
            topText = new FlxText(0, 2, FlxG.width, "Welcome");
            topText.setAlignment("center");
            add(topText);

            //Lets setup some walls for our pixels to collide against
            collisionGroup = new FlxGroup();
            wall           = new FlxSprite(100, (FlxG.height / 2) - 50);
            wall.makeGraphic(10, 100, new Color(0xFF, 0xFF, 0xFF, 0x50)); //Make it darker - easier on the eyes :)
            wall.Visible   = wall.Solid = false;                          //Set both the visibility AND the solidity to false, in one go
            wall.Immovable = true;                                        //Lets make sure the pixels don't push out wall away! (though it does look funny)
            collisionGroup.add(wall);
            //Duplicate our wall but this time it's a floor to catch gravity affected particles
            floor = new FlxSprite(10, 267);
            floor.makeGraphic((uint)FlxG.width - 20, 10, new Color(0xFF, 0xFF, 0xFF, 0x50));
            floor.Visible   = floor.Solid = false;
            floor.Immovable = true;
            collisionGroup.add(floor);

            //Please note that this demo makes the walls themselves not collide, for the sake of simplicity.
            //Normally you would make the particles have solid = true or false to make them collide or not on creation,
            //because in a normal environment your particles probably aren't going to change solidity at a mouse
            //click. If they did, you would probably be better suited with emitter.setAll("solid", true)
            //I just don't feel that setAll is applicable here(Since I would still have to toggle the walls anyways)

            //Don't forget to add the group to the state(Like I did :P)
            add(collisionGroup);

            //Now lets set our emitter free.
            //Params:        Explode, Particle Lifespan, Emit rate(in seconds)
            theEmitter.start(false, 3, .01f);

            //Let's re show the cursors
            FlxG.mouse.show();
            //Mouse.hide();
        }
예제 #30
0
 /// <summary>
 /// This function generates a new array of sprites to attach to the emitter.
 /// </summary>
 /// <param name="graphics">If you opted to not pre-configure an array of FlxSprite objects, you can simply pass in a particle image or sprite sheet.</param>
 /// <param name="quantity">The number of particles to generate when using the "create from image" option.</param>
 /// <param name="Multiple">Whether the image in the graphics param is a single particle or a bunch of particles (if it's a bunch, they need to be square!).</param>
 /// <param name="Collide">Whether the particles should be flagged as not 'dead' (non-colliding particles are higher performance).  0 means no collisions, 0-1 controls scale of particle's bounding box.</param>
 /// <param name="Bounce">Whether the particles should bounce after colliding with things.  0 means no bounce, 1 means full reflection.</param>
 /// <returns>his FlxEmitter instance (nice for chaining stuff together, if you're into that).</returns>
 public FlxEmitter CreateSprites(Texture2D graphics, int quantity, bool Multiple, float Collide, float Bounce)
 {
     members = new List<FlxObject>();
     int r;
     FlxSprite s;
     int tf = 1;
     float sw;
     float sh;
     if(Multiple)
     {
         s = new FlxSprite();
         s.LoadGraphic(graphics,true);
         tf = s.frames;
     }
     int i = 0;
     while(i < quantity)
     {
         if((Collide > 0) && (Bounce > 0))
             s = new FlxParticle(Bounce) as FlxSprite;
         else
             s = new FlxSprite();
         if(Multiple)
         {
             r = (int)(FlxU.random()*tf);
             //if(BakedRotations > 0)
             //    s.loadRotatedGraphic(graphics,BakedRotations,r);
             //else
             //{
             s.LoadGraphic(graphics,true);
             s.frame = r;
             //}
         }
         else
         {
             //if(BakedRotations > 0)
             //    s.loadRotatedGraphic(graphics,BakedRotations);
             //else
             s.LoadGraphic(graphics);
         }
         if(Collide > 0)
         {
             sw = s.Width;
             sh = s.Height;
             s.Width = (int)(s.Width * Collide);
             s.Height = (int)(s.Height * Collide);
             s.offset.X = (int)(sw-s.Width)/2;
             s.offset.Y = (int)(sh-s.Height)/2;
             s.Solid = true;
         }
         else
             s.Solid = false;
         s.Exists = false;
         s.scrollFactor = scrollFactor;
         Add(s);
         i++;
     }
     return this;
 }
예제 #31
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);
        }
예제 #32
0
        public CarPark(int xPos, int yPos)
            : base(xPos, yPos)
        {
            loadGraphic("putt/carPark", true, false, 256, 224);

            _path = new FlxPath();
            _path.add(0, 0);
            _path.add(13, 28);
            _path.add(39, 19);
            _path.add(63, 55);
            _path.add(84, 104);
            _path.add(83, 144);
            _path.add(103, 175);
            _path.add(105, 130);
            _path.add(110, 103);
            _path.add(132, 81);
            _path.add(156, 70);
            _path.add(165, 81);
            _path.add(173, 102);
            _path.add(176, 124);
            _path.add(179, 141);
            _path.add(181, 139);
            _path.add(186, 115);
            _path.add(201, 76);
            _path.add(225, 61);
            _path.add(800, 33);



            record = false;

            ball = new FlxSprite(0, 0);
            ball.loadGraphic("putt/ball_8x8", true, false, 8, 8);
            ball.frame = 2;

            ballPositionCounter = 0;

            ball.pathCornering = 100;



            ballPositions = new List <Vector2>();

            ballPositions.Add(new Vector2(8, 31));
            ballPositions.Add(new Vector2(8, 31));
            ballPositions.Add(new Vector2(8, 31));
            ballPositions.Add(new Vector2(7, 31));
            ballPositions.Add(new Vector2(7, 31));
            ballPositions.Add(new Vector2(7, 31));
            ballPositions.Add(new Vector2(7, 31));
            ballPositions.Add(new Vector2(7, 30));
            ballPositions.Add(new Vector2(7, 29));
            ballPositions.Add(new Vector2(11, 27));
            ballPositions.Add(new Vector2(17, 24));
            ballPositions.Add(new Vector2(20, 23));
            ballPositions.Add(new Vector2(23, 22));
            ballPositions.Add(new Vector2(27, 22));
            ballPositions.Add(new Vector2(31, 23));
            ballPositions.Add(new Vector2(37, 24));
            ballPositions.Add(new Vector2(43, 26));
            ballPositions.Add(new Vector2(48, 28));
            ballPositions.Add(new Vector2(53, 30));
            ballPositions.Add(new Vector2(58, 32));
            ballPositions.Add(new Vector2(64, 36));
            ballPositions.Add(new Vector2(73, 44));
            ballPositions.Add(new Vector2(79, 49));
            ballPositions.Add(new Vector2(86, 55));
            ballPositions.Add(new Vector2(92, 62));
            ballPositions.Add(new Vector2(97, 70));
            ballPositions.Add(new Vector2(101, 80));
            ballPositions.Add(new Vector2(107, 95));
            ballPositions.Add(new Vector2(109, 106));
            ballPositions.Add(new Vector2(113, 118));
            ballPositions.Add(new Vector2(116, 130));
            ballPositions.Add(new Vector2(121, 140));
            ballPositions.Add(new Vector2(126, 149));
            ballPositions.Add(new Vector2(132, 161));
            ballPositions.Add(new Vector2(136, 167));
            ballPositions.Add(new Vector2(138, 170));
            ballPositions.Add(new Vector2(139, 172));
            ballPositions.Add(new Vector2(139, 173));
            ballPositions.Add(new Vector2(139, 169));
            ballPositions.Add(new Vector2(137, 166));
            ballPositions.Add(new Vector2(135, 161));
            ballPositions.Add(new Vector2(134, 154));
            ballPositions.Add(new Vector2(133, 146));
            ballPositions.Add(new Vector2(132, 138));
            ballPositions.Add(new Vector2(131, 125));
            ballPositions.Add(new Vector2(130, 117));
            ballPositions.Add(new Vector2(130, 108));
            ballPositions.Add(new Vector2(130, 100));
            ballPositions.Add(new Vector2(131, 92));
            ballPositions.Add(new Vector2(137, 87));
            ballPositions.Add(new Vector2(141, 80));
            ballPositions.Add(new Vector2(144, 78));
            ballPositions.Add(new Vector2(146, 77));
            ballPositions.Add(new Vector2(149, 76));
            ballPositions.Add(new Vector2(152, 76));
            ballPositions.Add(new Vector2(156, 76));
            ballPositions.Add(new Vector2(161, 78));
            ballPositions.Add(new Vector2(163, 82));
            ballPositions.Add(new Vector2(164, 88));
            ballPositions.Add(new Vector2(165, 95));
            ballPositions.Add(new Vector2(166, 103));
            ballPositions.Add(new Vector2(166, 116));
            ballPositions.Add(new Vector2(166, 123));
            ballPositions.Add(new Vector2(168, 128));
            ballPositions.Add(new Vector2(169, 130));
            ballPositions.Add(new Vector2(171, 130));
            ballPositions.Add(new Vector2(171, 130));
            ballPositions.Add(new Vector2(172, 128));
            ballPositions.Add(new Vector2(172, 122));
            ballPositions.Add(new Vector2(173, 116));
            ballPositions.Add(new Vector2(175, 110));
            ballPositions.Add(new Vector2(177, 103));
            ballPositions.Add(new Vector2(179, 96));
            ballPositions.Add(new Vector2(182, 85));
            ballPositions.Add(new Vector2(184, 79));
            ballPositions.Add(new Vector2(186, 73));
            ballPositions.Add(new Vector2(189, 67));
            ballPositions.Add(new Vector2(192, 61));
            ballPositions.Add(new Vector2(199, 54));
            ballPositions.Add(new Vector2(201, 51));
            ballPositions.Add(new Vector2(204, 48));
            ballPositions.Add(new Vector2(207, 45));
            ballPositions.Add(new Vector2(211, 44));
            ballPositions.Add(new Vector2(213, 44));
            ballPositions.Add(new Vector2(216, 44));
            ballPositions.Add(new Vector2(220, 45));
            ballPositions.Add(new Vector2(224, 49));
            ballPositions.Add(new Vector2(227, 53));
            ballPositions.Add(new Vector2(230, 60));
            ballPositions.Add(new Vector2(232, 68));
            ballPositions.Add(new Vector2(234, 75));
            ballPositions.Add(new Vector2(235, 77));
            ballPositions.Add(new Vector2(235, 77));
            ballPositions.Add(new Vector2(235, 77));
            ballPositions.Add(new Vector2(235, 75));
            ballPositions.Add(new Vector2(235, 69));
            ballPositions.Add(new Vector2(234, 62));
            ballPositions.Add(new Vector2(233, 56));
            ballPositions.Add(new Vector2(233, 50));
            ballPositions.Add(new Vector2(235, 44));
            ballPositions.Add(new Vector2(238, 37));
            ballPositions.Add(new Vector2(243, 31));
            ballPositions.Add(new Vector2(252, 21));
            ballPositions.Add(new Vector2(262, 15));
            ballPositions.Add(new Vector2(272, 10));
            ballPositions.Add(new Vector2(280, 7));
            ballPositions.Add(new Vector2(287, 5));
            ballPositions.Add(new Vector2(292, 4));

            ballPositionCounter = 0;
        }
예제 #33
0
 /// <summary>
 /// Set your own image as the button background.
 /// </summary>
 /// <param name="image">A FlxSprite object to use for the button background.</param>
 /// <param name="imageHighlight">A FlxSprite object to use for the button background when highlighted (optional).</param>
 /// <returns>This FlxButton instance (nice for chaining stuff together, if you're into that).</returns>
 public FlxButton LoadGraphic(FlxSprite image, FlxSprite imageHighlight)
 {
     _off = Replace(_off, image) as FlxSprite;
     if (imageHighlight == null)
     {
         if (_on != _off)
             Remove(_on);
         _on = _off;
     }
     else
         _on = Replace(_on, imageHighlight) as FlxSprite;
     _on.Solid = _off.Solid = false;
     _off.scrollFactor = scrollFactor;
     _on.scrollFactor = scrollFactor;
     Width = _off.Width;
     Height = _off.Height;
     RefreshHulls();
     return this;
 }
예제 #34
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);
        }
예제 #35
0
        public override void create()
        {
            //Kick the framerate back up
            FlxG.Framerate = 60;
            //FlxG.flashFramerate = 60;

            //Let's setup our elevator, for some wonderful crate bashing goodness
            elevator = new FlxSprite((FlxG.width / 2) - 100, 250, elevatorPNG);
            //Make it able to collide, and make sure it's not tossed around
            elevator.Solid = elevator.Immovable = true;
            //And add it to the state
            add(elevator);

            //Now lets get some crates to smash around, normally I would use an emitter for this
            //kind of scene, but for this demo I wanted to use regular sprites
            //(See ParticlesDemo for an example of an emitter with colliding particles)
            //We'll need a group to place everything in - this helps a lot with collisions
            crateStormGroup = new FlxGroup();
            for (int i = 0; i < numCrates; i++)
            {
                crate = new FlxSprite((FlxG.random() * 200) + 100, 20);
                crate.loadRotatedGraphic(cratePNG, 16, 0);        //This loads in a graphic, and 'bakes' some rotations in so we don't waste resources computing real rotations later
                crate.AngularVelocity = FlxG.random() * 50 - 150; //Make it spin a tad
                crate.Acceleration.Y  = 300;                      //Gravity
                crate.Acceleration.X  = -50;                      //Some wind for good measure
                crate.MaxVelocity.Y   = 500;                      //Don't fall at 235986mph
                crate.MaxVelocity.X   = 200;                      //"      fly  "  "
                crate.Elasticity      = FlxG.random();            //Let's make them all bounce a little bit differently
                crateStormGroup.add(crate);
            }
            add(crateStormGroup);
            //And another group, this time - Red crates
            crateStormGroup2 = new FlxGroup();
            for (int i = 0; i < numCrates; i++)
            {
                crate = new FlxSprite((FlxG.random() * 200) + 100, 20);
                crate.loadRotatedGraphic(cratePNG, 16, 1);
                crate.AngularVelocity = FlxG.random() * 50 - 150;
                crate.Acceleration.Y  = 300;
                crate.Acceleration.X  = 50;
                crate.MaxVelocity.Y   = 500;
                crate.MaxVelocity.X   = 200;
                crate.Elasticity      = FlxG.random();
                crateStormGroup2.add(crate);
            }
            add(crateStormGroup2);

            //Now what we're going to do here is add both of those groups to a new containter group
            //This is useful if you had something like, coins, enemies, special tiles, etc.. that would all need
            //to check for overlaps with something like a player.
            crateStormMegaGroup = new FlxGroup();
            crateStormMegaGroup.add(crateStormGroup);
            crateStormMegaGroup.add(crateStormGroup2);

            //Cute little flixel logo that will ride the elevator
            flixelRider                = new FlxSprite((FlxG.width / 2) - 13, 0, flixelRiderPNG);
            flixelRider.Solid          = flixelRider.Visible = flixelRider.Exists = false;    //But we don't want him on screen just yet...
            flixelRider.Acceleration.Y = 800;
            add(flixelRider);

            //This is for the text at the top of the screen
            topText = new FlxText(0, 2, FlxG.width, "Welcome");
            topText.setAlignment("center");
            add(topText);

            //Lets make a bunch of buttons! YEAH!!!
            crateStorm = new FlxButton(2, FlxG.height - 22, "Crate Storm", onCrateStorm);
            add(crateStorm);
            flxRiderButton = new FlxButton(82, FlxG.height - 22, "Flixel Rider", onFlixelRider);
            add(flxRiderButton);
            crateStormG1 = new FlxButton(162, FlxG.height - 22, "Blue Group", onBlue);
            add(crateStormG1);
            crateStormG2 = new FlxButton(242, FlxG.height - 22, "Red Group", onRed);
            add(crateStormG2);
            groupCollision = new FlxButton(202, FlxG.height - 42, "Collide Groups", onCollideGroups);
            add(groupCollision);
            quitButton = new FlxButton(320, FlxG.height - 22, "Quit", onQuit);
            add(quitButton);

            //And lets get the flixel cursor visible again
            FlxG.mouse.show();
            //Mouse.hide();
        }