Пример #1
0
        public static void MakeANewSetOfBlocks()
        {
            int blockStructureWidth = new Block().Sprite.Image.Height * 4;

            for (int i = 0; i < _howManyBlocks; i++)
            {
                MakeOneBlock(new Vector2(Position.X + blockStructureWidth * i + _howFarApart * i, Position.Y));
            }
        }
Пример #2
0
        private static void MakeOneBlock(Vector2 position)
        {
            int blockSide = new Block().Sprite.Image.Height; //Since a block is square shaped it dosen't matter wich side you take

            TileObjectCreator.Create
                (blockSide, blockSide, position,

                new Dictionary<char, Type>()
                {
                    {'x', typeof(Block)},
                    {'0', null}
                },

                "xxxx",
                "xxxx",
                "x00x");
        }
Пример #3
0
            public override void Create(GameObject createdObject)
            {
                if (createdObject == this)
                {
                    Visable = false;
                    Solid = false;

                    int blockSide = new Block().Sprite.Image.Height; //Since a block is square shaped it dosen't matter wich side you take

                    //Make a thin sprite as tall as an barrier. It is positioned where barriers are.
                    Sprite = new Sprite(TextureContainer.ColoredRectangle(Color.White, 3,
                        blockSide * 3), new Vector2(SpaceInvaders.Device.Viewport.Width / 2, BlockMaker.Position.Y));
                        //Creates it where the player shoots bullets
                }
            }