Exemple #1
0
        protected override void Initialize()
        {
            mapTileSheet = new SpriteSheet(Content, GraphicsDevice);
            map = new World(Content, player);
            player = new Player(Content, map);

            base.Initialize();
        }
Exemple #2
0
        Player player; // allow direct communication between player and map

        #endregion Fields

        #region Constructors

        // TODO: set scroll speed to player's max velocity once map and player can directly communicate
        public World(ContentManager content, Player player)
        {
            this.player = player;

            mapLayoutImage = content.Load<Texture2D>("images/map");

            // map image width and height - used to determine size of arrays
            mapImageWidth = (short)mapLayoutImage.Width;
            mapImageHeight = (short)mapLayoutImage.Height;

            tileMap = new Tile[mapImageWidth, mapImageHeight];
            pixelColor1d = new Color[mapImageWidth*mapImageHeight];
            pixelColor2d = new Color[mapImageWidth, mapImageHeight];

            GetPixels();
            CreateMap();
        }