diff --git a/isometric-park-fna/FNAGame.cs b/isometric-park-fna/FNAGame.cs --- a/isometric-park-fna/FNAGame.cs +++ b/isometric-park-fna/FNAGame.cs @@ -171,7 +171,7 @@ float boardy = ((adjustedMousePos.Y / Tile.TileSpriteHeight) - (adjustedMousePos.X / Tile.TileSpriteWidth)); - return new Vector2(boardx, boardy); + return new Vector2((int)boardx, (int)boardy); /* int gridx = (int)((normalizedMousePos.X + (this.baseOffsetX + 4)) / Tile.TileWidth) ; int gridy = (int)((normalizedMousePos.Y + (this.baseOffsetX + 4) + (2*baseOffsetY)) / (Tile.TileStepY)); @@ -378,9 +378,18 @@ depthOffset); */ + int height_adjust = 0; - int screenx = (x - y) * Tile.TileSpriteWidth / 2; - int screeny = (x + y) * Tile.TileSpriteHeight / 2; + if (height > 1) //not sure why this is necessary :/ + { + height_adjust = height; + } + + int adjustedx = x - height_adjust; + int adjustedy = y - height_adjust; + + int screenx = (adjustedx - adjustedy) * Tile.TileSpriteWidth / 2; + int screeny = (adjustedx + adjustedy) * Tile.TileSpriteHeight / 2; batch.Draw( Tile.TileSetTexture, @@ -620,11 +629,24 @@ batch.DrawString(font, this.mouseGrid.ToString(), new Vector2(360, 33), Color.Black, 0.0f, Vector2.Zero, 1.0f, SpriteEffects.None, 0.5f); batch.DrawString(font, this.mouseGrid.ToString(), new Vector2(359, 32), Color.White, 0.0f, Vector2.Zero, 1.0f, SpriteEffects.None, 0.49f); - + /* batch.DrawString(font, this.original_point.ToString(), new Vector2(460, 33), Color.Black, 0.0f, Vector2.Zero, 1.0f, SpriteEffects.None, 0.5f); batch.DrawString(font, this.original_point.ToString(), new Vector2(459, 32), Color.White, 0.0f, Vector2.Zero, 1.0f, SpriteEffects.None, 0.49f); //*/ //Matrix.Multiply() + + + if (MathUtils.Between(this.mouseGrid.X, 0, this.squaresAcross) && MathUtils.Between(this.mouseGrid.Y, 0, this.squaresAcross)) + { + bool has_tree = this.map.cells[(int)this.mouseGrid.X][(int)this.mouseGrid.Y].hasTree; + batch.DrawString(font, has_tree.ToString(), new Vector2(500, 33), Color.Black, 0.0f, Vector2.Zero, 1.0f, SpriteEffects.None, 0.5f); + batch.DrawString(font, has_tree.ToString(), new Vector2(499, 32), Color.White, 0.0f, Vector2.Zero, 1.0f, SpriteEffects.None, 0.49f); + + + } + + + batch.End();