【发布时间】:2013-07-10 15:18:42
【问题描述】:
我尝试创建一个等距地图编辑器,但在生成地图时偶然发现了这个问题:
http://postimg.org/image/atsqgu5on/
我生成的地图看起来像 (A) 方案,屏幕外有一些图块。我必须对代码进行哪些更改才能获得 (B)-ish 地图?
这是我用来在地图中创建单元格的代码。 (32是瓦片的高度和宽度)
for (int i = 0; i <this.Height; i++)
{
Map[i] = new Rectangle[Width];
miniMap[i] = new Rectangle[Width];
for (int j = 0; j < this.Width; j++)
{
int x = 32 * j;
int y = 32 * i;
int isoX = x - y;
int isoY = (x + y) / 2;
Map[i][j] = new Rectangle(isoX,isoY, 64, 64);
}
不知何故,我知道问题出在此处: int isoX = x - y;但我不知道要改变什么才能得到我想要的结果。 感谢您的帮助。
【问题讨论】: