Beispiel #1
0
 /// <summary>
 /// LoadContent will be called once per game and is the place to load
 /// all of your content.
 /// </summary>
 protected override void LoadContent()
 {
     // Create a new SpriteBatch, which can be used to draw textures.
     spriteBatch = new SpriteBatch(GraphicsDevice);
     titleScreen = new TitleScreen();
     textureList = new TextureList(Content);
     map = new Map(spriteBatch, textureList, graphics.GraphicsDevice.Viewport);
     character = new Character(graphics.GraphicsDevice.Viewport, map.tileList.First());
 }
Beispiel #2
0
 public void Draw(SpriteBatch spriteBatch, TextureList textureList)
 {
     if (selected)
     {
         spriteBatch.Draw(textureList.Get("character-selected"), position, Color.White);
     }
     else
     {
         spriteBatch.Draw(textureList.Get("character"), position, Color.White);
     }
 }
Beispiel #3
0
        public Map(SpriteBatch spriteBatch, TextureList newTextureList, Viewport viewport)
        {
            textureList = newTextureList;
            tileList = new List<Tile>();

            for (int x = 0; x < (viewport.Width) / 32; x++)
            {
                for (int y = 0; y < (viewport.Height - 128) / 32; y++)
                {
                    if ((x == 3 && y < 10) || (x > 2 && x < 4 && y > 4 && y < 10))
                    {
                        Tile mountainTile = new Tile(textureList.Get("tile-mountain"), new Vector2(x * 32, y * 32));
                        mountainTile.restricted = true;
                        tileList.Add(mountainTile);
                    }
                    else
                    {
                        Tile grassTile = new Tile(textureList.Get("tile-grass"), new Vector2(x * 32, y * 32));
                        tileList.Add(grassTile);
                    }
                }
            }
        }
Beispiel #4
0
 public void Draw(SpriteBatch spriteBatch, TextureList textureList)
 {
     spriteBatch.Draw(textureList.Get("title-screen"), new Vector2(0, 0), Color.White);
 }
Beispiel #5
0
 public void Draw(SpriteBatch spriteBatch, TextureList textureList)
 {
     foreach (Tile tile in tileList)
     {
         if (tile.isPath)
         {
             spriteBatch.Draw(textureList.Get("tile-grass-path"), tile.position, Color.White);
         }
         else
         {
             spriteBatch.Draw(tile.texture, tile.position, Color.White);
         }
     }
 }