Ejemplo n.º 1
0
        public void Draw(SpriteBatch spriteBatch, IsometricTile tile)
        {
            int yOff = 32;             // how much to displace actor up from tile (may not want this to be uniform...

            foreach (int ID in tile.ActorList)
            {
                SpriteClass actor = new SpriteClass(tile.X, tile.Y - (yOff * scale), scale);

                if (ID == TURTLE)
                {
                    actor.texture = turtle;
                }

                if (ID == TURTLEGANG)
                {
                    actor.texture = turtleGang;
                }

                if (ID == BADGER)
                {
                    actor.texture = badger;
                }

                // TODO try/catch for null texture, cause that can totally happen if ID is invalid
                actor.Draw(spriteBatch);
            }
        }
Ejemplo n.º 2
0
        public IsometricMap(ContentManager content, GraphicsDevice graphicsDevice, Vector2 windowDimensions, int xLength, int yLength, int zLength, float scale)
        {
            this.xLength = xLength;
            this.yLength = yLength;
            this.zLength = zLength;
            this.scale   = scale;

            mouseHandler = new MouseHandler();

            lastKey = '_';

            tileMap       = new IsometricTile[xLength, yLength, zLength];
            tileMapIso    = new IsometricTile[xLength * 2 - 1, yLength *2 - 1, zLength];
            mapObjectList = new List <MapObject>();

            yCharacterOffset = 16 * scale;

            // load grass texture
            //grass = new SpriteClass(content, "tile-grass-no-detail", 0, 0, this.scale);
            //grass = new SpriteClass(content, "pixel-tile-deep", 0, 0, this.scale);
            grass = new SpriteClass(content, "pixel-tile-square", 0, 0, this.scale * .75f);

            int tileWidth  = (int)(grass.texture.Width * this.scale * .75f);
            int tileHeight = (int)(grass.texture.Height * this.scale * .75f);

            Vector2 boardDimensions = new Vector2(xLength * tileWidth, yLength * tileHeight);
            Vector2 startingPoint   = new Vector2(windowDimensions.X / 2 - boardDimensions.X / 2 - tileWidth / 2, windowDimensions.Y / 2 - boardDimensions.Y / 2 - tileHeight / 2);


            badger = new Badger(content, 3, 3, 0, scale);
            mapObjectList.Add(badger);

            for (int x = 0; x < xLength; x++)
            {
                for (int y = 0; y < yLength; y++)
                {
                    for (int z = 0; z < zLength; z++)
                    {
                        IsometricTile newTile;
                        if (z == 0 || x == 3 || y == 3)
                        {
                            newTile = new IsometricTile(1, 0, 0);
                        }

                        else
                        {
                            newTile = new IsometricTile(0, 0, 0);
                        }


                        newTile.X = startingPoint.X + x * tileWidth;
                        newTile.Y = startingPoint.Y + y * tileHeight;

                        tileMap[x, y, z] = newTile;
                        //tileMapIso[(int)iso.X, (int)iso.Y, z] = newTile;
                    }
                }
            }
        }
Ejemplo n.º 3
0
 public TileBrush(ContentManager content)
 {
     grass = new SpriteClass(content, "pixel-tile-deep");
 }
Ejemplo n.º 4
0
 protected override void LoadContent()
 {
     spriteBatch = new SpriteBatch(GraphicsDevice);
     map         = new IsometricMap(this.Content, GraphicsDevice, new Vector2(windowWidth, windowHeight), 8, 8, 1, 2f);
     turtle      = new SpriteClass(this.Content, "halberd-badger-nobg", 0, 0, 3f);
 }