public void buildTilesetForOgmo1() //string LevelFile, string Tiles
        {
            //push width / height to flxg.levelheight;

            Dictionary <string, string> w = FlxXMLReader.readAttributesFromOelFile("Lemonade/levels/slf/level1.oel", "level/width");

            FlxG.levelWidth = Convert.ToInt32(w["width"]);
            Dictionary <string, string> h = FlxXMLReader.readAttributesFromOelFile("Lemonade/levels/slf/level1.oel", "level/height");

            FlxG.levelHeight = Convert.ToInt32(h["height"]);

            Console.WriteLine("FlxG.lw = {0} {1}", FlxG.levelWidth, FlxG.levelHeight);


            // ------------------------------------------

            List <Dictionary <string, string> > bgString = FlxXMLReader.readNodesFromOel1File("Lemonade/levels/slf/level" + FlxG.level + ".oel", "level/solids");

            foreach (Dictionary <string, string> nodes in bgString)
            {
                FlxTileblock ta = new FlxTileblock(Convert.ToInt32(nodes["x"]), Convert.ToInt32(nodes["y"]), Convert.ToInt32(nodes["w"]), Convert.ToInt32(nodes["h"]));
                ta.loadTiles(FlxG.Content.Load <Texture2D>("Lemonade/slf1/level1/level1_tiles"), 10, 10, 0);
                ta.auto = FlxTileblock.AUTO;
                collidableTileblocks.add(ta);
            }
        }
Esempio n. 2
0
        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.";
            }
        }
        override public void update()
        {
            if (frames % 4 == 1)
            {
                block.frameNumber++;
                block.loadTiles(FlxG.Content.Load <Texture2D>("Lemonade/fade"), 20, 20, 0);

                //Console.WriteLine("Frames == {0}", frames);

                if (block.frameNumber > 20)
                {
                    block.visible = false;
                }
            }
            if (timer > 0.1f)
            {
                //block.frameNumber = 1;
                //block.loadTiles(FlxG.Content.Load<Texture2D>("Lemonade/fade"), 20, 20, 0);
            }
            if (timer > 0.2f)
            {
                //block.frameNumber = 2;
                //block.loadTiles(FlxG.Content.Load<Texture2D>("Lemonade/fade"), 20, 20, 0);
            }
            if (timer > 0.7f)
            {
                //b2.visible = false;
                //b1.velocity.Y = -500;
            }
            if (timer > 1.9f)
            {
                //b1.visible = false;
            }

            if (timer > 0.85f)
            {
                textTween1.Update(FlxG.elapsedAsGameTime);
                textTween2.Update(FlxG.elapsedAsGameTime);
                bT1.y = textTween1.Position;
                bT2.y = textTween2.Position;
            }
            else
            {
                textTween3.Update(FlxG.elapsedAsGameTime);
                textTween4.Update(FlxG.elapsedAsGameTime);
                bT1.y = textTween3.Position;
                bT2.y = textTween4.Position;
            }



            timer += FlxG.elapsed;
            frames++;
            base.update();
        }
        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;
        }
Esempio n. 5
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);
        }
        //These next two functions look crazy, but all they're doing is generating
        //the level structure and placing the enemy spawners.
        protected void generateLevel()
        {
            int          r = 160;
            FlxTileblock b;

            //First, we create the walls, ceiling and floors:
            b = new FlxTileblock(0, 0, 640, 16);
            b.loadTiles(ImgTech);
            _blocks.add(b);

            b = new FlxTileblock(0, 16, 16, 640 - 16);
            b.loadTiles(ImgTech);
            _blocks.add(b);

            b = new FlxTileblock(640 - 16, 16, 16, 640 - 16);
            b.loadTiles(ImgTech);
            _blocks.add(b);

            b = new FlxTileblock(16, 640 - 24, 640 - 32, 8);
            b.loadTiles(ImgDirtTop);
            _blocks.add(b);

            b = new FlxTileblock(16, 640 - 16, 640 - 32, 16);
            b.loadTiles(ImgDirt);
            _blocks.add(b);

            //Then we split the game world up into a 4x4 grid,
            //and generate some blocks in each area.  Some grid spaces
            //also get a spawner!
            buildRoom(r * 0, r * 0, true);
            buildRoom(r * 1, r * 0);
            buildRoom(r * 2, r * 0);
            buildRoom(r * 3, r * 0, true);
            buildRoom(r * 0, r * 1, true);
            buildRoom(r * 1, r * 1);
            buildRoom(r * 2, r * 1);
            buildRoom(r * 3, r * 1, true);
            buildRoom(r * 0, r * 2);
            buildRoom(r * 1, r * 2);
            buildRoom(r * 2, r * 2);
            buildRoom(r * 3, r * 2);
            buildRoom(r * 0, r * 3, true);
            buildRoom(r * 1, r * 3);
            buildRoom(r * 2, r * 3);
            buildRoom(r * 3, r * 3, true);
        }
        //Just plops down a spawner and some blocks - haphazard and crappy atm but functional!
        protected void buildRoom(int RX, int RY, bool Spawners)
        {
            //first place the spawn point (if necessary)
            int rw = 20;
            int sx = 0;
            int sy = 0;

            if (Spawners)
            {
                sx = (int)(2 + FlxG.random() * (rw - 7));
                sy = (int)(2 + FlxG.random() * (rw - 7));
            }

            //then place a bunch of blocks
            int numBlocks = (int)(3 + FlxG.random() * 4);

            if (!Spawners)
            {
                numBlocks++;
            }
            int  maxW = 10;
            int  minW = 2;
            int  maxH = 8;
            int  minH = 1;
            int  bx;
            int  by;
            int  bw;
            int  bh;
            bool check;

            for (int i = 0; i < numBlocks; i++)
            {
                do
                {
                    //keep generating different specs if they overlap the spawner
                    bw = (int)(minW + FlxG.random() * (maxW - minW));
                    bh = (int)(minH + FlxG.random() * (maxH - minH));
                    bx = (int)(-1 + FlxG.random() * (rw + 1 - bw));
                    by = (int)(-1 + FlxG.random() * (rw + 1 - bh));
                    if (Spawners)
                    {
                        check = ((sx > bx + bw) || (sx + 3 < bx) || (sy > by + bh) || (sy + 3 < by));
                    }
                    else
                    {
                        check = true;
                    }
                } while(!check);

                FlxTileblock b;
                b = new FlxTileblock(RX + bx * 8, RY + by * 8, bw * 8, bh * 8);
                b.loadTiles(ImgTech);
                _blocks.add(b);

                //If the block has room, add some non-colliding "dirt" graphics for variety
                if ((bw >= 4) && (bh >= 5))
                {
                    b = new FlxTileblock(RX + bx * 8 + 8, RY + by * 8, bw * 8 - 16, 8);
                    b.loadTiles(ImgDirtTop);
                    _decorations.add(b);

                    b = new FlxTileblock(RX + bx * 8 + 8, RY + by * 8 + 8, bw * 8 - 16, bh * 8 - 24);
                    b.loadTiles(ImgDirt);
                    _decorations.add(b);
                }
            }

            if (Spawners)
            {
                //Finally actually add the spawner
                Spawner sp = new Spawner(RX + sx * 8, RY + sy * 8, _bigGibs, _enemies, _enemyBullets, _littleGibs, _player);
                _spawners.add(sp);

                //Then create a dedicated camera to watch the spawner
                _hud.add(new FlxSprite(3 + (_spawners.length - 1) * 16, 3, ImgMiniFrame));
                FlxCamera camera = new FlxCamera(10 + (_spawners.length - 1) * 32, 10, 24, 24, 1);
                camera.follow(sp);
                FlxG.addCamera(camera);
            }
        }
Esempio n. 8
0
        protected void buildRoom(int RX, int RY, bool Spawners)
        {
            //first place the spawn point (if necessary)
            int rw = 20;
            int sx = 0;
            int sy = 0;
            if(Spawners)
            {
                sx = 2+(int)(FlxU.random()*(rw-7));
                sy = 2+(int)(FlxU.random()*(rw-7));
            }

            //then place a bunch of blocks
            int numBlocks = 5+(int)(FlxU.random()*4);
            if(!Spawners) numBlocks++;
            int maxW = 10;
            int minW = 2;
            int maxH = 6;
            int minH = 1;
            int bx;
            int by;
            int bw;
            int bh;
            bool check;
            for(int i = 0; i < numBlocks; i++)
            {
                check = false;
                do
                {
                    //keep generating different specs if they overlap the spawner
                    bw = minW + (int)(FlxU.random()*(maxW-minW));
                    bh = minH + (int)(FlxU.random() * (maxH - minH));
                    bx = -1 + (int)(FlxU.random() * (rw + 1 - bw));
                    by = -1 + (int)(FlxU.random() * (rw + 1 - bh));
                    if(Spawners)
                        check = ((sx>bx+bw) || (sx+3<bx) || (sy>by+bh) || (sy+3<by));
                    else
                        check = true;
                } while(!check);

                FlxTileblock b;

                b = new FlxTileblock(RX+bx*8,RY+by*8,bw*8,bh*8);
                b.loadTiles(ImgTech);
                _blocks.add(b);

                //If the block has room, add some non-colliding "dirt" graphics for variety
                if((bw >= 4) && (bh >= 5))
                {
                    b = new FlxTileblock(RX+bx*8+8,RY+by*8,bw*8-16,8);
                    b.loadTiles(ImgDirtTop);
                    _decorations.add(b);

                    b = new FlxTileblock(RX+bx*8+8,RY+by*8+8,bw*8-16,bh*8-24);
                    b.loadTiles(ImgDirt);
                    _decorations.add(b);
                }
            }

            //Finally actually add the spawner
            if(Spawners)
                _spawners.add(new Spawner(RX+sx*8,RY+sy*8,_bigGibs,_bots,_botBullets.members,_littleGibs,_player));
        }
Esempio n. 9
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);
        }
Esempio n. 10
0
        override public void update()
        {
            timer -= FlxG.elapsed;

            block.frameNumber = (int)FlxG.elapsedTotal;
            block.loadTiles(FlxG.Content.Load <Texture2D>("Lemonade/fade"), 20, 20, 0);

            if (FlxControl.LEFTJUSTPRESSED)
            {
                FlxG.play("Lemonade/sfx/cw_sound01");

                selected--;

                tweeners[selected + 1].Reset();
                tweeners[selected + 1].Pause();

                if (selected < 0)
                {
                    selected = 5;
                }

                tweeners[selected].Play();
            }
            if (FlxControl.RIGHTJUSTPRESSED)
            {
                FlxG.play("Lemonade/sfx/cw_sound01");

                selected++;

                tweeners[selected - 1].Reset();
                tweeners[selected - 1].Pause();

                if (selected >= 6)
                {
                    selected = 0;
                }

                tweeners[selected].Play();
            }

            int count = 0;

            foreach (FlxSprite item in icons.members)
            {
                item.x     = tweeners[count].Position.X;
                item.y     = tweeners[count].Position.Y;
                item.scale = tweeners[count].Position.Z;

                tweeners[count].Update(FlxG.elapsedAsGameTime);


                count++;
            }

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

            case 1:
                Lemonade_Globals.location = "military";
                break;

            case 2:
                Lemonade_Globals.location = "newyork";
                break;

            case 3:
                Lemonade_Globals.location = "sydney";
                break;

            case 4:
                Lemonade_Globals.location = "management";
                break;

            case 5:
                Lemonade_Globals.location = "factory";
                break;

            default:
                break;
            }

            t1.text = Lemonade_Globals.niceLocationNames[Lemonade_Globals.location].ToString();
            if (Lemonade_Globals.thisTurnProgress[Lemonade_Globals.location] == 1)
            {
                t1.text += " Complete!";
            }
            //t2.text = String.Format("{0:#,###.#}", timer);

            if (FlxControl.ACTIONJUSTPRESSED && FlxG.elapsedTotal > 0.4f)
            {
                if (Lemonade_Globals.thisTurnProgress[Lemonade_Globals.location] == 1)
                {
                    //t1.text += " Complete!";
                }
                else
                {
                    Lemonade_Globals.restartMusic = true;
                    FlxG.state = new PlayState();
                    return;
                }
            }

            base.update();
        }
Esempio n. 11
0
        override public void create()
        {
            FlxG.backColor = FlxColor.ToColor("dedbc3");
            base.create();

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

            charactersGrp   = new FlxGroup();
            blocksGrp       = new FlxGroup();
            movingBlocksGrp = new FlxGroup();
            doors           = new FlxGroup();
            crates          = new FlxGroup();


            //Dictionary<string,string> levelAttrs = FlxXMLReader.readAttributesFromOelFile("ogmo/level1.oel", "level/grid");
            //FlxTilemap tiles = new FlxTilemap();
            //tiles.useExtraMiddleTiles = false;
            //tiles.auto = FlxTilemap.AUTO;
            //tiles.indexOffset = -1;
            //tiles.loadMap(levelAttrs["grid"], FlxG.Content.Load<Texture2D>("level1_tiles"), 10, 10);
            //tiles.setScrollFactors(0, 0);
            //tiles.boundingBoxOverride = true;

            //blocksGrp.add(tiles);

            List <Dictionary <string, string> > lblocks = FlxXMLReader.readNodesFromOelFile("ogmo/level1.oel", "level/grid");

            foreach (Dictionary <string, string> nodes in lblocks)
            {
                FarTileblock t = new FarTileblock(Convert.ToInt32(nodes["x"]) + (Convert.ToInt32(nodes["w"]) / 2), Convert.ToInt32(nodes["y"]) + (Convert.ToInt32(nodes["h"]) / 2), Convert.ToInt32(nodes["w"]), Convert.ToInt32(nodes["h"]), _world);
                t.auto = FlxTilemap.AUTO;
                t.loadTiles("level1_tiles", 10, 10, 0);
                blocksGrp.add(t);
                t._body.BodyType = BodyType.Static;


                FlxTileblock t2 = new FlxTileblock(Convert.ToInt32(nodes["x"]), Convert.ToInt32(nodes["y"]), Convert.ToInt32(nodes["w"]), Convert.ToInt32(nodes["h"]));
                t2.auto = FlxTilemap.AUTO;
                t2.loadTiles("level1_tiles", 10, 10, 0);
                blocksGrp.add(t2);
            }

            List <Dictionary <string, string> > blocks = FlxXMLReader.readNodesFromOelFile("ogmo/level1.oel", "level/tileblocks");

            foreach (Dictionary <string, string> nodes in blocks)
            {
                if (nodes["Name"] == "elevator")
                {
                    MovingBlock block = new MovingBlock(Convert.ToInt32(nodes["x"]), Convert.ToInt32(nodes["y"]));
                    block.loadGraphic("level1_specialBlock", false, true, 40, 20);
                    movingBlocksGrp.add(block);

                    FlxPath xpath = new FlxPath(null);
                    xpath.add(Convert.ToInt32(nodes["x"]) + 20, Convert.ToInt32(nodes["y"]) + 10);
                    xpath.addPointsUsingStrings(nodes["pathNodesX"], nodes["pathNodesY"], 20, 10);
                    block.followPath(xpath, 80, FlxObject.PATH_FORWARD, false);
                }
                if (nodes["Name"] == "door")
                {
                    Door door = new Door(Convert.ToInt32(nodes["x"]), Convert.ToInt32(nodes["y"]) - 100);
                    doors.add(door);
                }
                //foreach (var item in nodes)
                //{
                //    Console.WriteLine("{0} {1}", item.Key, item.Value);
                //}
            }
            //bat = new Bat(x, y);
            //actors.add(bat);
            //Console.WriteLine("Building a bat {0} {1} {2} {3}", x, y, PathNodesX, PathNodesY);

            //if (PathNodesX != "" && PathNodesY != "")
            //{
            //    Console.WriteLine("Building a path {0} {1} {2}", PathNodesX, PathNodesY, PathCornering);

            //    FlxPath xpath = new FlxPath(null);
            //    xpath.add(x, y);
            //    xpath.addPointsUsingStrings(PathNodesX, PathNodesY);
            //    bat.followPath(xpath, PathSpeed, PathType, false);
            //    bat.pathCornering = PathCornering;


            //}



            Andre andre = new Andre(0, 0);

            charactersGrp.add(andre);

            Liselot liselot = new Liselot(40, 40);

            charactersGrp.add(liselot);

            Army army = new Army(30, 20);

            charactersGrp.add(army);

            Inspector inspector = new Inspector(50, 50);

            charactersGrp.add(inspector);

            Worker worker = new Worker(60, 60);

            charactersGrp.add(worker);

            Chef chef = new Chef(100, 30);

            charactersGrp.add(chef);


            FlxTileblock bg = new FlxTileblock(0, 0, 240, 800);

            bg.auto = FlxTileblock.RANDOM;
            bg.loadTiles("level1_shelfTile", 80, 80, 0);
            add(bg);

            bg      = new FlxTileblock(640, 0, 240, 800);
            bg.auto = FlxTileblock.RANDOM;
            bg.loadTiles("level1_shelfTile", 80, 80, 0);
            add(bg);

            for (int i = 0; i < 5; i++)
            {
                SmallCrate c = new SmallCrate((int)FlxU.random(0, FlxG.width), (int)FlxU.random(0, FlxG.height - 100));
                crates.add(c);
            }

            for (int i = 0; i < 5; i++)
            {
                Bottle b = new Bottle((int)FlxU.random(0, FlxG.width), (int)FlxU.random(0, FlxG.height - 100));
                crates.add(b);
            }
            for (int i = 0; i < 55; i++)
            {
                Fruit f = new Fruit((int)FlxU.random(0, FlxG.width), (int)FlxU.random(0, FlxG.height - 100), _world);
                f._body.ApplyLinearImpulse(new Vector2(20, 2120));


                crates.add(f);
            }


            add(doors);
            add(charactersGrp);
            add(blocksGrp);
            add(movingBlocksGrp);
            add(crates);

            FlxG.showHud();
            FlxG.setHudTextPosition(1, FlxG.width / 2, 10);
            FlxG.setHudTextScale(1, 3);
        }
Esempio n. 12
0
        public override void create()
        {
            //load level settings

            Globals.purgeScoreHistory();

            FlxG.backColor = new Color(0,116,239);
            base.create();

            FlxLine x = new FlxLine(0, 0, new Vector2(0, Globals.diveHeight),
                new Vector2(9000, Globals.diveHeight),
                Color.White, 2);
            add(x);

            x = new FlxLine(0, 0, new Vector2(0, Globals.diveHeight + Globals.poolDepth),
                new Vector2(9000, Globals.diveHeight + Globals.poolDepth),
                Color.White, 2);
            add(x);

            poolSide = new FlxTileblock(0, Globals.diveHeight, 900, 1800);
            poolSide.auto = FlxTileblock.OFF;
            poolSide.loadTiles("tile", 9, 9, 0);

            FlxTileblock poolTile = new FlxTileblock(0, Globals.diveHeight, (int)poolSide.width + Globals.poolWidth + 900, Globals.poolDepth + 9);
            poolTile.auto = FlxTileblock.OFF;
            poolTile.loadTiles("tile", 9, 9, 0);
            poolTile.alpha = 0.3225f;
            add(poolTile);

            poolTile = new FlxTileblock(0, Globals.diveHeight + Globals.poolDepth - 90, (int)poolSide.width + Globals.poolWidth + 900, Globals.poolDepth + 9);
            poolTile.auto = FlxTileblock.OFF;
            poolTile.loadTiles("tile", 9, 9, 0);
            poolTile.alpha = 0.5225f;
            add(poolTile);

            bgTile = new FlxTileblock(0, 0, (int)poolSide.width + Globals.poolWidth + 900, Globals.diveHeight);
            bgTile.auto = FlxTileblock.OFF;
            bgTile.loadTiles("tile", 9, 9, 3);
            bgTile.alpha = 0.125f;
            add(bgTile);

            Globals.jumpPoint = (int)poolSide.width + Globals.poolWidth;

            divingPlatform = new FlxTileblock(Globals.jumpPoint, 90, 900, 1800);
            divingPlatform.auto = FlxTileblock.OFF;
            divingPlatform.loadTiles("tile", 9,9,0);
            add(divingPlatform);

            poolBottom = new FlxTileblock(0, Globals.diveHeight + Globals.poolDepth, (int)poolSide.width + Globals.poolWidth + 900, 180);
            poolBottom.auto = FlxTileblock.OFF;
            poolBottom.loadTiles("tile", 9, 9, 0);
            add(poolBottom);
            add(poolSide);

            diver = new Diver((int)(divingPlatform.x + divingPlatform.width - 64), 90-48);
            add(diver);

            bubbles = new Bubbles(0, 0);
            add(bubbles);

            FlxG.follow(diver, 50);

            FlxG.followBounds(0, 0, (int)(poolSide.width + Globals.poolWidth + divingPlatform.width), 9000);

            FlxG.score = 0;

            scoreText = new InformationText(0, 30, FlxG.width);
            scoreText.setFormat(null, 2, Color.White, FlxJustification.Center, Color.Black);
            scoreText.visible = false;
            scoreText.setScrollFactors(0, 0);
            add(scoreText);
        }