예제 #1
0
        static void LevelLoader_Block1()
        {
            // Block loaders
            loaders.Add("indBrick", (game, x, y) =>
            {
                game.Map.SetBlock(x, y, new BrickIndestructable());
            });

            loaders.Add("grBrick", (game, x, y) =>
            {
                game.Map.SetBlock(x, y, new GroundBrick());
            });

            loaders.Add("hidBlock", (game, x, y) =>
            {
                game.Map.SetBlock(x, y, new HiddenBlock(game, new MushroomOneUp(game, x, y - 1)));
            });

            loaders.Add("multiBlock", (game, x, y) =>
            {
                game.Map.SetBlock(x, y, new MultiCoinBlock(game, new Coin(game, new Vector2(x, y - 1))));
            });

            loaders.Add("usedBlock", (game, x, y) =>
            {
                QuestionBlock block = new QuestionBlock(game, null);
                block.Hit(null);
                game.Map.SetBlock(x, y, block);
            });

            loaders.Add("FireBlock", (game, x, y) =>
            {
                IBlock block = new FireBlock(game, x, y);
                game.Map.SetBlock(x, y, block);
            });

            loaders.Add("grayFixBlock", (game, x, y) =>
            {
                IBlock block = new GrayFixBlock();
                game.Map.SetBlock(x, y, block);
            });

            loaders.Add("UGBrick", (game, x, y) =>
            {
                game.Map.SetBlock(x, y, new UGBrick(game));
            });

            loaders.Add("UGgrBrick", (game, x, y) =>
            {
                game.Map.SetBlock(x, y, new UGGroundBrick());
            });

            loaders.Add("GrayBrick", (game, x, y) =>
            {
                game.Map.SetBlock(x, y, new GrayBrick());
            });
        }
예제 #2
0
        void addBlock(String line)
        {
            String[] split = line.Split(',');
            IObject  block;
            //Debug.WriteLine(split[0]);
            float x = ((Int32.Parse(split[1]) - 1) * blockBaseDimension * blockSizeMod) + screenX + (2 * blockBaseDimension * blockSizeMod);
            float y = ((Int32.Parse(split[2]) - 1) * blockBaseDimension * blockSizeMod) + screenY + (2 * blockBaseDimension * blockSizeMod);

            switch (split[0])
            {
            case "bluesandblock":
                block = new BlueSandBlock(sprites["tileset"], new Vector2(x, y));
                break;

            case "dragonblock":
                block = new DragonBlock(sprites["tileset"], new Vector2(x, y));
                break;

            case "dungeonblock":
                block = new DungeonBlock(sprites["tileset"], new Vector2(x, y));
                break;

            case "pushableblock":
                block = new PushableBlock(sprites["tileset"], new Vector2(x, y), split[3]);
                break;

            case "stairsblock":
                block = new StairsBlock(sprites["tileset"], new Vector2(x, y));
                break;

            case "fireblock":
                block = new FireBlock(sprites["fire"], new Vector2(x + 8, y));
                break;

            case "fishblock":
                block = new FishBlock(sprites["tileset"], new Vector2(x, y));
                break;

            case "solidblock":
                Color c = Color.Transparent;
                if (split[3] == "blue")
                {
                    c = Color.Blue;
                }
                block = new SolidBlock(sprites["Backgrounds"], new Vector2(x, y), c);
                break;

            default:
                block = new DungeonBlock(sprites["tileset"], new Vector2(x, y));
                break;
            }
            Blocks.Add(block);
        }
예제 #3
0
 public override void PlayerUseItem(World world, PlayerEntity player, Vector3 location, Vector3 targetBlock, byte facing)
 {
     FireBlock b = new FireBlock();
     if (b.BlockPlaced(world, location, targetBlock, facing, player))
         world.SetBlock(location, b);
 }