Beispiel #1
0
        /// <summary>
        /// LoadContent вызовется лишь один раз и здесь можно загрузить весь ваш контент.
        /// </summary>
        
        
        protected override void LoadContent()
        {
            // Создание нового SpriteBatch, что позволит рисовать текстуры.
            // Batch (англ.) - пакет, набор.
            spriteBatch = new SpriteBatch(GraphicsDevice);
           
            #region PanzerSprite
            var panzerSprite = new SpriteInfo
            {
                Texture = Content.Load<Texture2D>("panzer2"),
                FrameWidth = 80,
                FrameHeight = 111

            };
            #endregion

            #region ShotSprite
            var shotSprite = new SpriteInfo
            {
                Texture = Content.Load<Texture2D>("shot"),
                FrameWidth = 12,
                FrameHeight = 16,
                TimeToFrame = TimeSpan.FromSeconds(1)
            };
            #endregion

            #region BigBangSprite
            var bigBangSprite = new SpriteInfo
            {
                Texture = Content.Load<Texture2D>("BigBang2"),
                FrameWidth = 64,
                FrameHeight = 64,
                TimeToFrame = TimeSpan.FromMilliseconds(50),
                FrameCount = 25,
                FramesInRow = 5
            };
            #endregion

            #region Map
            var wallbrick = new SpriteInfo { Texture = Content.Load<Texture2D>("wall_brick") };
            var wallconcrete = new SpriteInfo { Texture = Content.Load<Texture2D>("wall_concrete") };
            var forest = new SpriteInfo { Texture = Content.Load<Texture2D>("forest") };
            var water = new SpriteInfo { Texture = Content.Load<Texture2D>("Water") };
            var black = new SpriteInfo { Texture = Content.Load<Texture2D>("Black") };
            var eagle = new SpriteInfo { Texture = Content.Load<Texture2D>("eagle32x32") };

            scenicObjects = new HashSet<ScenicObject>();

            string[,] MasMapsToDraw = null;

            SpriteInfo[] images = { wallbrick, wallconcrete, forest, water, black, eagle };

            ReaderMap.getMap(ReaderMap.Reader(MasMapsToDraw), scenicObjects, images);

            #endregion
            //==========================================================

            panzerObjects = new HashSet<Panzer>();
            bulletObjects = new HashSet<Shot>();

            PlayerPanzer playerPanzer = new PlayerPanzer(new Vector2(400, 300), panzerSprite, 0.1f,
                shotSprite, bigBangSprite, HasCollisions);

            panzerObjects.Add(playerPanzer);
            bulletObjects = playerPanzer.bulletObjects;
            // Используйте this.Content, чтобы загрузить здесь контент вашей игры
        }
Beispiel #2
0
        /// <summary>
        /// LoadContent вызовется лишь один раз и здесь можно загрузить весь ваш контент.
        /// </summary>


        protected override void LoadContent()
        {
            // Создание нового SpriteBatch, что позволит рисовать текстуры.
            // Batch (англ.) - пакет, набор.
            spriteBatch = new SpriteBatch(GraphicsDevice);

            #region PanzerSprite
            var panzerSprite = new SpriteInfo
            {
                Texture     = Content.Load <Texture2D>("panzer2"),
                FrameWidth  = 80,
                FrameHeight = 111
            };
            #endregion

            #region ShotSprite
            var shotSprite = new SpriteInfo
            {
                Texture     = Content.Load <Texture2D>("shot"),
                FrameWidth  = 12,
                FrameHeight = 16,
                TimeToFrame = TimeSpan.FromSeconds(1)
            };
            #endregion

            #region BigBangSprite
            var bigBangSprite = new SpriteInfo
            {
                Texture     = Content.Load <Texture2D>("BigBang2"),
                FrameWidth  = 64,
                FrameHeight = 64,
                TimeToFrame = TimeSpan.FromMilliseconds(50),
                FrameCount  = 25,
                FramesInRow = 5
            };
            #endregion

            #region Map
            var wallbrick = new SpriteInfo {
                Texture = Content.Load <Texture2D>("wall_brick")
            };
            var wallconcrete = new SpriteInfo {
                Texture = Content.Load <Texture2D>("wall_concrete")
            };
            var forest = new SpriteInfo {
                Texture = Content.Load <Texture2D>("forest")
            };
            var water = new SpriteInfo {
                Texture = Content.Load <Texture2D>("Water")
            };
            var black = new SpriteInfo {
                Texture = Content.Load <Texture2D>("Black")
            };
            var eagle = new SpriteInfo {
                Texture = Content.Load <Texture2D>("eagle32x32")
            };

            scenicObjects = new HashSet <ScenicObject>();

            string[,] MasMapsToDraw = null;

            SpriteInfo[] images = { wallbrick, wallconcrete, forest, water, black, eagle };

            ReaderMap.getMap(ReaderMap.Reader(MasMapsToDraw), scenicObjects, images);

            #endregion
            //==========================================================

            panzerObjects = new HashSet <Panzer>();
            bulletObjects = new HashSet <Shot>();

            PlayerPanzer playerPanzer = new PlayerPanzer(new Vector2(400, 300), panzerSprite, 0.1f,
                                                         shotSprite, bigBangSprite, HasCollisions);

            panzerObjects.Add(playerPanzer);
            bulletObjects = playerPanzer.bulletObjects;
            // Используйте this.Content, чтобы загрузить здесь контент вашей игры
        }