Description:
Fix object positioning.
Commit status:
[Not Reviewed]
References:
Comments:
0 Commit comments 0 Inline Comments
Unresolved TODOs:
There are no unresolved TODOs
Add another comment

r14:5cebba7957f3 -

@@ -171,7 +171,7
171 float boardy = ((adjustedMousePos.Y / Tile.TileSpriteHeight) - (adjustedMousePos.X / Tile.TileSpriteWidth));
171 float boardy = ((adjustedMousePos.Y / Tile.TileSpriteHeight) - (adjustedMousePos.X / Tile.TileSpriteWidth));
172
172
173
173
174 return new Vector2(boardx, boardy);
174 return new Vector2((int)boardx, (int)boardy);
175 /*
175 /*
176 int gridx = (int)((normalizedMousePos.X + (this.baseOffsetX + 4)) / Tile.TileWidth) ;
176 int gridx = (int)((normalizedMousePos.X + (this.baseOffsetX + 4)) / Tile.TileWidth) ;
177 int gridy = (int)((normalizedMousePos.Y + (this.baseOffsetX + 4) + (2*baseOffsetY)) / (Tile.TileStepY));
177 int gridy = (int)((normalizedMousePos.Y + (this.baseOffsetX + 4) + (2*baseOffsetY)) / (Tile.TileStepY));
@@ -378,9 +378,18
378 depthOffset);
378 depthOffset);
379 */
379 */
380
380
381 int height_adjust = 0;
381
382
382 int screenx = (x - y) * Tile.TileSpriteWidth / 2;
383 if (height > 1) //not sure why this is necessary :/
383 int screeny = (x + y) * Tile.TileSpriteHeight / 2;
384 {
385 height_adjust = height;
386 }
387
388 int adjustedx = x - height_adjust;
389 int adjustedy = y - height_adjust;
390
391 int screenx = (adjustedx - adjustedy) * Tile.TileSpriteWidth / 2;
392 int screeny = (adjustedx + adjustedy) * Tile.TileSpriteHeight / 2;
384
393
385 batch.Draw(
394 batch.Draw(
386 Tile.TileSetTexture,
395 Tile.TileSetTexture,
@@ -620,11 +629,24
620
629
621 batch.DrawString(font, this.mouseGrid.ToString(), new Vector2(360, 33), Color.Black, 0.0f, Vector2.Zero, 1.0f, SpriteEffects.None, 0.5f);
630 batch.DrawString(font, this.mouseGrid.ToString(), new Vector2(360, 33), Color.Black, 0.0f, Vector2.Zero, 1.0f, SpriteEffects.None, 0.5f);
622 batch.DrawString(font, this.mouseGrid.ToString(), new Vector2(359, 32), Color.White, 0.0f, Vector2.Zero, 1.0f, SpriteEffects.None, 0.49f);
631 batch.DrawString(font, this.mouseGrid.ToString(), new Vector2(359, 32), Color.White, 0.0f, Vector2.Zero, 1.0f, SpriteEffects.None, 0.49f);
623
632 /*
624 batch.DrawString(font, this.original_point.ToString(), new Vector2(460, 33), Color.Black, 0.0f, Vector2.Zero, 1.0f, SpriteEffects.None, 0.5f);
633 batch.DrawString(font, this.original_point.ToString(), new Vector2(460, 33), Color.Black, 0.0f, Vector2.Zero, 1.0f, SpriteEffects.None, 0.5f);
625 batch.DrawString(font, this.original_point.ToString(), new Vector2(459, 32), Color.White, 0.0f, Vector2.Zero, 1.0f, SpriteEffects.None, 0.49f);
634 batch.DrawString(font, this.original_point.ToString(), new Vector2(459, 32), Color.White, 0.0f, Vector2.Zero, 1.0f, SpriteEffects.None, 0.49f);
626 //*/
635 //*/
627 //Matrix.Multiply()
636 //Matrix.Multiply()
637
638
639 if (MathUtils.Between(this.mouseGrid.X, 0, this.squaresAcross) && MathUtils.Between(this.mouseGrid.Y, 0, this.squaresAcross))
640 {
641 bool has_tree = this.map.cells[(int)this.mouseGrid.X][(int)this.mouseGrid.Y].hasTree;
642 batch.DrawString(font, has_tree.ToString(), new Vector2(500, 33), Color.Black, 0.0f, Vector2.Zero, 1.0f, SpriteEffects.None, 0.5f);
643 batch.DrawString(font, has_tree.ToString(), new Vector2(499, 32), Color.White, 0.0f, Vector2.Zero, 1.0f, SpriteEffects.None, 0.49f);
644
645
646 }
647
648
649
628 batch.End();
650 batch.End();
629
651
630
652
You need to be logged in to leave comments. Login now