Пример #1
0
        /// <summary>
        /// Allows the game to perform any initialization it needs to before starting to run.
        /// This is where it can query for any required services and load any non-graphic
        /// related content.  Calling base.Initialize will enumerate through any components
        /// and initialize them as well.
        /// </summary>
        protected override void Initialize()
        {
            if (!Directory.Exists(System.IO.Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), "Arman")))
                Directory.CreateDirectory(System.IO.Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), "Arman"));
            //path = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), "Arman", "level.alvl");
            path = @"C:\Users\Cendrb\Downloads\level.alvl";

            graphics.PreferredBackBufferHeight = 800;
            graphics.PreferredBackBufferWidth = 1600;
            graphics.ApplyChanges();

            TexturesPaths appData = new TexturesPaths();

            appData.Player = @"Sprites/Entities/player";
            appData.Mob = @"Sprites/Entities/mob";
            appData.MovableBlock = @"Sprites/Entities/movable";
            appData.SolidBlock = @"Sprites/Blocks/solid";
            appData.AirBlock = @"Sprites/Blocks/air";
            appData.Detector = @"Sprites/Blocks/detector";
            appData.Coin = @"Sprites/Blocks/coin";
            appData.Home = @"Sprites/Blocks/detector"; // TERXTURE!
            appData.KeyLockColorDot = @"Sprites/5dot";

            area = new GameArea(this, path, appData);
            Components.Add(area);

            base.Initialize();
        }
Пример #2
0
        public static bool Load(TexturesPaths paths, World tools)
        {
            Air = tools.Game.Content.Load<Texture2D>(paths.AirBlock);
            Mob = tools.Game.Content.Load<Texture2D>(paths.Mob);
            MovableBlock = tools.Game.Content.Load<Texture2D>(paths.MovableBlock);
            Solid = tools.Game.Content.Load<Texture2D>(paths.SolidBlock);
            Player = tools.Game.Content.Load<Texture2D>(paths.Player);
            Detector = tools.Game.Content.Load<Texture2D>(paths.Detector);
            Home = tools.Game.Content.Load<Texture2D>(paths.Home);
            Coin = tools.Game.Content.Load<Texture2D>(paths.Coin);
            KeyLockColorDot = tools.Game.Content.Load<Texture2D>(paths.KeyLockColorDot);

            SpriteBatch = new Microsoft.Xna.Framework.Graphics.SpriteBatch(tools.Game.GraphicsDevice);

            return true;
        }
Пример #3
0
 public GameArea(Game game, string levelSource, TexturesPaths paths)
     : base(game)
 {
     levelSourcePath = levelSource;
     this.paths = paths;
 }