Exemplo n.º 1
0
        public void Draw(SpriteBatch spriteBatch, Camera2D cam)
        {
            Vector2 origin = new Vector2 (cam.getTopLeftView().X / Tile.TileWidth, cam.getTopLeftView().Y / Tile.TileHeight);
            int originX = (int)origin.X - 5;	// Offset to cover weird span
            int originY = (int)origin.Y - 3;

            for (int j = 0; j < visibleHeight; j++) {
                for (int i = 0; i < visibleWidth; i++) {
                    try{
                        MapCell cell = Rows [j + originY].Columns [i + originX];
                            spriteBatch.Draw(
                                Tile.TileSetTexture,
                                new Vector2 ((int)cell.Position.X * Tile.TileWidth, (int)cell.Position.Y * Tile.TileHeight),
                                Tile.GetSourceRectangle (cell.TileID),
                                Color.White);
                    } catch {}
                }
            }
        }
Exemplo n.º 2
0
        protected override void Initialize()
        {
            graphics.PreferredBackBufferWidth = 1440;
            graphics.PreferredBackBufferHeight = 900;

            camera2d = new Camera2D ();
            crossHair = new CrossHair ();

            archer = new Archer ();
            soldier = new Soldier ();

            base.Initialize ();
        }